From c607da68bfb7f7440d5be7f0396609dc01eb0e90 Mon Sep 17 00:00:00 2001 From: sa282w Date: Tue, 1 May 2018 16:45:26 -0400 Subject: Changes for 2.4.0-SNAPSHOT Issue-ID: PORTAL-210 Included the pom changes for 2.4.0-SNAPSHOT, music and AAF changes. Change-Id: Ib1e1c2679271aa40eb3b50397724e8cdc5ffe01c Signed-off-by: sa282w --- ecomp-sdk/epsdk-aaf/pom.xml | 165 ++++ .../authorization/domain/ExternalAccessPerms.java | 178 ++++ .../domain/ExternalAccessPermsDetail.java | 127 +++ .../authorization/domain/ExternalAccessRole.java | 76 ++ .../domain/ExternalAccessRolePerms.java | 66 ++ .../authorization/domain/ExternalAccessUser.java | 65 ++ .../domain/ExternalAccessUserRoleDetail.java | 104 +++ .../authorization/domain/ExternalAuthUserRole.java | 74 ++ .../domain/ExternalRoleDescription.java | 150 ++++ .../exception/UserNotFoundException.java | 47 + .../service/LoginExternalAuthService.java | 80 ++ .../service/LoginExternalAuthServiceImpl.java | 252 ++++++ .../authorization/service/UserApiService.java | 66 ++ .../authorization/service/UserApiServiceImpl.java | 319 +++++++ .../util/EcompExternalAuthProperties.java | 123 +++ .../authorization/util/EcompExternalAuthUtils.java | 139 +++ ecomp-sdk/epsdk-analytics/pom.xml | 2 +- .../analytics/system/fusion/adapter/DateUtils.java | 2 +- .../system/fusion/adapter/FusionAdapter.java | 3 +- .../analytics/controller/WizardProcessorTest.java | 6 +- .../model/runtime/RaptorControllerAsyncTest.java | 8 - .../analytics/xmlobj/ChartJSONHelperTest.java | 24 +- ecomp-sdk/epsdk-app-common/pom.xml | 39 +- .../controller/core/FavoritesController.java | 1 - .../controller/core/FuncMenuController.java | 1 - .../controller/core/LogoutController.java | 2 +- .../controller/sample/BroadcastController.java | 1 - .../service/OnBoardingApiServiceImpl.java | 2 - .../core/AngularAdminControllerTest.java | 7 +- .../controller/core/FnMenuControllerTest.java | 1 - .../controller/core/MenuListControllerTest.java | 1 - .../core/ProfileSearchControllerTest.java | 3 +- .../controller/core/RoleControllerTest.java | 3 +- .../core/RoleFunctionListControllerTest.java | 3 +- .../controller/core/RoleListControllerTest.java | 4 +- .../controller/core/UserProfileControllerTest.java | 2 +- ecomp-sdk/epsdk-app-os/README.md | 7 +- ecomp-sdk/epsdk-app-os/pom.xml | 2 +- .../src/main/resources/music.properties | 32 +- .../epsdk-app-os/src/main/webapp/WEB-INF/web.xml | 2 +- ecomp-sdk/epsdk-app-overlay/pom.xml | 2 +- .../webapp/WEB-INF/fusion/defs/definitions.xml | 5 +- ecomp-sdk/epsdk-core/pom.xml | 212 +++-- .../java/org/onap/portalsdk/core/FusionObject.java | 122 --- .../org/onap/portalsdk/core/command/LoginBean.java | 9 + .../portalsdk/core/command/PostSearchBean.java | 1 + .../onap/portalsdk/core/dao/support/FusionDao.java | 2 +- .../java/org/onap/portalsdk/core/domain/App.java | 225 ----- .../org/onap/portalsdk/core/domain/AuditLog.java | 128 --- .../portalsdk/core/domain/BroadcastMessage.java | 135 --- .../org/onap/portalsdk/core/domain/DomainVo.java | 186 ---- .../org/onap/portalsdk/core/domain/FnMenu.java | 184 ---- .../org/onap/portalsdk/core/domain/FusionVo.java | 46 - .../org/onap/portalsdk/core/domain/LoginBean.java | 212 ----- .../org/onap/portalsdk/core/domain/Lookup.java | 99 --- .../org/onap/portalsdk/core/domain/LuCountry.java | 95 -- .../org/onap/portalsdk/core/domain/LuState.java | 78 -- .../org/onap/portalsdk/core/domain/LuTimeZone.java | 89 -- .../java/org/onap/portalsdk/core/domain/Menu.java | 173 ---- .../org/onap/portalsdk/core/domain/MenuData.java | 87 -- .../org/onap/portalsdk/core/domain/Profile.java | 112 --- .../java/org/onap/portalsdk/core/domain/Role.java | 185 ---- .../onap/portalsdk/core/domain/RoleFunction.java | 108 --- .../onap/portalsdk/core/domain/UrlsAccessible.java | 95 -- .../portalsdk/core/domain/UrlsAccessibleKey.java | 93 -- .../java/org/onap/portalsdk/core/domain/User.java | 594 ------------- .../org/onap/portalsdk/core/domain/UserApp.java | 123 --- .../org/onap/portalsdk/core/domain/UserAppId.java | 106 --- .../portalsdk/core/domain/support/Attribute.java | 87 -- .../core/domain/support/CollaborateList.java | 72 -- .../portalsdk/core/domain/support/Container.java | 320 ------- .../onap/portalsdk/core/domain/support/Domain.java | 222 ----- .../portalsdk/core/domain/support/DomainVo.java | 195 ----- .../portalsdk/core/domain/support/Element.java | 154 ---- .../core/domain/support/ElementDetails.java | 77 -- .../core/domain/support/FusionCommand.java | 54 -- .../onap/portalsdk/core/domain/support/Layout.java | 955 --------------------- .../portalsdk/core/domain/support/NameValueId.java | 105 --- .../portalsdk/core/domain/support/Position.java | 60 -- .../onap/portalsdk/core/domain/support/Size.java | 60 -- .../core/exception/support/FusionException.java | 2 +- .../core/interceptor/ResourceInterceptor.java | 1 - .../core/logging/aspect/EELFLoggerAspect.java | 2 +- .../org/onap/portalsdk/core/menu/MenuBuilder.java | 2 +- .../objectcache/support/FusionCacheManager.java | 2 +- .../portalsdk/core/service/AuditServiceImpl.java | 2 +- .../core/service/DataAccessServiceImpl.java | 1 + .../portalsdk/core/service/LdapServiceImpl.java | 2 +- .../core/service/LoginServiceCentralizedImpl.java | 6 +- .../portalsdk/core/service/LoginServiceImpl.java | 2 +- .../core/service/PostSearchServiceImpl.java | 2 +- .../portalsdk/core/service/ProfileServiceImpl.java | 2 +- .../portalsdk/core/service/RoleServiceImpl.java | 2 +- .../core/service/UserServiceCentalizedImpl.java | 1 - .../core/service/support/FusionService.java | 2 +- .../onap/portalsdk/core/util/SystemProperties.java | 4 + .../onap/portalsdk/core/web/support/AppUtils.java | 7 +- .../portalsdk/core/dao/ProfileDaoImplTest.java | 1 - .../org/onap/portalsdk/core/domain/AppTest.java | 123 --- .../onap/portalsdk/core/domain/AuditLogTest.java | 73 -- .../core/domain/BroadcastMessageTest.java | 101 --- .../org/onap/portalsdk/core/domain/FnMenuTest.java | 98 --- .../onap/portalsdk/core/domain/LoginBeanTest.java | 83 -- .../org/onap/portalsdk/core/domain/LookupTest.java | 73 -- .../onap/portalsdk/core/domain/LuCountryTest.java | 77 -- .../onap/portalsdk/core/domain/LuStateTest.java | 65 -- .../onap/portalsdk/core/domain/LuTimeZoneTest.java | 68 -- .../onap/portalsdk/core/domain/MenuDataTest.java | 72 -- .../org/onap/portalsdk/core/domain/MenuTest.java | 84 -- .../onap/portalsdk/core/domain/ProfileTest.java | 70 -- .../portalsdk/core/domain/RoleFunctionTest.java | 69 -- .../org/onap/portalsdk/core/domain/RoleTest.java | 111 --- .../core/domain/UrlsAccessibleKeyTest.java | 77 -- .../portalsdk/core/domain/UrlsAccessibleTest.java | 75 -- .../onap/portalsdk/core/domain/UserAppIdTest.java | 87 -- .../onap/portalsdk/core/domain/UserAppTest.java | 89 -- .../org/onap/portalsdk/core/domain/UserTest.java | 216 ----- .../core/domain/sessionmgt/TimeoutVOTest.java | 3 +- .../restful/client/PortalRestClientBaseTest.java | 1 - .../client/SharedContextRestClientTest.java | 1 - .../core/service/DataAccessServiceImplTest.java | 2 +- .../portalsdk/core/service/UrlAccessImplTest.java | 2 - .../core/service/UserProfileServiceImplTest.java | 7 - .../service/UserServiceCentalizedImplTest.java | 1 - .../portalsdk/domain/support/AttributeTest.java | 79 -- .../domain/support/CollaborateListTest.java | 60 -- .../portalsdk/domain/support/ContainerTest.java | 193 ----- .../onap/portalsdk/domain/support/DomainTest.java | 143 --- .../portalsdk/domain/support/DomainVOTest.java | 107 --- .../domain/support/ElementDetailsTest.java | 64 -- .../onap/portalsdk/domain/support/ElementTest.java | 77 -- .../domain/support/FusionCommandTest.java | 65 -- .../onap/portalsdk/domain/support/LayoutTest.java | 336 -------- .../portalsdk/domain/support/NameValueIdTest.java | 82 -- .../portalsdk/domain/support/PositionTest.java | 68 -- .../onap/portalsdk/domain/support/SizeTest.java | 69 -- ecomp-sdk/epsdk-domain/.gitignore | 1 + ecomp-sdk/epsdk-domain/pom.xml | 95 ++ .../java/org/onap/portalsdk/core/domain/App.java | 225 +++++ .../org/onap/portalsdk/core/domain/AuditLog.java | 128 +++ .../portalsdk/core/domain/BroadcastMessage.java | 135 +++ .../org/onap/portalsdk/core/domain/DomainVo.java | 186 ++++ .../org/onap/portalsdk/core/domain/FnMenu.java | 182 ++++ .../onap/portalsdk/core/domain/FusionObject.java | 122 +++ .../org/onap/portalsdk/core/domain/FusionVo.java | 44 + .../org/onap/portalsdk/core/domain/LoginBean.java | 212 +++++ .../org/onap/portalsdk/core/domain/Lookup.java | 99 +++ .../org/onap/portalsdk/core/domain/LuCountry.java | 95 ++ .../org/onap/portalsdk/core/domain/LuState.java | 78 ++ .../org/onap/portalsdk/core/domain/LuTimeZone.java | 89 ++ .../java/org/onap/portalsdk/core/domain/Menu.java | 173 ++++ .../org/onap/portalsdk/core/domain/MenuData.java | 87 ++ .../org/onap/portalsdk/core/domain/Profile.java | 110 +++ .../java/org/onap/portalsdk/core/domain/Role.java | 185 ++++ .../onap/portalsdk/core/domain/RoleFunction.java | 113 +++ .../onap/portalsdk/core/domain/UrlsAccessible.java | 95 ++ .../portalsdk/core/domain/UrlsAccessibleKey.java | 93 ++ .../java/org/onap/portalsdk/core/domain/User.java | 601 +++++++++++++ .../org/onap/portalsdk/core/domain/UserApp.java | 123 +++ .../org/onap/portalsdk/core/domain/UserAppId.java | 106 +++ .../portalsdk/core/domain/support/Attribute.java | 87 ++ .../core/domain/support/CollaborateList.java | 72 ++ .../portalsdk/core/domain/support/Container.java | 315 +++++++ .../onap/portalsdk/core/domain/support/Domain.java | 222 +++++ .../portalsdk/core/domain/support/DomainVo.java | 198 +++++ .../portalsdk/core/domain/support/Element.java | 154 ++++ .../core/domain/support/ElementDetails.java | 77 ++ .../core/domain/support/FusionCommand.java | 54 ++ .../onap/portalsdk/core/domain/support/Layout.java | 955 +++++++++++++++++++++ .../portalsdk/core/domain/support/NameValueId.java | 105 +++ .../portalsdk/core/domain/support/Position.java | 60 ++ .../onap/portalsdk/core/domain/support/Size.java | 60 ++ .../org/onap/portalsdk/core/domain/AppTest.java | 124 +++ .../onap/portalsdk/core/domain/AuditLogTest.java | 74 ++ .../core/domain/BroadcastMessageTest.java | 102 +++ .../org/onap/portalsdk/core/domain/FnMenuTest.java | 99 +++ .../onap/portalsdk/core/domain/LoginBeanTest.java | 84 ++ .../org/onap/portalsdk/core/domain/LookupTest.java | 77 ++ .../onap/portalsdk/core/domain/LuCountryTest.java | 78 ++ .../onap/portalsdk/core/domain/LuStateTest.java | 66 ++ .../onap/portalsdk/core/domain/LuTimeZoneTest.java | 69 ++ .../onap/portalsdk/core/domain/MenuDataTest.java | 73 ++ .../org/onap/portalsdk/core/domain/MenuTest.java | 85 ++ .../onap/portalsdk/core/domain/ProfileTest.java | 71 ++ .../portalsdk/core/domain/RoleFunctionTest.java | 70 ++ .../org/onap/portalsdk/core/domain/RoleTest.java | 113 +++ .../core/domain/UrlsAccessibleKeyTest.java | 79 ++ .../portalsdk/core/domain/UrlsAccessibleTest.java | 78 ++ .../onap/portalsdk/core/domain/UserAppIdTest.java | 91 ++ .../onap/portalsdk/core/domain/UserAppTest.java | 93 ++ .../org/onap/portalsdk/core/domain/UserTest.java | 220 +++++ .../core/domain/support/AttributeTest.java | 79 ++ .../core/domain/support/CollaborateListTest.java | 60 ++ .../core/domain/support/ContainerTest.java | 185 ++++ .../portalsdk/core/domain/support/DomainTest.java | 143 +++ .../core/domain/support/DomainVOTest.java | 107 +++ .../core/domain/support/ElementDetailsTest.java | 64 ++ .../portalsdk/core/domain/support/ElementTest.java | 77 ++ .../core/domain/support/FusionCommandTest.java | 65 ++ .../portalsdk/core/domain/support/LayoutTest.java | 336 ++++++++ .../core/domain/support/NameValueIdTest.java | 81 ++ .../core/domain/support/PositionTest.java | 68 ++ .../portalsdk/core/domain/support/SizeTest.java | 69 ++ ecomp-sdk/epsdk-fw/pom.xml | 18 +- ecomp-sdk/epsdk-music/pom.xml | 17 +- .../music/conf/MusicSessionRepositoryHandler.java | 1 + .../music/filter/MusicSessionRepositoryFilter.java | 70 ++ .../onap/portalapp/music/service/MusicService.java | 109 +++ .../onap/portalapp/music/util/MusicCleanUp.java | 62 ++ .../onap/portalapp/music/util/MusicProperties.java | 6 + .../org/onap/portalapp/music/util/MusicUtil.java | 40 + ecomp-sdk/epsdk-workflow/pom.xml | 2 +- .../portalsdk/workflow/models/WorkflowTest.java | 4 +- ecomp-sdk/pom.xml | 4 +- 214 files changed, 11414 insertions(+), 8905 deletions(-) create mode 100644 ecomp-sdk/epsdk-aaf/pom.xml create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPerms.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsDetail.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRole.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRolePerms.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUser.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetail.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAuthUserRole.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalRoleDescription.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/exception/UserNotFoundException.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthService.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiService.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthProperties.java create mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtils.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/FusionObject.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/App.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/AuditLog.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/BroadcastMessage.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/DomainVo.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/FnMenu.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/FusionVo.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/LoginBean.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/Lookup.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/LuCountry.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/LuState.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/LuTimeZone.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/Menu.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/MenuData.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/Profile.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/Role.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessible.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessibleKey.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/User.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/UserApp.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/UserAppId.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Attribute.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/CollaborateList.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Container.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/DomainVo.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Element.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/ElementDetails.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/FusionCommand.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/NameValueId.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Position.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Size.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AppTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java create mode 100644 ecomp-sdk/epsdk-domain/.gitignore create mode 100644 ecomp-sdk/epsdk-domain/pom.xml create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/App.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/AuditLog.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/BroadcastMessage.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/DomainVo.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/FnMenu.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/FusionObject.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/FusionVo.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LoginBean.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Lookup.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuCountry.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuState.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuTimeZone.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Menu.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/MenuData.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Profile.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Role.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessible.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessibleKey.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/User.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserApp.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserAppId.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Attribute.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/CollaborateList.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Container.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/DomainVo.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Element.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/ElementDetails.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/FusionCommand.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/NameValueId.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Position.java create mode 100644 ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Size.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AppTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/AttributeTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/CollaborateListTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ContainerTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementDetailsTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/FusionCommandTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/NameValueIdTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/PositionTest.java create mode 100644 ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/SizeTest.java create mode 100644 ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java create mode 100644 ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicCleanUp.java (limited to 'ecomp-sdk') diff --git a/ecomp-sdk/epsdk-aaf/pom.xml b/ecomp-sdk/epsdk-aaf/pom.xml new file mode 100644 index 00000000..cccfc833 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/pom.xml @@ -0,0 +1,165 @@ + + 4.0.0 + + + org.onap.portal.sdk + epsdk-project + 2.4.0-SNAPSHOT + + + org.onap.portal.sdk + epsdk-aaf + 2.4.0-SNAPSHOT + jar + + ONAP Portal SDK AAF Authorization + + + UTF-8 + 4.2.0.RELEASE + + + + + org.onap.portal.sdk + epsdk-fw + ${project.version} + + + commons-logging + commons-logging + + + + + + org.onap.portal.sdk + epsdk-core + ${project.version} + + + commons-logging + commons-logging + + + + + com.att.eelf + eelf-core + 1.0.0 + + + + org.springframework + spring-core + ${springframework.version} + + + commons-logging + commons-logging + + + + + org.springframework + spring-web + ${springframework.version} + + + org.springframework + spring-webmvc + ${springframework.version} + + + org.springframework + spring-context-support + ${springframework.version} + + + org.springframework + spring-test + ${springframework.version} + + + org.springframework + spring-aop + ${springframework.version} + + + org.springframework.boot + spring-boot-starter + 1.3.0.RELEASE + + + org.slf4j + log4j-over-slf4j + + + ch.qos.logback + logback-classic + + + + + + com.fasterxml.jackson.core + jackson-annotations + 2.6.3 + + + com.fasterxml.jackson.core + jackson-core + 2.6.3 + + + com.fasterxml.jackson.core + jackson-databind + 2.6.3 + + + junit + junit + 3.8.1 + test + + + + + + doclint-java8-disable + + [1.8,) + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + -Xdoclint:none + + + + + + + + + epsdk-aaf + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + + + + + diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPerms.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPerms.java new file mode 100644 index 00000000..80956e64 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPerms.java @@ -0,0 +1,178 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.domain; + +import java.io.Serializable; + +public class ExternalAccessPerms implements Serializable, Comparable { + + /** + * + */ + private static final long serialVersionUID = -200964838466882602L; + private String type; + private String instance; + private String action; + private String description; + + public ExternalAccessPerms() { + super(); + } + + public ExternalAccessPerms(String type, String instance, String action, String description) { + super(); + this.type = type; + this.instance = instance; + this.action = action; + this.description = description; + } + + public ExternalAccessPerms(String type, String instance, String action) { + super(); + this.type = type; + this.instance = instance; + this.action = action; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @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 + */ + public void setInstance(String instance) { + this.instance = instance; + } + + /** + * @return the action + */ + public String getAction() { + return action; + } + + /** + * @param action + * the action to set + */ + public void setAction(String action) { + this.action = action; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public int compareTo(Object obj) { + ExternalAccessPerms other = (ExternalAccessPerms) obj; + + String c1 = getInstance(); + String c2 = other.getInstance(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((action == null) ? 0 : action.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((instance == null) ? 0 : instance.hashCode()); + result = prime * result + ((type == null) ? 0 : type.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; + ExternalAccessPerms other = (ExternalAccessPerms) obj; + if (action == null) { + if (other.action != null) + return false; + } else if (!action.equals(other.action)) + return false; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (instance == null) { + if (other.instance != null) + return false; + } else if (!instance.equals(other.instance)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + return true; + } + +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsDetail.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsDetail.java new file mode 100644 index 00000000..fab7d2c0 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsDetail.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.domain; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonRootName(value="perm") +public class ExternalAccessPermsDetail { + + private String type; + private String instance; + private String action; + private List roles; + private String description; + + + + public ExternalAccessPermsDetail() { + super(); + } + + /** + * @param type + * @param instance + * @param action + * @param roles + * @param description + */ + public ExternalAccessPermsDetail(String type, String instance, String action, List roles, + String description) { + super(); + this.type = type; + this.instance = instance; + this.action = action; + this.roles = roles; + this.description = description; + } + + /** + * @param type + * @param instance + * @param action + * @param 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 getRoles() { + return roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRole.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRole.java new file mode 100644 index 00000000..a14a4b5f --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRole.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.domain; + +import java.io.Serializable; + +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; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRolePerms.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRolePerms.java new file mode 100644 index 00000000..f38b2f9f --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRolePerms.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.domain; + +public class ExternalAccessRolePerms { + + 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-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUser.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUser.java new file mode 100644 index 00000000..3ca88991 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUser.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.domain; + +public class ExternalAccessUser { + + private String user; + private String role; + + public ExternalAccessUser(String user, String role) { + super(); + this.user = user; + this.role = role; + } + + public String getUser() { + return user; + } + public void setUser(String user) { + this.user = user; + } + public String getRole() { + return role; + } + public void setRole(String role) { + this.role = role; + } + + +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetail.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetail.java new file mode 100644 index 00000000..5106f387 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetail.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.domain; + +public class ExternalAccessUserRoleDetail { + + private String name; + private ExternalRoleDescription description; + + + /** + * + */ + public ExternalAccessUserRoleDetail() { + super(); + } + + public ExternalAccessUserRoleDetail(String name, ExternalRoleDescription description) { + super(); + 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; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((description == null) ? 0 : description.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; + ExternalAccessUserRoleDetail other = (ExternalAccessUserRoleDetail) obj; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + 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-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAuthUserRole.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAuthUserRole.java new file mode 100644 index 00000000..33e21f2c --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAuthUserRole.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.domain; + +import java.io.Serializable; + +public class ExternalAuthUserRole implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 5066251837431287376L; + + private String role; + private String user; + private String expiryDate; + + 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-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalRoleDescription.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalRoleDescription.java new file mode 100644 index 00000000..d09db15d --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalRoleDescription.java @@ -0,0 +1,150 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.domain; + +import java.util.List; + +public class ExternalRoleDescription { + + private String id; + private String name; + private String active; + private String priority; + private String appId; + private String appRoleId; + private List permissions; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getActive() { + return active; + } + public void setActive(String active) { + this.active = active; + } + public String getPriority() { + return priority; + } + public void setPriority(String priority) { + this.priority = priority; + } + public String getAppId() { + return appId; + } + public void setAppId(String appId) { + this.appId = appId; + } + public String getAppRoleId() { + return appRoleId; + } + public void setAppRoleId(String appRoleId) { + this.appRoleId = appRoleId; + } + + public List getPermissions() { + return permissions; + } + public void setPermissions(List permissions) { + this.permissions = permissions; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((active == null) ? 0 : active.hashCode()); + result = prime * result + ((appId == null) ? 0 : appId.hashCode()); + result = prime * result + ((appRoleId == null) ? 0 : appRoleId.hashCode()); + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((priority == null) ? 0 : priority.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; + ExternalRoleDescription other = (ExternalRoleDescription) obj; + if (active == null) { + if (other.active != null) + return false; + } else if (!active.equals(other.active)) + return false; + if (appId == null) { + if (other.appId != null) + return false; + } else if (!appId.equals(other.appId)) + return false; + if (appRoleId == null) { + if (other.appRoleId != null) + return false; + } else if (!appRoleId.equals(other.appRoleId)) + return false; + 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; + if (priority == null) { + if (other.priority != null) + return false; + } else if (!priority.equals(other.priority)) + return false; + return true; + } + + +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/exception/UserNotFoundException.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/exception/UserNotFoundException.java new file mode 100644 index 00000000..8d15b44c --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/exception/UserNotFoundException.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.exception; + +public class UserNotFoundException extends Exception { + + private static final long serialVersionUID = 1616470595106815228L; + + public UserNotFoundException(String msg) { + super(msg); + } +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthService.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthService.java new file mode 100644 index 00000000..8f387f98 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthService.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.service; + +import java.io.IOException; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.onap.portalsdk.core.command.LoginBean; +import org.onap.portalsdk.core.domain.User; + +public interface LoginExternalAuthService { + + /** + * validate user exists in the system + * @param bean + * @param menuPropertiesFilename + * @param additionalParams + * @return returns login user bean + * @throws IOException + */ + @SuppressWarnings("rawtypes") + LoginBean findUser(LoginBean bean, String menuPropertiesFilename, Map additionalParams, HttpServletRequest request) throws Exception; + + /** + * + * @param bean + * @param menuPropertiesFilename + * @param additionalParams + * @param matchPassword + * @return returns login user bean + * @throws IOException + */ + @SuppressWarnings("rawtypes") + LoginBean findUser(LoginBean bean, String menuPropertiesFilename, Map additionalParams, boolean matchPassword, HttpServletRequest request) + throws Exception; + + /** + * + * @param orgUserId + * @return + */ + User findUserWithoutPwd(String orgUserId); +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java new file mode 100644 index 00000000..d2ccfc2e --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java @@ -0,0 +1,252 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.service; + +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + +import org.onap.portalsdk.core.command.LoginBean; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.User; +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.LoginServiceCentralizedImpl; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.portalsdk.core.web.support.AppUtils; +import org.onap.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service("loginExternalAuthService") +public class LoginExternalAuthServiceImpl implements LoginExternalAuthService { + + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LoginServiceCentralizedImpl.class); + + @Autowired + private DataAccessService dataAccessService; + + @Autowired + private UserApiService userApiService; + + @Override + public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, + @SuppressWarnings("rawtypes") Map additionalParams, HttpServletRequest request) throws Exception { + return findUser(bean, menuPropertiesFilename, additionalParams, true, request); + } + + @Override + @SuppressWarnings("rawtypes") + public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, Map additionalParams, + boolean matchPassword, HttpServletRequest request) throws Exception { + + User user; + if (bean.getUserid() != null) { + user = findUser(bean, request); + } else { + if (matchPassword) + user = findUser(bean.getLoginId(), bean.getLoginPwd()); + else + user = findUserWithoutPwd(bean.getLoginId()); + } + + if (user != null) { + if (AppUtils.isApplicationLocked() + && !UserUtils.hasRole(user, SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID))) { + bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_APPLICATION_LOCKED); + } + + // raise an error if the user is inactive + if (!user.getActive()) { + bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE); + } + + if (!userHasActiveRoles(user)) { + bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE); + } + // only login the user if no errors have occurred + if (bean.getLoginErrorMessage() == null) { + + // this will be a snapshot of the user's information as + // retrieved from the database + User userCopy = null; + try { + userCopy = (User) user.clone(); + } catch (CloneNotSupportedException ex) { + // Never happens + logger.error(EELFLoggerDelegate.errorLogger, "findUser failed", ex); + } + + User appuser = findUserWithoutPwd(user.getLoginId()); + + if (appuser == null && userHasRoleFunctions(user)) { + createUserIfNecessary(user); + } else { + appuser.setLastLoginDate(new Date()); + + // update the last logged in date for the user + dataAccessService.saveDomainObject(appuser, additionalParams); + } + // update the audit log of the user + // Check for the client device type and set log attributes + // appropriately + + // save the above changes to the User and their audit trail + + // create the application menu based on the user's privileges + + Set appMenu = getMenuBuilder().getMenu( + SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME), dataAccessService); + bean.setMenu(appMenu != null ? appMenu : new HashSet()); + Set businessDirectMenu = getMenuBuilder().getMenu( + SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_SET_NAME), + dataAccessService); + bean.setBusinessDirectMenu(businessDirectMenu != null ? businessDirectMenu : new HashSet()); + + bean.setUser(userCopy); + } + } + + return bean; + } + + private void createUserIfNecessary(User user) { + logger.debug(EELFLoggerDelegate.debugLogger, "createUser: " + user.getOrgUserId()); + User user1 = new User(); + user1.setEmail(user.getEmail()); + user1.setEmail(user.getEmail()); + user1.setFirstName(user.getFirstName()); + user1.setHrid(user.getHrid()); + user1.setJobTitle(user.getJobTitle()); + user1.setLastName(user.getLastName()); + user1.setLoginId(user.getLoginId()); + user1.setOrgManagerUserId(user.getOrgManagerUserId()); + user1.setMiddleInitial(user.getMiddleInitial()); + user1.setOrgCode(user.getOrgCode()); + user1.setOrgId(user.getOrgId()); + user1.setPhone(user.getPhone()); + user1.setOrgUserId(user.getOrgUserId()); + user1.setActive(user.getActive()); + user1.setLastLoginDate(new Date()); + + try { + dataAccessService.saveDomainObject(user1, null); + logger.debug(EELFLoggerDelegate.debugLogger, "createdUser Successfully: " + user.getOrgUserId()); + } catch (Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "createUserIfNecessary failed", ex); + } + + } + + private boolean userHasActiveRoles(User user) { + boolean hasActiveRole = false; + @SuppressWarnings("rawtypes") + Iterator roles = user.getRoles().iterator(); + while (roles.hasNext()) { + Role role = (Role) roles.next(); + if (role.getActive()) { + hasActiveRole = true; + break; + } + } + return hasActiveRole; + } + + private boolean userHasRoleFunctions(User user) { + boolean hasRoleFunctions = false; + @SuppressWarnings("rawtypes") + Iterator roles = user.getRoles().iterator(); + while (roles.hasNext()) { + Role role = (Role) roles.next(); + if (role.getActive() && role.getRoleFunctions() != null && !role.getRoleFunctions().isEmpty()) { + hasRoleFunctions = true; + break; + } + } + return hasRoleFunctions; + } + + private User findUser(LoginBean bean, HttpServletRequest request) throws Exception { + User user = userApiService.getUser(bean.getUserid(), request); + user.setId(getUserIdByOrgUserId(user.getOrgUserId())); + user.setLoginId(bean.getUserid()); + logger.debug(EELFLoggerDelegate.debugLogger, "findUser: Returning final user roles and permissions", user.toString()); + return user; + } + + private Long getUserIdByOrgUserId(String orgUserId) { + Map params = new HashMap<>(); + params.put("orgUserId", orgUserId); + @SuppressWarnings("rawtypes") + List list = dataAccessService.executeNamedQuery("getUserIdByorgUserId", params, null); + Long userId = null; + if (list != null && !list.isEmpty()) + userId = (Long) list.get(0); + return userId; + } + + @SuppressWarnings("rawtypes") + private User findUser(String loginId, String password) { + Map params = new HashMap<>(); + params.put("login_id", loginId); + params.put("login_pwd", password); + List list = dataAccessService.executeNamedQuery("getUserByLoginIdLoginPwd", params, new HashMap()); + return (list == null || list.isEmpty()) ? null : (User) list.get(0); + } + + @SuppressWarnings("rawtypes") + @Override + public User findUserWithoutPwd(String loginId) { + Map params = new HashMap<>(); + params.put("org_user_id", loginId); + List list = dataAccessService.executeNamedQuery("getUserByOrgUserId", params, new HashMap()); + return (list == null || list.isEmpty()) ? null : (User) list.get(0); + } + + private MenuBuilder getMenuBuilder() { + return new MenuBuilder(); + } + +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiService.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiService.java new file mode 100644 index 00000000..6eb312b6 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiService.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.service; + +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.external.authorization.exception.UserNotFoundException; + +public interface UserApiService { + + /** + * Gets list of all roles associated to user from external system + * + * @param orgUserId + * @return + * @throws Exception + */ + User getUser(String orgUserId, HttpServletRequest request) throws UserNotFoundException; + + /** + * + * @param OrgUserId + * @return + */ + List getRoleFunctions(String orgUserId) throws Exception; + +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java new file mode 100644 index 00000000..8425f7da --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java @@ -0,0 +1,319 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import javax.naming.NamingException; +import javax.servlet.http.HttpServletRequest; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.portalsdk.core.command.PostSearchBean; +import org.onap.portalsdk.core.command.support.SearchResult; +import org.onap.portalsdk.core.domain.App; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.RoleFunction; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.UserApp; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.service.AppService; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.service.LdapService; +import org.onap.portalsdk.core.service.PostSearchService; +import org.onap.portalsdk.external.authorization.domain.ExternalAccessPerms; +import org.onap.portalsdk.external.authorization.domain.ExternalAccessUserRoleDetail; +import org.onap.portalsdk.external.authorization.domain.ExternalRoleDescription; +import org.onap.portalsdk.external.authorization.exception.UserNotFoundException; +import org.onap.portalsdk.external.authorization.util.EcompExternalAuthProperties; +import org.onap.portalsdk.external.authorization.util.EcompExternalAuthUtils; +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.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; + +@Service("userApiService") +public class UserApiServiceImpl implements UserApiService { + + private static final String AAF_GET_USER_ROLES_ENDPOINT = "roles/user/"; + + private static final String AAF_GET_USER_PERMS_ENDPOINT = "perms/user/"; + + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserApiServiceImpl.class); + + @Autowired + private LoginExternalAuthService loginAAFService; + + @Autowired + private LdapService ldapService; + + @Autowired + private PostSearchService postSearchService; + + @Autowired + private DataAccessService dataAccessService; + + RestTemplate template = new RestTemplate(); + + @Autowired + private AppService appService; + + @Override + public User getUser(String orgUserId, HttpServletRequest request) + throws UserNotFoundException { + User user = null; + try { + String namespace = EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_NAMESPACE); + HttpHeaders headers = EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity entity = new HttpEntity<>(headers); + logger.debug(EELFLoggerDelegate.debugLogger, "getUserRoles: Connecting to external system for user {}", + orgUserId); + String endPoint = AAF_GET_USER_ROLES_ENDPOINT + orgUserId + + EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_USER_DOMAIN); + ResponseEntity getResponse = template.exchange( + EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_URL) + endPoint, HttpMethod.GET, entity, + String.class); + if (getResponse.getStatusCode().value() == 200) { + logger.debug(EELFLoggerDelegate.debugLogger, + "getUserRoles: Finished GET unp ser roles from external system and body: {}", + getResponse.getBody()); + } + String userRoles = getResponse.getBody(); + JSONObject userJsonObj = null; + JSONArray userJsonArray = null; + ObjectMapper mapper = new ObjectMapper(); + List userRoleDetailList = new ArrayList<>(); + if (!userRoles.equals(EcompExternalAuthUtils.EXT_EMPTY_JSON_STRING)) { + userJsonObj = new JSONObject(userRoles); + userJsonArray = userJsonObj.getJSONArray(EcompExternalAuthUtils.EXT_ROLE_FIELD); + ExternalAccessUserRoleDetail userRoleDetail = null; + for (int i = 0; i < userJsonArray.length(); i++) { + JSONObject role = userJsonArray.getJSONObject(i); + if (!role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME).endsWith(EcompExternalAuthUtils.EXT_ROLE_FIELD_ADMIN) + && !role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME) + .endsWith(EcompExternalAuthUtils.EXT_ROLE_FIELD_OWNER) + && EcompExternalAuthUtils.checkNameSpaceMatching(role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME), + namespace)) { + ExternalRoleDescription desc = new ExternalRoleDescription(); + if(role.has(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION) + && EcompExternalAuthUtils + .isJSONValid(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION))) { + desc = mapper.readValue(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION), + ExternalRoleDescription.class); + } + if(role.has(EcompExternalAuthUtils.EXT_FIELD_PERMS)) { + JSONArray perms = role.getJSONArray(EcompExternalAuthUtils.EXT_FIELD_PERMS); + List permsList = mapper.readValue(perms.toString(), TypeFactory + .defaultInstance().constructCollectionType(List.class, ExternalAccessPerms.class)); + desc.setPermissions(permsList); + } + userRoleDetail = new ExternalAccessUserRoleDetail( + role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME), desc); + userRoleDetailList.add(userRoleDetail); + } + } + } else { + throw new UserNotFoundException("User roles not found!"); + } + + if (userRoleDetailList.isEmpty()) { + throw new UserNotFoundException("User roles not found!"); + } else { + user = convertAAFUserRolesToEcompSDKUser(userRoleDetailList, orgUserId, namespace, request); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getUser: Failed! ", e); + } + return user; + + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private User convertAAFUserRolesToEcompSDKUser(List userRoleDetailList, + String orgUserId, String namespace, HttpServletRequest request) + throws Exception { + User user = loginAAFService.findUserWithoutPwd(orgUserId); + PostSearchBean postSearchBean = new PostSearchBean(); + if (user == null) { + postSearchBean.setOrgUserId(orgUserId); + postSearchService.process(request, postSearchBean); + postSearchBean.setSearchResult(loadSearchResultData(postSearchBean)); + user = (User) postSearchBean.getSearchResult().get(0); + user.setActive(true); + user.setLoginId(orgUserId); + dataAccessService.saveDomainObject(user, null); + } + App app = appService.getApp(1l); + try { + Set userApps = new TreeSet(); + for (ExternalAccessUserRoleDetail userRoleDetail : userRoleDetailList) { + ExternalRoleDescription roleDesc = userRoleDetail.getDescription(); + UserApp userApp = new UserApp(); + Role role = new Role(); + Set roleFunctions = new TreeSet<>(); + if (roleDesc != null) { + if (roleDesc.getName() == null) { + role.setActive(true); + role.setName(userRoleDetail.getName().substring(namespace.length() + 1)); + } else { + role.setActive(Boolean.valueOf(roleDesc.getActive())); + role.setId(Long.valueOf(roleDesc.getAppRoleId())); + role.setName(roleDesc.getName()); + if (!roleDesc.getPriority().equals(EcompExternalAuthUtils.EXT_NULL_VALUE)) { + role.setPriority(Integer.valueOf(roleDesc.getPriority())); + } + } + for (ExternalAccessPerms extPerm : roleDesc.getPermissions()) { + RoleFunction roleFunction = new RoleFunction(); + roleFunction.setCode(extPerm.getInstance()); + roleFunction.setAction(extPerm.getAction()); + if (extPerm.getDescription() != null + && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setName(extPerm.getDescription()); + } else if (extPerm.getDescription() == null + && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setName(extPerm.getType().substring(namespace.length() + 1) + "|" + + extPerm.getInstance() + "|" + extPerm.getAction()); + } else if (extPerm.getDescription() == null + && !EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setName( + extPerm.getType() + "|" + extPerm.getInstance() + "|" + extPerm.getAction()); + } + if (EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setType(extPerm.getType().substring(namespace.length() + 1)); + } else { + roleFunction.setType(extPerm.getType()); + } + roleFunctions.add(roleFunction); + } + } + role.setRoleFunctions(roleFunctions); + userApp.setApp(app); + userApp.setRole(role); + userApp.setUserId(user.getId()); + userApps.add(userApp); + } + user.setUserApps(userApps); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "createEPUser: createEPUser failed", e); + throw e; + } + + return user; + } + + @Override + public List getRoleFunctions(String orgUserId) throws Exception { + ObjectMapper mapper = new ObjectMapper(); + HttpHeaders headers = EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth(); + HttpEntity entity = new HttpEntity<>(headers); + logger.debug(EELFLoggerDelegate.debugLogger, "getRoleFunctions: Connecting to external system for user {}", + orgUserId); + String endPoint = AAF_GET_USER_PERMS_ENDPOINT + orgUserId + + EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_USER_DOMAIN); + ResponseEntity getResponse = template.exchange( + EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_URL) + endPoint, HttpMethod.GET, entity, + String.class); + if (getResponse.getStatusCode().value() == 200) { + logger.debug(EELFLoggerDelegate.debugLogger, + "getRoleFunctions: Finished GET user perms from external system and body: {}", + getResponse.getBody()); + } + String userPerms = getResponse.getBody(); + JSONObject userPermsJsonObj = null; + JSONArray userPermsJsonArray = null; + List extPermsList = new ArrayList<>(); + if (!userPerms.equals(EcompExternalAuthUtils.EXT_EMPTY_JSON_STRING)) { + userPermsJsonObj = new JSONObject(userPerms); + userPermsJsonArray = userPermsJsonObj.getJSONArray(EcompExternalAuthUtils.EXT_PERM_FIELD); + for (int i = 0; i < userPermsJsonArray.length(); i++) { + JSONObject permJsonObj = userPermsJsonArray.getJSONObject(i); + if (!permJsonObj.getString(EcompExternalAuthUtils.EXT_PERM_FIELD_TYPE).endsWith(EcompExternalAuthUtils.EXT_PERM_ACCESS)) { + ExternalAccessPerms perm = mapper.readValue(permJsonObj.toString(), ExternalAccessPerms.class); + extPermsList.add(perm); + } + } + } + return convertToRoleFunctionList(extPermsList); + } + + private List convertToRoleFunctionList(List extPermsList) { + List roleFunctions = new ArrayList<>(); + String namespace = EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_NAMESPACE); + for (ExternalAccessPerms extPerm : extPermsList) { + RoleFunction roleFunction = new RoleFunction(); + roleFunction.setCode(extPerm.getInstance()); + roleFunction.setAction(extPerm.getAction()); + if (extPerm.getDescription() != null + && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setName(extPerm.getDescription()); + } else if (extPerm.getDescription() == null + && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setName(extPerm.getType().substring(namespace.length() + 1) + "|" + extPerm.getInstance() + + "|" + extPerm.getAction()); + } else if (extPerm.getDescription() == null + && !EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setName(extPerm.getType() + "|" + extPerm.getInstance() + "|" + extPerm.getAction()); + } + if (EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) { + roleFunction.setType(extPerm.getType().substring(namespace.length() + 1)); + } else { + roleFunction.setType(extPerm.getType()); + } + roleFunctions.add(roleFunction); + } + return roleFunctions; + } + + private SearchResult loadSearchResultData(PostSearchBean searchCriteria) + throws NamingException { + return ldapService.searchPost(searchCriteria.getUser(), searchCriteria.getSortBy1(), + searchCriteria.getSortBy2(), searchCriteria.getSortBy3(), searchCriteria.getPageNo(), + searchCriteria.getNewDataSize(), 1); + } + +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthProperties.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthProperties.java new file mode 100644 index 00000000..a680a672 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthProperties.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.util; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; + + +public class EcompExternalAuthProperties { + + public static final String EXTERNAL_AUTH_USER_NAME = "extern_auth_user_name"; + + public static final String EXTERNAL_AUTH_PASSWORD = "extern_auth_password"; + + public static final String EXTERNAL_AUTH_URL = "extern_auth_url"; + + public static final String EXTERNAL_AUTH_USER_DOMAIN = "extern_auth_user_domain"; + + public static final String EXTERNAL_AUTH_NAMESPACE = "extern_auth_namespace"; + + private EcompExternalAuthProperties(){} + + private static Properties properties; + + private static String propertyFileName = "external-auth.properties"; + + private static final Object lockObject = new Object(); + + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EcompExternalAuthProperties.class); + + /** + * Gets the property value for the specified key. If a value is found, leading + * and trailing space is trimmed. + * + * @param property + * Property key + * @return Value for the named property; null if the property file was not + * loaded or the key was not found. + */ + public static String getProperty(String property) { + if (properties == null) { + synchronized (lockObject) { + try { + if (!initialize()) { + logger.error(EELFLoggerDelegate.errorLogger,"Failed to read property file " + propertyFileName); + return null; + } + } catch (IOException e) { + logger.error(EELFLoggerDelegate.errorLogger,"Failed to read property file " + propertyFileName ,e); + return null; + } + } + } + String value = properties.getProperty(property); + if (value != null) + value = value.trim(); + return value; + } + + /** + * Reads properties from a portal.properties file on the classpath. + * + * Clients do NOT need to call this method. Clients MAY call this method to test + * whether the properties file can be loaded successfully. + * + * @return True if properties were successfully loaded, else false. + * @throws IOException + * On failure + */ + private static boolean initialize() throws IOException { + if (properties != null) + return true; + InputStream in = EcompExternalAuthProperties.class.getClassLoader().getResourceAsStream(propertyFileName); + if (in == null) + return false; + properties = new Properties(); + try { + properties.load(in); + } finally { + in.close(); + } + return true; + } + +} diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtils.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtils.java new file mode 100644 index 00000000..56b1527e --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtils.java @@ -0,0 +1,139 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2017 AT&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.portalsdk.external.authorization.util; + +import java.io.IOException; + +import javax.xml.bind.DatatypeConverter; + +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.http.HttpHeaders; +import org.springframework.http.MediaType; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class EcompExternalAuthUtils { + + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EcompExternalAuthUtils.class); + + @Autowired + CipherUtil cipherUtil; + + public static final String EXT_EMPTY_JSON_STRING = "{}"; + public static final String EXT_ROLE_FIELD = "role"; + public static final String EXT_PERM_FIELD = "perm"; + public static final String EXT_PERM_FIELD_TYPE = "type"; + public static final String EXT_PERM_ACCESS = ".access"; + public static final String EXT_ROLE_FIELD_NAME = "name"; + public static final String EXT_NULL_VALUE = "null"; + public static final String EXT_FIELD_DESCRIPTION = "description"; + public static final String EXT_FIELD_PERMS = "perms"; + public static final String EXT_ROLE_FIELD_OWNER = ".owner"; + public static final String EXT_ROLE_FIELD_ADMIN = ".admin"; + + public static HttpHeaders base64encodeKeyForAAFBasicAuth() throws Exception { + String userName = EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_USER_NAME); + String encryptedPass = EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_PASSWORD); + String decryptedPass = decryptPass(encryptedPass); + String usernamePass = userName + ":" + decryptedPass; + String encToBase64 = String.valueOf((DatatypeConverter.printBase64Binary(usernamePass.getBytes()))); + HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", "Basic " + encToBase64); + headers.setContentType(MediaType.APPLICATION_JSON); + return headers; + } + + private static String decryptPass(String encrypted) throws Exception { + String result = ""; + if (encrypted != null && encrypted.length() > 0) { + try { + result = CipherUtil.decryptPKC(encrypted, + SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger,"decryptedPassword failed", e); + throw e; + } + } + return result; + } + + /** + * + * It checks whether the namespace is matching or not + * + * @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; + if (appNamespace.length <= typeNamespace.length) { + for (int k = 0; k < appNamespace.length; k++) { + if (!appNamespace[k].equals(typeNamespace[k])) + isNamespaceMatching = false; + } + + } else { + isNamespaceMatching = false; + } + return isNamespaceMatching; + } + + /** + * + * 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-sdk/epsdk-analytics/pom.xml b/ecomp-sdk/epsdk-analytics/pom.xml index 2b79d543..bcf202d5 100644 --- a/ecomp-sdk/epsdk-analytics/pom.xml +++ b/ecomp-sdk/epsdk-analytics/pom.xml @@ -5,7 +5,7 @@ org.onap.portal.sdk epsdk-project - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/DateUtils.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/DateUtils.java index 1d62a94a..c0f25892 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/DateUtils.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/DateUtils.java @@ -45,7 +45,7 @@ import java.util.Date; import java.util.List; import java.util.TimeZone; -import org.onap.portalsdk.core.FusionObject; +import org.onap.portalsdk.core.domain.FusionObject; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.service.DataAccessService; import org.onap.portalsdk.core.util.SystemProperties; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java index d339a2a0..fac2d483 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java @@ -42,8 +42,7 @@ import java.util.Map; import javax.servlet.ServletContext; -import org.onap.portalsdk.analytics.model.runtime.FormField; -import org.onap.portalsdk.core.FusionObject; +import org.onap.portalsdk.core.domain.FusionObject; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/WizardProcessorTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/WizardProcessorTest.java index a704d9a0..52e0b1a1 100644 --- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/WizardProcessorTest.java +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/WizardProcessorTest.java @@ -39,15 +39,16 @@ package org.onap.portalsdk.analytics.controller; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; + import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.util.ArrayList; import java.util.List; + import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.onap.portalsdk.analytics.system.fusion.AppUtils; import org.junit.Before; import org.junit.Test; @@ -64,6 +65,7 @@ import org.onap.portalsdk.analytics.model.runtime.ReportRuntime; import org.onap.portalsdk.analytics.system.DbUtils; import org.onap.portalsdk.analytics.system.Globals; import org.onap.portalsdk.analytics.system.IAppUtils; +import org.onap.portalsdk.analytics.system.fusion.AppUtils; import org.onap.portalsdk.analytics.util.AppConstants; import org.onap.portalsdk.analytics.util.DataSet; import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions; diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java index fe5d4a45..07e1745b 100644 --- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java @@ -54,7 +54,6 @@ 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; @@ -74,9 +73,6 @@ import org.onap.portalsdk.analytics.model.base.ReportWrapper; import org.onap.portalsdk.analytics.model.definition.ReportDefinition; import org.onap.portalsdk.analytics.model.definition.wizard.ColumnJSON; import org.onap.portalsdk.analytics.model.definition.wizard.DefinitionJSON; -import org.onap.portalsdk.analytics.model.definition.wizard.ImportJSON; -import org.onap.portalsdk.analytics.model.definition.wizard.MessageJSON; -import org.onap.portalsdk.analytics.model.definition.wizard.QueryJSON; import org.onap.portalsdk.analytics.system.AppUtils; import org.onap.portalsdk.analytics.system.ConnectionUtils; import org.onap.portalsdk.analytics.system.DbUtils; @@ -87,12 +83,9 @@ import org.onap.portalsdk.analytics.util.DataSet; import org.onap.portalsdk.analytics.util.Utils; import org.onap.portalsdk.analytics.util.XSSFilter; import org.onap.portalsdk.analytics.view.ReportData; -import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions; import org.onap.portalsdk.analytics.xmlobj.CustomReportType; -import org.onap.portalsdk.analytics.xmlobj.DataColumnList; import org.onap.portalsdk.analytics.xmlobj.DataColumnType; import org.onap.portalsdk.analytics.xmlobj.DataSourceList; -import org.onap.portalsdk.analytics.xmlobj.DataSourceType; import org.onap.portalsdk.analytics.xmlobj.FormFieldList; import org.onap.portalsdk.analytics.xmlobj.FormFieldType; import org.onap.portalsdk.analytics.xmlobj.MockRunTimeReport; @@ -102,7 +95,6 @@ import org.onap.portalsdk.core.service.DataAccessService; import org.onap.portalsdk.core.util.SecurityCodecUtil; import org.onap.portalsdk.core.web.support.UserUtils; import org.owasp.esapi.ESAPI; -import org.owasp.esapi.Encoder; import org.owasp.esapi.codecs.Codec; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartJSONHelperTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartJSONHelperTest.java index 4938d777..f69c5dae 100644 --- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartJSONHelperTest.java +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartJSONHelperTest.java @@ -37,33 +37,30 @@ */ package org.onap.portalsdk.analytics.xmlobj; -import static org.junit.Assert.*; -import javax.xml.namespace.QName; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; -import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; import java.io.StringReader; -import java.io.Writer; -import java.sql.Clob; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; -import org.hibernate.Session; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -76,15 +73,12 @@ import org.onap.portalsdk.analytics.error.RaptorException; import org.onap.portalsdk.analytics.model.ReportLoader; import org.onap.portalsdk.analytics.model.base.ReportWrapper; import org.onap.portalsdk.analytics.model.runtime.ChartJSONHelper; -import org.onap.portalsdk.analytics.model.runtime.FormField; -import org.onap.portalsdk.analytics.model.runtime.ReportFormFields; import org.onap.portalsdk.analytics.model.runtime.ReportRuntime; import org.onap.portalsdk.analytics.system.AppUtils; import org.onap.portalsdk.analytics.system.DbUtils; import org.onap.portalsdk.analytics.system.Globals; import org.onap.portalsdk.analytics.util.AppConstants; import org.onap.portalsdk.analytics.util.DataSet; -import org.onap.portalsdk.analytics.xmlobj.CustomReportType; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.restful.domain.EcompRole; import org.onap.portalsdk.core.web.support.UserUtils; diff --git a/ecomp-sdk/epsdk-app-common/pom.xml b/ecomp-sdk/epsdk-app-common/pom.xml index f31aa797..2d38b6a5 100644 --- a/ecomp-sdk/epsdk-app-common/pom.xml +++ b/ecomp-sdk/epsdk-app-common/pom.xml @@ -5,7 +5,7 @@ org.onap.portal.sdk epsdk-project - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT @@ -251,13 +251,13 @@ commons-httpclient commons-httpclient - - xerces - xercesImpl - - - commons-collections - commons-collections + + xerces + xercesImpl + + + commons-collections + commons-collections org.beanshell @@ -277,11 +277,6 @@ xstream 1.4.10 - - org.apache.wicket - wicket-core - 1.5.16 - ch.qos.logback logback-core @@ -302,7 +297,6 @@ commons-beanutils 1.9.3 - org.apache.httpcomponents httpclient @@ -314,15 +308,14 @@ 2.7.2 - - xerces - xercesImpl - 2.11.0.SP5 - - - commons-collections - commons-collections - 3.2.2 + xerces + xercesImpl + 2.11.0.SP5 + + + commons-collections + commons-collections + 3.2.2 diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java index d73759a5..fbb9cc5d 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java @@ -49,7 +49,6 @@ import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.domain.App; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.logging.aspect.AuditLog; -import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.rest.FavoritesClient; import org.onap.portalsdk.core.onboarding.util.CipherUtil; diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FuncMenuController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FuncMenuController.java index 1cf68547..fa88c5c9 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FuncMenuController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FuncMenuController.java @@ -50,7 +50,6 @@ import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.domain.App; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.logging.aspect.AuditLog; -import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.rest.FunctionalMenuClient; import org.onap.portalsdk.core.onboarding.ueb.UebException; diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java index 1dd84208..bbd08c45 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java @@ -41,6 +41,7 @@ import javax.servlet.http.HttpServletRequest; import org.onap.portalsdk.core.controller.UnRestrictedBaseController; import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.logging.aspect.MetricsLog; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; @@ -51,7 +52,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.servlet.ModelAndView; -import org.onap.portalsdk.core.logging.aspect.MetricsLog; @Controller @RequestMapping("/") diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java index 03ec7b72..ec300780 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java @@ -45,7 +45,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONObject; -import org.onap.portalapp.util.SecurityXssValidator; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.domain.BroadcastMessage; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java index d766015a..46306817 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java @@ -37,7 +37,6 @@ */ package org.onap.portalapp.service; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -67,7 +66,6 @@ import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; import org.onap.portalsdk.core.restful.domain.EcompRole; import org.onap.portalsdk.core.restful.domain.EcompUser; import org.onap.portalsdk.core.service.AppService; -import org.onap.portalsdk.core.service.AppServiceImpl; import org.onap.portalsdk.core.service.RestApiRequestBuilder; import org.onap.portalsdk.core.service.RoleService; import org.onap.portalsdk.core.service.UserProfileService; diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/AngularAdminControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/AngularAdminControllerTest.java index e4facb1e..6568f93e 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/AngularAdminControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/AngularAdminControllerTest.java @@ -37,10 +37,8 @@ */ package org.onap.portalapp.controller.core; -import static org.junit.Assert.*; - -import java.util.HashMap; -import java.util.Map; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -50,7 +48,6 @@ import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.onap.portalapp.controller.core.AngularAdminController; import org.onap.portalapp.framework.MockitoTestSuite; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.web.support.UserUtils; diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FnMenuControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FnMenuControllerTest.java index 348263e5..96286dde 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FnMenuControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FnMenuControllerTest.java @@ -76,7 +76,6 @@ 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.mock.web.MockHttpServletRequest; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java index daee544f..2d6c0cd1 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java @@ -38,7 +38,6 @@ package org.onap.portalapp.controller.core; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import java.io.IOException; import java.io.PrintWriter; diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java index fabcd162..c9bdc896 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java @@ -37,7 +37,7 @@ */ package org.onap.portalapp.controller.core; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.IOException; import java.io.PrintWriter; @@ -48,7 +48,6 @@ import java.util.List; 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; diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleControllerTest.java index 1df1513a..9dee09fe 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleControllerTest.java @@ -37,7 +37,8 @@ */ package org.onap.portalapp.controller.core; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import java.io.BufferedReader; import java.io.IOException; diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleFunctionListControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleFunctionListControllerTest.java index 016f9bef..ffbb283d 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleFunctionListControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleFunctionListControllerTest.java @@ -37,7 +37,8 @@ */ package org.onap.portalapp.controller.core; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import java.io.IOException; import java.io.PrintWriter; diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleListControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleListControllerTest.java index 19d6da1a..593a9e7c 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleListControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleListControllerTest.java @@ -38,7 +38,8 @@ package org.onap.portalapp.controller.core; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import java.io.BufferedReader; import java.io.IOException; @@ -64,7 +65,6 @@ import org.onap.portalsdk.core.service.RoleService; import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.servlet.ModelAndView; -import org.onap.portalapp.controller.core.RoleListController; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UserProfileControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UserProfileControllerTest.java index 4046c6a7..00536e77 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UserProfileControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UserProfileControllerTest.java @@ -37,7 +37,7 @@ */ package org.onap.portalapp.controller.core; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.IOException; import java.util.ArrayList; diff --git a/ecomp-sdk/epsdk-app-os/README.md b/ecomp-sdk/epsdk-app-os/README.md index 6a94530e..c61ebe63 100644 --- a/ecomp-sdk/epsdk-app-os/README.md +++ b/ecomp-sdk/epsdk-app-os/README.md @@ -12,12 +12,15 @@ like Apache Tomcat. Eclipse users must install the M2E-WTP connector, see https://www.eclipse.org/m2e-wtp/ ## Release Notes +Version 2.3.0 +- PORTAL 254 ECOMP AAF jar + Version 2.2.0 - PORTAL 136 Junits for SDK - PORTAL 87 hibernate mapping in epsdk-overlay forces use of analytics dependency jar - PORTAL 155 Review security issues: portal -- PORTAL 202 Remove files that have GPL or other license issues -- PORTAL 210 Music library update +- PORTAL-202 Remove files that have GPL or other license issues + Version 2.1.0 - PORTAL 161 Refer epsdk-app-common - PORTAL 160 Refer epsdk-app-common diff --git a/ecomp-sdk/epsdk-app-os/pom.xml b/ecomp-sdk/epsdk-app-os/pom.xml index 2daad9a9..733a1798 100644 --- a/ecomp-sdk/epsdk-app-os/pom.xml +++ b/ecomp-sdk/epsdk-app-os/pom.xml @@ -10,7 +10,7 @@ org.onap.portal.sdk epsdk-project - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT diff --git a/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties b/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties index 635ccb50..fdf6e499 100644 --- a/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties +++ b/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties @@ -1,24 +1,30 @@ -music.endpoint = http://vm-ep-dev4.research.att.com/MUSIC/rest/ -music.version = v2 -music.keyspace = keyspaces music.session.keyspace = test_session music.session.attr.tables = spring_session_attributes music.session.meta.tables = spring_session -music.x.minor.version = 3 -music.x.patch.version = 0 -music.ns = com.att.ecomp.portal.demeter -music.user.id = m00468@portal.ecomp.att.com -music.password = friedG33nS- -music.consistency.info = type -music.consistency.info.value = eventual -music.cache = false +#music.cache = false music.serialize.compress = true music.session.max.inactive.interval.seconds = 1800 +music.exclude.api = /portalApi/healthCheck,/portalApi/healthCheckSuspend,/portalApi/healthCheckResume #By default it's eventual music.atomic.get = false music.atomic.put = false - +#how often the session clean up would happen (hour) +music.cleanup.frequency = 6 +#how old of session need to be cleaned up (hour) +music.cleanup.threshold = 10 cassandra.host=135.197.226.103 zookeeper.host=135.197.226.103, 135.197.226.108, 135.197.226.119 cassandra.user=cassandra -cassandra.password=cassandra \ No newline at end of file +cassandra.password=cassandra + +#Music API +#music.endpoint = http://vm-ep-dev4.research.att.com/MUSIC/rest/ +#music.version = v2 +#music.keyspace = keyspaces +#music.x.minor.version = 3 +#music.x.patch.version = 0 +#music.ns = com.att.ecomp.portal.demeter +#music.user.id = m00468@portal.ecomp.att.com +#music.password = friedG33nS- +#music.consistency.info = type +#music.consistency.info.value = eventual \ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/web.xml b/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/web.xml index b5963e64..8392e8d4 100644 --- a/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/web.xml +++ b/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/web.xml @@ -23,7 +23,7 @@ springSessionRepositoryFilter - org.springframework.web.filter.DelegatingFilterProxy + org.onap.portalapp.music.filter.MusicSessionRepositoryFilter springSessionRepositoryFilter diff --git a/ecomp-sdk/epsdk-app-overlay/pom.xml b/ecomp-sdk/epsdk-app-overlay/pom.xml index 53147a81..f0d15a73 100644 --- a/ecomp-sdk/epsdk-app-overlay/pom.xml +++ b/ecomp-sdk/epsdk-app-overlay/pom.xml @@ -5,7 +5,7 @@ org.onap.portal.sdk epsdk-project - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/defs/definitions.xml b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/defs/definitions.xml index 49064879..05556d27 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/defs/definitions.xml +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/defs/definitions.xml @@ -47,8 +47,9 @@ - - + + + diff --git a/ecomp-sdk/epsdk-core/pom.xml b/ecomp-sdk/epsdk-core/pom.xml index 1bdb1490..d15b18ff 100644 --- a/ecomp-sdk/epsdk-core/pom.xml +++ b/ecomp-sdk/epsdk-core/pom.xml @@ -1,11 +1,12 @@ - + 4.0.0 - + org.onap.portal.sdk epsdk-project - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT @@ -20,7 +21,7 @@ 6.4.0.Final - + @@ -42,13 +43,13 @@ - + - + org.onap.portal.sdk epsdk-fw @@ -61,6 +62,18 @@ + + + org.onap.portal.sdk + epsdk-domain + ${project.version} + + + commons-logging + commons-logging + + + org.drools @@ -111,9 +124,9 @@ ${springframework.version} - org.springframework - spring-aop - ${springframework.version} + org.springframework + spring-aop + ${springframework.version} org.springframework.boot @@ -126,19 +139,19 @@ - + - org.aspectj - aspectjrt - 1.8.9 + org.aspectj + aspectjrt + 1.8.9 - + org.aspectj aspectjweaver 1.8.9 - + @@ -163,29 +176,29 @@ 2.3.1 - org.apache.taglibs - taglibs-standard-spec - 1.2.5 + org.apache.taglibs + taglibs-standard-spec + 1.2.5 - org.apache.taglibs - taglibs-standard-impl - 1.2.5 + org.apache.taglibs + taglibs-standard-impl + 1.2.5 - org.apache.taglibs - taglibs-standard-spec - 1.2.5 + org.apache.taglibs + taglibs-standard-spec + 1.2.5 - org.apache.taglibs - taglibs-standard-impl - 1.2.5 + org.apache.taglibs + taglibs-standard-impl + 1.2.5 - org.apache.taglibs - taglibs-standard-jstlel - 1.2.5 + org.apache.taglibs + taglibs-standard-jstlel + 1.2.5 @@ -337,37 +350,38 @@ - + - com.att.eelf - eelf-core - 1.0.0 + com.att.eelf + eelf-core + 1.0.0 org.owasp.esapi esapi 2.1.0.1 - - - commons-beanutils - commons-beanutils-core - - - commons-httpclient - commons-httpclient - - - xerces - xercesImpl + + + commons-beanutils + commons-beanutils-core + + + commons-httpclient + commons-httpclient + + + xerces + xercesImpl - - org.beanshell - bsh-core - - + + org.beanshell + bsh-core + + + com.att.nsa @@ -400,14 +414,19 @@ runtime - com.thoughtworks.xstream - xstream - 1.4.10 + org.apache.lucene + lucene-queryparser + 7.2.1 - org.apache.wicket - wicket-core - 1.5.16 + com.thoughtworks.xstream + xstream + 1.4.10 + + + org.apache.wicket + wicket-core + 1.5.16 ch.qos.logback @@ -425,9 +444,69 @@ 1.3.3 - commons-beanutils - commons-beanutils - 1.9.3 + commons-beanutils + commons-beanutils + 1.9.2 + + + org.apache.poi + poi + 3.17 + + + commons-logging + commons-logging + + + log4j + log4j + + + + + org.apache.poi + poi-ooxml + 3.17 + + + commons-logging + commons-logging + + + log4j + log4j + + + + + org.apache.poi + poi-scratchpad + 3.17 + + + commons-logging + commons-logging + + + log4j + log4j + + + + + org.apache.poi + poi-contrib + 3.5-FINAL + + + commons-logging + commons-logging + + + log4j + log4j + + org.apache.httpcomponents @@ -435,15 +514,10 @@ 4.5.3 - xalan - xalan - 2.7.2 + xalan + xalan + 2.7.2 - - xerces - xercesImpl - 2.11.0.SP5 - - + diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/FusionObject.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/FusionObject.java deleted file mode 100644 index 9928b65f..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/FusionObject.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * 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============================================ - * - * - */ -package org.onap.portalsdk.core; - -/** - *

- * Title: FusionObject - *

- * - *

- * Description: This interface is implemented by all top-level support classes - * of each package in FUSION. This allows all top-level support classes to have - * some commonality for easier maintenance. - *

- */ -public interface FusionObject { - - /** - * Inner class provides static constants to any class that implements the - * interface. - */ - public class Parameters { - - private Parameters() { - // Static content only - } - - // HashMap parameters passed to the Service and Dao tiers - public static final String PARAM_USERID = "userId"; - public static final String PARAM_HTTP_REQUEST = "request"; - public static final String PARAM_FILTERS = "filters"; - public static final String PARAM_CLIENT_DEVICE = "client_device"; - // Request parameters passed in the Web tier - public static final String REQUEST_PARAM_DISPLAY_SUCCESS_MESSAGE = "display_success_message"; - } - - /** - * Inner class provides static utility functions to any class that implements - * the interface. - */ - public class Utilities { - - private Utilities() { - // Static content only - } - - /** - * nvl - replaces a string value with an empty string if null. - * - * @param s - * String - the string value that needs to be checked - * @return String - returns the original string value if not null. Otherwise an - * empty string ("") is returned. - */ - public static String nvl(String s) { - return s == null ? "" : s; - } - - /** - * nvl - replaces a string value with a default value if null or empty. - * - * @param s - * String - the string value that needs to be checked - * @param sDefault - * String - the default value - * @return String - returns the original string value if not null nor empty. - * Otherwise the default value is returned. - */ - public static String nvl(String s, String sDefault) { - return "".equals(nvl(s)) ? sDefault : s; - } - - /** - * Tests the specified string for nullity. - * - * @param a - * String to test for nullity. - * @return True if the specified string is null, empty or the 4-character - * sequence "null" (ignoring case); otherwise false. - */ - public static boolean isNull(String a) { - return a == null || a.length() == 0 || a.equalsIgnoreCase("null"); - } - - } - -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/command/LoginBean.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/command/LoginBean.java index 9514d135..761e3449 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/command/LoginBean.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/command/LoginBean.java @@ -215,4 +215,13 @@ public class LoginBean extends FusionCommand { this.userid = userid; } + @Override + public String toString() { + return "LoginBean [loginId=" + loginId + ", loginPwd=" + loginPwd + ", hrid=" + hrid + ", userid=" + userid + + ", siteAccess=" + siteAccess + ", loginErrorMessage=" + loginErrorMessage + ", user=" + user + + ", menu=" + menu + ", businessDirectMenu=" + businessDirectMenu + "]"; + } + + + } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/command/PostSearchBean.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/command/PostSearchBean.java index b333dc1b..2bdb68fa 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/command/PostSearchBean.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/command/PostSearchBean.java @@ -41,6 +41,7 @@ import java.util.List; import org.onap.portalsdk.core.command.support.SearchBase; import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.FusionObject.Utilities; import com.fasterxml.jackson.databind.annotation.JsonSerialize; diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/dao/support/FusionDao.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/dao/support/FusionDao.java index 32235819..845d8d45 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/dao/support/FusionDao.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/dao/support/FusionDao.java @@ -38,7 +38,7 @@ package org.onap.portalsdk.core.dao.support; import org.hibernate.SessionFactory; -import org.onap.portalsdk.core.FusionObject; +import org.onap.portalsdk.core.domain.FusionObject; public class FusionDao implements FusionObject { private SessionFactory sessionFactory; diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/App.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/App.java deleted file mode 100644 index 9735844e..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/App.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * 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============================================ - * - * - */ -package org.onap.portalsdk.core.domain; - -import org.onap.portalsdk.core.domain.support.DomainVo; - -/** - * Represents a row in the FN_APP table in the EP_SDK database. (A nearly - * identical table is defined in Portal database.) - * - * @version 1.0 - */ -public class App extends DomainVo { - - private static final long serialVersionUID = 3465979916929796990L; - - // superclass defines Id - 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 String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAppPassword() { - return appPassword; - } - - public void setAppPassword(String appPassword) { - this.appPassword = appPassword; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - 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 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 this.thumbnail; - } - - public void setThumbnail(byte[] thumbnail) { - this.thumbnail = thumbnail; - } - - 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; - } - - /** - * Answers true if the objects have the same ID. - */ - @Override - public int compareTo(Object obj) { - Long c1 = getId(); - Long c2 = ((App) obj).getId(); - return c1.compareTo(c2); - } -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/AuditLog.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/AuditLog.java deleted file mode 100644 index 7fd1b356..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/AuditLog.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * 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============================================ - * - * - */ -package org.onap.portalsdk.core.domain; - -import java.util.Date; - -import org.onap.portalsdk.core.domain.support.DomainVo; - -public class AuditLog extends DomainVo { - - /** - * - */ - private static final long serialVersionUID = 1L; - public static final String CD_ACTIVITY_LOGIN = "login"; - public static final String CD_ACTIVITY_LOGOUT = "logout"; - public static final String CD_ACTIVITY_MOBILE_LOGIN = "mobile_login"; - public static final String CD_ACTIVITY_MOBILE_LOGOUT = "mobile_logout"; - - /*-------Profile activities -----------*/ - public static final String CD_ACTIVITY_ROLE_ADD = "add_role"; - public static final String CD_ACTIVITY_ROLE_REMOVE = "remove_role"; - public static final String CD_ACTIVITY_CHILD_ROLE_ADD = "add_child_role"; - public static final String CD_ACTIVITY_CHILD_ROLE_REMOVE = "remove_child_role"; - public static final String CD_ACTIVITY_ROLE_ADD_FUNCTION = "add_role_function"; - public static final String CD_ACTIVITY_ROLE_REMOVE_FUNCTION = "remove_role_function"; - public static final String CD_ACTIVITY_USER_ROLE_ADD = "add_user_role"; - public static final String CD_ACTIVITY_USER_ROLE_REMOVE = "remove_user_role"; - - /* Audit activities */ - public static final String CD_ACTIVITY_FUNCTIONAL_ACCESS = "functional_access"; - public static final String CD_ACTIVITY_TAB_ACCESS = "tab_access"; - public static final String CD_ACTIVITY_APP_ACCESS = "app_access"; - public static final String CD_ACTIVITY_LEFT_MENU_ACCESS = "left_menu_access"; - - private String activityCode; - private String affectedRecordId; - private String comments; - private Date auditDate; - private Long userId; - - public AuditLog() { - setCreated(new Date()); - } - - public AuditLog(String activityCode, String affectedRecordId, String comments, Long userId){ - this.activityCode = activityCode; - this.affectedRecordId = affectedRecordId; - this.comments = comments; - this.userId = userId; - setCreated(new Date()); - } - public String getActivityCode() { - return activityCode; - } - - public String getComments() { - return comments; - } - - public String getAffectedRecordId() { - return affectedRecordId; - } - - public void setActivityCode(String activityCode) { - this.activityCode = activityCode; - } - - public void setComments(String comments) { - this.comments = comments; - } - - public void setAffectedRecordId(String affectedRecordId) { - this.affectedRecordId = affectedRecordId; - } - - public Date getAuditDate() { - return auditDate; - } - - public void setAuditDate(Date auditDate) { - this.auditDate = auditDate; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/BroadcastMessage.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/BroadcastMessage.java deleted file mode 100644 index 8dca7e0e..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/BroadcastMessage.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * 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============================================ - * - * - */ -package org.onap.portalsdk.core.domain; - -import java.util.Date; - -import org.onap.portalsdk.core.domain.support.DomainVo; - -public class BroadcastMessage extends DomainVo { - - private static final long serialVersionUID = 1L; - - public static final String ID_MESSAGE_LOCATION_LOGIN = "10"; - public static final String ID_MESSAGE_LOCATION_WELCOME = "20"; - - private String messageText; - private Integer locationId; - private Date startDate; - private Date endDate; - private Integer sortOrder; - private Boolean active; - private String siteCd; - - public Boolean getActive() { - return active; - } - - public Date getEndDate() { - return endDate; - } - - public Integer getLocationId() { - return locationId; - } - - public String getMessageText() { - return messageText; - } - - public Integer getSortOrder() { - return sortOrder; - } - - public Date getStartDate() { - return startDate; - } - - public String getSiteCd() { - return siteCd; - } - - public void setActive(Boolean active) { - this.active = active; - } - - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - public void setLocationId(Integer locationId) { - this.locationId = locationId; - } - - public void setMessageText(String messageText) { - this.messageText = messageText; - } - - public void setSortOrder(Integer sortOrder) { - this.sortOrder = sortOrder; - } - - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - - public void setSiteCd(String siteCd) { - this.siteCd = siteCd; - } - - @Override - public int compareTo(Object obj) { - Integer c1 = getLocationId(); - Integer c2 = ((BroadcastMessage) obj).getLocationId(); - - if (c1.compareTo(c2) == 0) { - c1 = getSortOrder(); - c2 = ((BroadcastMessage) obj).getSortOrder(); - - if (c1.compareTo(c2) == 0) { - Long c3 = getId(); - Long c4 = ((BroadcastMessage) obj).getId(); - - return c3.compareTo(c4); - } - } - - return c1.compareTo(c2); - } - -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/DomainVo.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/DomainVo.java deleted file mode 100644 index afdddabf..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/DomainVo.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * 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============================================ - * - * - */ -package org.onap.portalsdk.core.domain; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; - -/* Super class from which all data objects descend - * - * @deprecated per Sunder T on 3 June 2016: - * - * Yes, we need to get rid of domain.DomainVO and fold all the references to the support.DomainVO. - */ -@SuppressWarnings("rawtypes") -@Deprecated -public class DomainVo extends FusionVo implements Serializable, Cloneable, Comparable { - - private static final long serialVersionUID = 1L; - protected Long id; - protected Date created; - protected Date modified; - protected Long createdId; - protected Long modifiedId; - protected Long rowNum; - - protected Serializable auditUserId; - - Set auditTrail = null; - - public void setId(Long i) { - id = i; - } - - public void setCreated(Date created) { - this.created = created; - } - - public void setModified(Date modified) { - this.modified = modified; - } - - public void setCreatedId(Long createdId) { - this.createdId = createdId; - } - - public void setModifiedId(Long modifiedId) { - this.modifiedId = modifiedId; - } - - public void setAuditUserId(Serializable auditUserId) { - this.auditUserId = auditUserId; - } - - public void setRowNum(Long rowNum) { - this.rowNum = rowNum; - } - - public void setAuditTrail(Set auditTrail) { - this.auditTrail = auditTrail; - } - - public Long getId() { - return id; - } - - public Date getCreated() { - return created; - } - - public Date getModified() { - return modified; - } - - public Long getCreatedId() { - return createdId; - } - - public Long getModifiedId() { - return modifiedId; - } - - public Serializable getAuditUserId() { - return auditUserId; - } - - public Long getRowNum() { - return rowNum; - } - - public Set getAuditTrail() { - return auditTrail; - } - - @SuppressWarnings("unchecked") - public void addAuditTrailLog(AuditLog auditLog) { - if (getAuditTrail() == null) { - setAuditTrail(new HashSet()); - } - - getAuditTrail().add(auditLog); - } - - public Object copy() { - return copy(false); - } - - public Object copy(boolean isIdNull) { - // let's create a "copy" of the object using serialization - ByteArrayOutputStream baos = null; - ByteArrayInputStream bais = null; - ObjectOutputStream oos = null; - ObjectInputStream ois = null; - - DomainVo newVo = null; - - try { - - baos = new ByteArrayOutputStream(); - oos = new ObjectOutputStream(baos); - oos.writeObject(this); - - bais = new ByteArrayInputStream(baos.toByteArray()); - ois = new ObjectInputStream(bais); - newVo = (DomainVo) ois.readObject(); - - if (isIdNull) { - newVo.setId(null); - } - - } catch (Exception e) { - e.printStackTrace(); - } - - return newVo; - } - - @Override - public int compareTo(Object obj) { - Long c1 = getId(); - Long c2 = ((DomainVo) obj).getId(); - - return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); - } - -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/FnMenu.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/FnMenu.java deleted file mode 100644 index 8746786f..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/FnMenu.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * 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============================================ - * - * - */ -package org.onap.portalsdk.core.domain; - -import org.onap.portalsdk.core.domain.support.DomainVo; - -/** - *

- * RoleFunction.java - *

- * - *

- * Represents a role function data object. - *

- * - * @version 1.0 - */ -public class FnMenu extends DomainVo { - - private static final long serialVersionUID = 1L; - - private Integer menuId; - private String label; - private Integer parentId; - private String action; - private String functionCd; - private Integer sortOrder; - private String servlet; - private String queryString; - private String externalUrl; - private String target; - private String active; - private String separator; - private String imageSrc; - private String menuSetCode; - - public Integer getMenuId() { - return menuId; - } - - public void setMenuId(Integer menuId) { - this.menuId = menuId; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public Integer getParentId() { - return parentId; - } - - public void setParentId(Integer parentId) { - this.parentId = parentId; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getFunctionCd() { - return functionCd; - } - - public void setFunctionCd(String functionCd) { - this.functionCd = functionCd; - } - - public Integer getSortOrder() { - return sortOrder; - } - - public void setSortOrder(Integer sortOrder) { - this.sortOrder = sortOrder; - } - - public String getServlet() { - return servlet; - } - - public void setServlet(String servlet) { - this.servlet = servlet; - } - - public String getQueryString() { - return queryString; - } - - public void setQueryString(String queryString) { - this.queryString = queryString; - } - - public String getExternalUrl() { - return externalUrl; - } - - public void setExternalUrl(String externalUrl) { - this.externalUrl = externalUrl; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getActive() { - return active; - } - - public void setActive(String active) { - this.active = active; - } - - public String getSeparator() { - return separator; - } - - public void setSeparator(String separator) { - this.separator = separator; - } - - public String getImageSrc() { - return imageSrc; - } - - public void setImageSrc(String imageSrc) { - this.imageSrc = imageSrc; - } - - public String getMenuSetCode() { - return menuSetCode; - } - - public void setMenuSetCode(String menuSetCode) { - this.menuSetCode = menuSetCode; - } - -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/FusionVo.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/FusionVo.java deleted file mode 100644 index 2ff3729a..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/FusionVo.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * 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============================================ - * - * - */ -package org.onap.portalsdk.core.domain; - -import org.onap.portalsdk.core.FusionObject; - -public class FusionVo implements FusionObject { - public FusionVo() { - // No-argument constructor - } -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/LoginBean.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/LoginBean.java deleted file mode 100644 index 4ff4e484..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/LoginBean.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * 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============================================ - * - * - */ -package org.onap.portalsdk.core.domain; - -import java.util.Set; - -import org.onap.portalsdk.core.domain.support.FusionCommand; - -@SuppressWarnings("rawtypes") -public class LoginBean extends FusionCommand { - - private String loginId; - private String loginPwd; - private String hrid; - private String orgUserId; - private String siteAccess; - private String loginErrorMessage; - - private User user; - private Set menu; - private Set businessDirectMenu; - - /** - * getLoginId - * - * @return String - */ - public String getLoginId() { - return loginId; - } - - /** - * getLoginPwd - * - * @return String - */ - public String getLoginPwd() { - return loginPwd; - } - - /** - * getMenu - * - * @return Set - */ - public Set getMenu() { - return menu; - } - - /** - * getUser - * - * @return User - */ - public User getUser() { - return user; - } - - /** - * getHrid - * - * @return String - */ - public String getHrid() { - return hrid; - } - - /** - * getSiteAccess - * - * @return String - */ - public String getSiteAccess() { - return siteAccess; - } - - /** - * getBusinessDirectMenu - * - * @return Set - */ - public Set getBusinessDirectMenu() { - return businessDirectMenu; - } - - /** - * getLoginErrorMessage - * - * @return String - */ - public String getLoginErrorMessage() { - return loginErrorMessage; - } - - public String getOrgUserId() { - return orgUserId; - } - - /** - * setLoginId - * - * @param loginId - * String - */ - public void setLoginId(String loginId) { - this.loginId = loginId; - } - - /** - * setLoginPwd - * - * @param loginPwd - * String - */ - public void setLoginPwd(String loginPwd) { - this.loginPwd = loginPwd; - } - - public void setMenu(Set menu) { - this.menu = menu; - } - - /** - * setUser - * - * @param user - * User - */ - public void setUser(User user) { - this.user = user; - } - - /** - * setHrid - * - * @param hrid - * String - */ - public void setHrid(String hrid) { - this.hrid = hrid; - } - - /** - * setSiteAccess - * - * @param siteAccess - * String - */ - public void setSiteAccess(String siteAccess) { - this.siteAccess = siteAccess; - } - - /** - * setBusinessDirectMenu - * - * @param businessDirectMenu - * Set - */ - public void setBusinessDirectMenu(Set businessDirectMenu) { - this.businessDirectMenu = businessDirectMenu; - } - - /** - * setLoginErrorMessage - * - * @param loginErrorMessage - * String - */ - public void setLoginErrorMessage(String loginErrorMessage) { - this.loginErrorMessage = loginErrorMessage; - } - - public void setOrgUserId(String orgUserId) { - this.orgUserId = orgUserId; - } - -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/Lookup.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/Lookup.java deleted file mode 100644 index de324c75..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/Lookup.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * 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============================================ - * - * - */ -package org.onap.portalsdk.core.domain; - -import java.io.Serializable; -import java.util.Objects; - -import org.onap.portalsdk.core.domain.support.NameValueId; - -public class Lookup extends FusionVo implements Serializable { - - private static final long serialVersionUID = 1L; - private NameValueId nameValueId = new NameValueId(); - - public Lookup() { - super(); - } - - public Lookup(String label, String value) { - this(); - setLabel(label); - setValue(value); - } - - public String getValue() { - return getNameValueId().getVal(); - } - - public String getLabel() { - return getNameValueId().getLab(); - } - - public void setValue(String value) { - getNameValueId().setVal(value); - } - - public void setLabel(String label) { - getNameValueId().setLab(label); - } - - public NameValueId getNameValueId() { - return nameValueId; - } - - public void setNameValueId(NameValueId nameValueId) { - this.nameValueId = nameValueId; - } - - // required by ZK for to set the selectedItems of Listboxes (used heavily for - // -style drop-downs) + @Override + public int hashCode() { + return Objects.hash(getValue(), getLabel()); + } + + @Override + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof Lookup)) + return false; + Lookup lookup = (Lookup) obj; + return Objects.equals(lookup.getValue(), getValue()) && Objects.equals(lookup.getLabel(), getLabel()); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuCountry.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuCountry.java new file mode 100644 index 00000000..0f7ab654 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuCountry.java @@ -0,0 +1,95 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +/** + * + *

+ * Represents a country data object. + *

+ * + * @version 1.0 + */ +public class LuCountry extends DomainVo { + + private static final long serialVersionUID = 1L; + private String abbr; + private String country; + private String fullName; + private String webphoneCountryLabel; + + public String getCountry() { + return country; + } + + public String getAbbr() { + return abbr; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setAbbr(String abbr) { + this.abbr = abbr; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public String getWebphoneCountryLabel() { + return webphoneCountryLabel; + } + + public void setWebphoneCountryLabel(String webphoneCountryLabel) { + this.webphoneCountryLabel = webphoneCountryLabel; + } + + @Override + public int compareTo(Object obj) { + String c1 = getCountry(); + String c2 = ((LuCountry) obj).getCountry(); + return c1.compareTo(c2); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuState.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuState.java new file mode 100644 index 00000000..75a233be --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuState.java @@ -0,0 +1,78 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +/** + *

+ * Represents a state data object. + *

+ * + * @version 1.0 + */ +public class LuState extends DomainVo { + + private static final long serialVersionUID = 1L; + + private String abbr; + private String state; + + public String getState() { + return state; + } + + public String getAbbr() { + return abbr; + } + + public void setState(String state) { + this.state = state; + } + + public void setAbbr(String abbr) { + this.abbr = abbr; + } + + @Override + public int compareTo(Object obj) { + String c1 = getState(); + String c2 = ((LuState) obj).getState(); + + return c1.compareTo(c2); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuTimeZone.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuTimeZone.java new file mode 100644 index 00000000..addbed67 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/LuTimeZone.java @@ -0,0 +1,89 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +/** + *

+ * LuTimeZone.java + *

+ * + *

+ * Represents a LuTimeZone data object. + *

+ * + * @version 1.0 + */ +public class LuTimeZone extends DomainVo { + + private static final long serialVersionUID = 1L; + private String name; + private Long timezoneId; + private String value; + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + public void setName(String name) { + this.name = name; + } + + public void setValue(String value) { + this.value = value; + } + + public Long getTimezoneId() { + return timezoneId; + } + + public void setTimezoneId(Long timezoneId) { + this.timezoneId = timezoneId; + } + + @Override + public int compareTo(Object obj) { + Long c1 = getId(); + Long c2 = ((LuTimeZone) obj).getId(); + return c1.compareTo(c2); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Menu.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Menu.java new file mode 100644 index 00000000..11a93b3e --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Menu.java @@ -0,0 +1,173 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import org.onap.portalsdk.core.domain.support.DomainVo; + +public class Menu extends DomainVo { + + private static final long serialVersionUID = 1L; + + private String menuLevel; + private String label; + private Long parentId; + private String action; + private String functionCd; + private Short sortOrder; + private String servlet; + private String queryString; + private String externalUrl; + private String target; + private boolean active; + private String menuSetCode; + private boolean separator; + private String imageSrc; + + public String getAction() { + return action; + } + + public boolean isActive() { + return active; + } + + public String getExternalUrl() { + return externalUrl; + } + + public String getFunctionCd() { + return functionCd; + } + + public String getLabel() { + return label; + } + + public String getMenuLevel() { + return menuLevel; + } + + public Long getParentId() { + return parentId; + } + + public String getQueryString() { + return queryString; + } + + public String getServlet() { + return servlet; + } + + public Short getSortOrder() { + return sortOrder; + } + + public String getTarget() { + return target; + } + + public String getMenuSetCode() { + return menuSetCode; + } + + public void setAction(String action) { + this.action = action; + } + + public void setActive(boolean active) { + this.active = active; + } + + public void setExternalUrl(String externalUrl) { + this.externalUrl = externalUrl; + } + + public void setFunctionCd(String functionCd) { + this.functionCd = functionCd; + } + + public void setLabel(String label) { + this.label = label; + } + + public void setMenuLevel(String menuLevel) { + this.menuLevel = menuLevel; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public void setQueryString(String queryString) { + this.queryString = queryString; + } + + public void setServlet(String servlet) { + this.servlet = servlet; + } + + public void setSortOrder(Short sortOrder) { + this.sortOrder = sortOrder; + } + + public void setTarget(String target) { + this.target = target; + } + + public void setMenuSetCode(String menuSetCode) { + this.menuSetCode = menuSetCode; + } + + public boolean isSeparator() { + return separator; + } + + public void setSeparator(boolean separator) { + this.separator = separator; + } + + public String getImageSrc() { + return imageSrc; + } + + public void setImageSrc(String imageSrc) { + this.imageSrc = imageSrc; + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/MenuData.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/MenuData.java new file mode 100644 index 00000000..09f9ff41 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/MenuData.java @@ -0,0 +1,87 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import java.util.Set; +import java.util.TreeSet; + +public class MenuData extends Menu { + + private static final long serialVersionUID = 1L; + private MenuData parentMenu; + private Set childMenus = new TreeSet(); + + public MenuData() { + } + + public Set getChildMenus() { + return childMenus; + } + + public void setChildMenus(Set childMenus) { + this.childMenus = childMenus; + } + + public MenuData getParentMenu() { + return parentMenu; + } + + public void setParentMenu(MenuData parentMenu) { + this.parentMenu = parentMenu; + } + + public String getActiveAsString() { + return String.valueOf(isActive()); + } + + public String getParentIdAsString() { + return String.valueOf(getParentId()); + } + + public String getSeparatorAsString() { + return String.valueOf(isSeparator()); + } + + @Override + public int compareTo(Object obj) { + Short c1 = getSortOrder(); + Short c2 = ((MenuData) obj).getSortOrder(); + return (c1 == null || c2 == null) ? 1 : ((c1.compareTo(c2) == 0) ? 1 : c1.compareTo(c2)); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Profile.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Profile.java new file mode 100644 index 00000000..20200ce8 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Profile.java @@ -0,0 +1,110 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +public class Profile extends DomainVo { + + private static final long serialVersionUID = 3409056457412656883L; + + private Long id; + private String first_name; + private String last_name; + private String email; + private String orgManagerUserId; + private String active_yn; + private String orgUserId; + + @Override + public Long getId() { + return id; + } + + @Override + public void setId(Long id) { + this.id = id; + } + + public String getFirst_name() { + return first_name; + } + + public void setFirst_name(String first_name) { + this.first_name = first_name; + } + + public String getLast_name() { + return last_name; + } + + public void setLast_name(String last_name) { + this.last_name = last_name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getOrgManagerUserId() { + return orgManagerUserId; + } + + public void setOrgManagerUserId(String orgManagerUserId) { + this.orgManagerUserId = orgManagerUserId; + } + + public String getActive_yn() { + return active_yn; + } + + public void setActive_yn(String active_yn) { + this.active_yn = active_yn; + } + + public String getOrgUserId() { + return orgUserId; + } + + public void setOrgUserId(String orgUserId) { + this.orgUserId = orgUserId; + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Role.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Role.java new file mode 100644 index 00000000..dee82c9e --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/Role.java @@ -0,0 +1,185 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import java.util.Iterator; +import java.util.Set; +import java.util.TreeSet; + +import org.onap.portalsdk.core.domain.support.DomainVo; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + *

+ * Role.java + *

+ *

+ * Represents a role data object. + *

+ * + * @version 1.0 + */ +public class Role extends DomainVo { + + private static final long serialVersionUID = 1L; + private String name; + private boolean active; + private Integer priority; + + private Set roleFunctions = new TreeSet(); + private Set childRoles = new TreeSet(); + @JsonIgnore + private Set parentRoles = new TreeSet(); + + public String getName() { + return name; + } + + public boolean getActive() { + return active; + } + + public Set getRoleFunctions() { + return roleFunctions; + } + + public Integer getPriority() { + return priority; + } + + public Set getChildRoles() { + return childRoles; + } + + public Set getParentRoles() { + return parentRoles; + } + + public void setName(String name) { + this.name = name; + } + + public void setActive(boolean active) { + this.active = active; + } + + public void setRoleFunctions(Set roleFunctions) { + this.roleFunctions = roleFunctions; + } + + public void setPriority(Integer priority) { + this.priority = priority; + } + + public void setChildRoles(Set childRoles) { + this.childRoles = childRoles; + } + + public void setParentRoles(Set parentRoles) { + this.parentRoles = parentRoles; + } + + @SuppressWarnings("unchecked") + public void addRoleFunction(RoleFunction roleFunction) { + this.roleFunctions.add(roleFunction); + } + + @SuppressWarnings("unchecked") + public void addChildRole(Role role) { + this.childRoles.add(role); + } + + @SuppressWarnings("unchecked") + public void addParentRole(Role role) { + this.parentRoles.add(role); + } + + public String getEditUrl() { + return "/role.htm?role_id=" + getId(); + } + + public String getToggleActiveImage() { + return "/static/fusion/images/" + (getActive() ? "active.png" : "inactive.png"); + } + + public String getToggleActiveAltText() { + return getActive() ? "Click to Deactivate Role" : "Click to Activate Role"; + } + + public void removeChildRole(Long roleId) { + Iterator i = this.childRoles.iterator(); + while (i.hasNext()) { + Role childRole = (Role) i.next(); + if (childRole.getId().equals(roleId)) { + this.childRoles.remove(childRole); + break; + } + } + } + + public void removeParentRole(Long roleId) { + Iterator i = this.parentRoles.iterator(); + while (i.hasNext()) { + Role parentRole = (Role) i.next(); + if (parentRole.getId().equals(roleId)) { + this.parentRoles.remove(parentRole); + break; + } + } + } + + public void removeRoleFunction(String roleFunctionCd) { + Iterator i = this.roleFunctions.iterator(); + while (i.hasNext()) { + RoleFunction roleFunction = (RoleFunction) i.next(); + if (roleFunction.getCode().equals(roleFunctionCd)) { + this.roleFunctions.remove(roleFunction); + break; + } + } + } + + @Override + public int compareTo(Object obj) { + String c1 = getName(); + String c2 = ((Role) obj).getName(); + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java new file mode 100644 index 00000000..98da488f --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/RoleFunction.java @@ -0,0 +1,113 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import org.onap.portalsdk.core.domain.support.DomainVo; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + *

+ * RoleFunction.java + *

+ * + *

+ * Represents a role function data object. + *

+ * + * @version 1.0 + */ +public class RoleFunction extends DomainVo { + + private static final long serialVersionUID = 1L; + private String code; + private String name; + private String type; + private String action; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getName() { + return name; + } + + public String getCode() { + return code; + } + + public void setName(String name) { + this.name = name; + } + + public void setCode(String code) { + this.code = code; + } + + @JsonIgnore + public String getEditUrl() { + return "/role_function.htm?role_function_id=" + getCode(); + } + + @Override + public int compareTo(Object obj) { + String c1 = getName(); + String c2 = ((RoleFunction) obj).getName(); + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + + @Override + public String toString() { + return "RoleFunction [code=" + code + ", name=" + name + ", type=" + type + ", action=" + action + "]"; + } + + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessible.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessible.java new file mode 100644 index 00000000..ba9e4654 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessible.java @@ -0,0 +1,95 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import java.io.Serializable; +import java.util.Objects; + +public class UrlsAccessible extends FusionVo implements Serializable { + + private static final long serialVersionUID = 1L; + private UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey(); + + public UrlsAccessible() { + super(); + } + + public UrlsAccessible(String url, String functionCd) { + this(); + setUrl(url); + setFunctionCd(functionCd); + } + + public String getUrl() { + return getUrlsAccessibleKey().getUrl(); + } + + public String getFunctionCd() { + return getUrlsAccessibleKey().getFunctionCd(); + } + + public void setUrl(String url) { + getUrlsAccessibleKey().setUrl(url); + } + + public void setFunctionCd(String functionCd) { + getUrlsAccessibleKey().setFunctionCd(functionCd); + } + + public UrlsAccessibleKey getUrlsAccessibleKey() { + return urlsAccessibleKey; + } + + public void setUrlsAccessibleKey(UrlsAccessibleKey urlsAccessibleKey) { + this.urlsAccessibleKey = urlsAccessibleKey; + } + + @Override + public int hashCode() { + return Objects.hash(getUrl(), getFunctionCd()); + } + + @Override + public boolean equals(Object obj) { + if (obj == null || !(obj instanceof UrlsAccessible)) + return false; + UrlsAccessible ua = (UrlsAccessible) obj; + return Objects.equals(ua.getUrl(), getUrl()) && Objects.equals(ua.getFunctionCd(), getFunctionCd()); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessibleKey.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessibleKey.java new file mode 100644 index 00000000..ade754fd --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UrlsAccessibleKey.java @@ -0,0 +1,93 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import java.io.Serializable; + +public class UrlsAccessibleKey implements Serializable { + + private static final long serialVersionUID = 1L; + private String url; + private String functionCd; + + public UrlsAccessibleKey() { + super(); + } + + public UrlsAccessibleKey(String url, String functionCd) { + setUrl(url); + setFunctionCd(functionCd); + } + + public String getUrl() { + return url; + } + + public String getFunctionCd() { + return functionCd; + } + + public void setUrl(String url) { + this.url = url; + } + + public void setFunctionCd(String functionCd) { + this.functionCd = functionCd; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null) + return false; + if (!(o instanceof UrlsAccessibleKey)) + return false; + final UrlsAccessibleKey key = (UrlsAccessibleKey) o; + if (getFunctionCd().equals(key.getFunctionCd()) && getUrl().equals(key.getUrl())) + return true; + + return false; + } + + @Override + public int hashCode() { + return getUrl().hashCode() + getFunctionCd().hashCode(); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/User.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/User.java new file mode 100644 index 00000000..3fb5e205 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/User.java @@ -0,0 +1,601 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import java.util.Date; +import java.util.Iterator; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.onap.portalsdk.core.domain.support.DomainVo; + +/** + *

+ * User.java + *

+ * + *

+ * Represents a user data object. + *

+ * + * @version 1.0 + */ +public class User extends DomainVo { + + private static final long serialVersionUID = 1L; + 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 userApps = new TreeSet(); + + private Set pseudoRoles = new TreeSet(); + + public Long getAddressId() { + return addressId; + } + + public String getAlertMethodCd() { + return alertMethodCd; + } + + public String getCellular() { + return cellular; + } + + public String getEmail() { + return email; + } + + public String getFax() { + return fax; + } + + public String getFirstName() { + return firstName; + } + + public String getHrid() { + return hrid; + } + + public Date getLastLoginDate() { + return lastLoginDate; + } + + public String getLastName() { + return lastName; + } + + public String getFullName() { + return getFirstName() + " " + getLastName(); + } + + public String getLoginId() { + return loginId; + } + + public String getLoginPwd() { + return loginPwd; + } + + public Long getManagerId() { + return managerId; + } + + public String getMiddleInitial() { + return middleInitial; + } + + public String getOrgCode() { + return orgCode; + } + + public Long getOrgId() { + return orgId; + } + + public String getPhone() { + return phone; + } + + public String getOrgUserId() { + return orgUserId; + } + + public boolean getActive() { + return active; + } + + public boolean getInternal() { + return internal; + } + + public String getAddress1() { + return address1; + } + + public String getAddress2() { + return address2; + } + + public String getCity() { + return city; + } + + public String getCountry() { + return country; + } + + public String getState() { + return state; + } + + public String getZipCode() { + return zipCode; + } + + public String getBusinessCountryCode() { + return businessCountryCode; + } + + public String getCommandChain() { + return commandChain; + } + + public String getCompany() { + return company; + } + + public String getCompanyCode() { + return companyCode; + } + + public String getDepartment() { + return department; + } + + public String getJobTitle() { + return jobTitle; + } + + public String getLocationClli() { + return locationClli; + } + + public String getOrgManagerUserId() { + return orgManagerUserId; + } + + public String getZipCodeSuffix() { + return zipCodeSuffix; + } + + public String getBusinessCountryName() { + return businessCountryName; + } + + public Set getPseudoRoles() { + return pseudoRoles; + } + + public Long getSelectedProfileId() { + return selectedProfileId; + } + + public void setAddressId(Long addressId) { + this.addressId = addressId; + } + + public void setAlertMethodCd(String alertMethodCd) { + this.alertMethodCd = alertMethodCd; + } + + public void setCellular(String cellular) { + this.cellular = cellular; + } + + public void setEmail(String email) { + this.email = email; + } + + public void setFax(String fax) { + this.fax = fax; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public void setHrid(String hrid) { + this.hrid = hrid; + } + + public void setLastLoginDate(Date lastLoginDate) { + this.lastLoginDate = lastLoginDate; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public void setLoginId(String loginId) { + this.loginId = loginId; + } + + public void setLoginPwd(String loginPwd) { + this.loginPwd = loginPwd; + } + + public void setManagerId(Long managerId) { + this.managerId = managerId; + } + + public void setMiddleInitial(String middleInitial) { + this.middleInitial = middleInitial; + } + + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + public void setOrgId(Long orgId) { + this.orgId = orgId; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public void setOrgUserId(String orgUserId) { + this.orgUserId = orgUserId; + } + + public void setActive(boolean active) { + this.active = active; + } + + public void setInternal(boolean internal) { + this.internal = internal; + } + + public void setAddress1(String address1) { + this.address1 = address1; + } + + public void setAddress2(String address2) { + this.address2 = address2; + } + + public void setCity(String city) { + this.city = city; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setState(String state) { + this.state = state; + } + + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } + + public void setBusinessCountryCode(String businessCountryCode) { + this.businessCountryCode = businessCountryCode; + } + + public void setCommandChain(String commandChain) { + this.commandChain = commandChain; + } + + public void setCompany(String company) { + this.company = company; + } + + public void setCompanyCode(String companyCode) { + this.companyCode = companyCode; + } + + public void setDepartment(String department) { + this.department = department; + } + + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } + + public void setLocationClli(String locationClli) { + this.locationClli = locationClli; + } + + public void setOrgManagerUserId(String orgManagerUserId) { + this.orgManagerUserId = orgManagerUserId; + } + + public void setZipCodeSuffix(String zipCodeSuffix) { + this.zipCodeSuffix = zipCodeSuffix; + } + + public void setBusinessCountryName(String businessCountryName) { + this.businessCountryName = businessCountryName; + } + + public void setPseudoRoles(Set pseudoRoles) { + this.pseudoRoles = pseudoRoles; + } + + public void setSelectedProfileId(Long selectedProfileId) { + this.selectedProfileId = selectedProfileId; + } + + public Long getTimeZoneId() { + return timeZoneId; + } + + public void setTimeZoneId(Long timeZoneId) { + this.timeZoneId = timeZoneId; + } + + public String getBusinessUnit() { + return businessUnit; + } + + public void setBusinessUnit(String businessUnit) { + this.businessUnit = businessUnit; + } + + public String getSiloStatus() { + return siloStatus; + } + + public void setSiloStatus(String siloStatus) { + this.siloStatus = siloStatus; + } + + public String getCostCenter() { + return costCenter; + } + + public void setCostCenter(String costCenter) { + this.costCenter = costCenter; + } + + public String getFinancialLocCode() { + return financialLocCode; + } + + public void setFinancialLocCode(String financialLocCode) { + this.financialLocCode = financialLocCode; + } + + public String getBusinessUnitName() { + return businessUnitName; + } + + public void setBusinessUnitName(String businessUnitName) { + this.businessUnitName = businessUnitName; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public boolean isOnline() { + return online; + } + + public void setOnline(boolean online) { + this.online = online; + } + + public String getChatId() { + return chatId; + } + + public void setChatId(String chatId) { + this.chatId = chatId; + } + + public Set getUserApps() { + return userApps; + } + + public void setUserApps(Set userApps) { + this.userApps = userApps; + } + + @SuppressWarnings("unchecked") + public void addAppRoles(App app, SortedSet roles) { + if (roles != null) { + // add all + Set newUserApps = new TreeSet(); + Iterator itr = roles.iterator(); + while (itr.hasNext()) { + Role role = (Role) itr.next(); + UserApp userApp = new UserApp(); + userApp.setUserId(this.id); + userApp.setApp(app); + userApp.setRole(role); + newUserApps.add(userApp); + } + setUserApps(newUserApps); + } else { + // remove all + this.userApps.clear(); + } + + } + + @SuppressWarnings("unchecked") + public SortedSet getAppRoles(App app) { + SortedSet roles = new TreeSet(); + Set apps = getUserApps(); + Iterator appsItr = apps.iterator(); + // getting default app + while (appsItr.hasNext()) { + UserApp tempUserApp = (UserApp) appsItr.next(); + if (tempUserApp.getApp().getId().equals(app.getId())) { + roles.add(tempUserApp.getRole()); + } + } + return roles; + } + + public SortedSet getRoles() { + App app = new App(); + app.setId(new Long(1)); + app.setName("Default"); + return getAppRoles(app); + } + + public UserApp getDefaultUserApp() { + Set apps = getUserApps(); + Iterator appsItr = apps.iterator(); + UserApp userApp = null; + // getting default app + while (appsItr.hasNext()) { + UserApp tempApp = (UserApp) appsItr.next(); + if (tempApp.getApp().getId().equals(new Long(1))) { + userApp = tempApp; + break; + } + } + return userApp; + } + + public void setRoles(SortedSet roles) { + App app = new App(); + app.setId(new Long(1)); + app.setName("Default"); + addAppRoles(app, roles); + } + + public void removeRole(Long roleId) { + Set apps = getUserApps(); + Iterator appsItr = apps.iterator(); + // getting default app + while (appsItr.hasNext()) { + UserApp tempUserApp = (UserApp) appsItr.next(); + if (tempUserApp.getRole().getId().equals(roleId)) { + appsItr.remove(); + } + } + + } + + @SuppressWarnings("unchecked") + public void addRole(Role role) { + if (role != null) { + SortedSet roles = getRoles(); + if (roles == null) { + roles = new TreeSet(); + } + roles.add(role); + setRoles(roles); + } + } + + @Override + public int compareTo(Object obj) { + User user = (User) obj; + + String c1 = getLastName() + getFirstName() + getMiddleInitial(); + String c2 = user.getLastName() + user.getFirstName() + user.getMiddleInitial(); + + return c1.compareTo(c2); + } + + @Override + public String toString() { + return "User [orgUserId=" + orgUserId + ", userApps=" + userApps + ", pseudoRoles=" + pseudoRoles + "]"; + } + + + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserApp.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserApp.java new file mode 100644 index 00000000..4eebb02f --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserApp.java @@ -0,0 +1,123 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + + +@SuppressWarnings("rawtypes") +public class UserApp implements java.io.Serializable, Comparable { + + private static final long serialVersionUID = 1L; + private Long userId; + private App app; + private Role role; + private Short priority; + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public App getApp() { + return app; + } + + public void setApp(App app) { + this.app = app; + } + + public Role getRole() { + return role; + } + + public void setRole(Role role) { + this.role = role; + } + + public Short getPriority() { + return this.priority; + } + + public void setPriority(Short priority) { + this.priority = priority; + } + + @Override + public boolean equals(Object other) { + if (this == other) + return true; + if (other == null) + return false; + if (!(other instanceof UserApp)) + return false; + UserApp castOther = (UserApp) other; + + return (this.getUserId().equals(castOther.getUserId())) + && (this.getApp().getId().equals(castOther.getApp().getId())) + && (this.getRole().getId().equals(castOther.getRole().getId())) + && ((this.priority == null && castOther.getPriority() == null) + || this.getPriority().equals(castOther.getPriority())); + } + + @Override + public int hashCode() { + int result = 17; + result = 37 * result + (int) (this.getUserId() == null ? 0 : this.getUserId().intValue()); + result = 37 * result + (int) (this.getApp().getId() == null ? 0 : this.getApp().getId().intValue()); + result = 37 * result + (int) (this.getRole().getId() == null ? 0 : this.getRole().getId().intValue()); + result = 37 * result + (int) (this.priority == null ? 0 : this.priority); + return result; + } + + @Override + public int compareTo(Object other) { + UserApp castOther = (UserApp) other; + Long c1 = (this.getUserId() == null ? 0 : this.getUserId()) + + (this.getApp() == null || this.getApp().getId() == null ? 0 : this.getApp().getId()) + + (this.getRole() == null || this.getRole().getId() == null ? 0 : this.getRole().getId()) + + (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.getRole() == null || castOther.getRole().getId() == null ? 0 : castOther.getRole().getId()) + + (castOther.priority == null ? 0 : castOther.priority); + return c1.compareTo(c2); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserAppId.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserAppId.java new file mode 100644 index 00000000..7095168f --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/UserAppId.java @@ -0,0 +1,106 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +// Generated Aug 27, 2014 5:51:36 PM by Hibernate Tools 3.4.0.CR1 + +/** + * FnUserRoleId generated by hbm2java + */ +public class UserAppId implements java.io.Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private Long userId; + private App app; + private Role role; + + public UserAppId() { + super(); + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public App getApp() { + return app; + } + + public void setApp(App app) { + this.app = app; + } + + public Role getRole() { + return role; + } + + public void setRole(Role role) { + this.role = role; + } + + @Override + public boolean equals(Object other) { + if (this == other) + return true; + if (other == null) + return false; + if (!(other instanceof UserAppId)) + return false; + UserAppId castOther = (UserAppId) other; + + return (this.getUserId() == castOther.getUserId()) && (this.getApp().getId() == castOther.getApp().getId()) + && (this.getRole().getId() == castOther.getRole().getId()); + } + + @Override + public int hashCode() { + int result = 17; + result = 37 * result + (int) (this.getUserId() == null ? 0 : this.getUserId().intValue()); + result = 37 * result + (int) (this.getApp().getId() == null ? 0 : this.getApp().getId().intValue()); + result = 37 * result + (int) (this.getRole().getId() == null ? 0 : this.getRole().getId().intValue()); + return result; + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Attribute.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Attribute.java new file mode 100644 index 00000000..8d7fadf9 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Attribute.java @@ -0,0 +1,87 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +public class Attribute { + private double width; + private double top; + private double left; + private String name; + private double height; + + public double getWidth() { + return width; + } + + public void setWidth(double width) { + this.width = width; + } + + public double getTop() { + return top; + } + + public void setTop(double top) { + this.top = top; + } + + public double getLeft() { + return left; + } + + public void setLeft(double left) { + this.left = left; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getHeight() { + return height; + } + + public void setHeight(double height) { + this.height = height; + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/CollaborateList.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/CollaborateList.java new file mode 100644 index 00000000..8534e2e7 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/CollaborateList.java @@ -0,0 +1,72 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; + +public class CollaborateList implements Serializable { + + private static final long serialVersionUID = -4104440747626736243L; + private HashSet userNameList = new HashSet<>(); + private static CollaborateList userListData = new CollaborateList(); + + private CollaborateList() { + } + + public static CollaborateList getInstance() { + return userListData; + } + + public Set getAllUserName() { + return userNameList; + } + + public static void addUserName(String name) { + final Set allUserName = CollaborateList.getInstance().getAllUserName(); + if (!allUserName.contains(name)) + allUserName.add(name); + } + + public static void delUserName(String name) { + final Set allUserName = CollaborateList.getInstance().getAllUserName(); + allUserName.remove((String) name); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Container.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Container.java new file mode 100644 index 00000000..3d9ee77a --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Container.java @@ -0,0 +1,315 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import java.util.List; +import java.util.Map; + +public class Container { + + String id; + + String name; + + Size size; + + Position p; + + Map containerRowCol; + + Map elementRowCol; + + int numOfRows; + + int numOfCols; + + double sum = 0; + + double interEleWd; + + double interEleH; + + double interEleToContainerWd; + + double interEleToContainerH; + + double interEleToInnerContainerWd; + + double interEleToInnerContainerH; + + double top; + + double left; + + double height; + + double width; + + String visibilityType; + + List innerCList; + + List elementList; + + public Container() { + + } + + public Container(String id, String name, int numOfRows, int numOfCols, double interEleWd, double interEleH, + double interEleToContainerWd, double interEleToContainerH, double interEleToInnerContainerWd, + double interEleToInnerContainerH) { + + this.id = id; + this.name = name; + this.numOfRows = numOfRows; + this.numOfCols = numOfCols; + this.interEleWd = interEleWd; + this.interEleH = interEleH; + this.interEleToContainerWd = interEleToContainerWd; + this.interEleToContainerH = interEleToContainerH; + this.interEleToInnerContainerWd = interEleToInnerContainerWd; + this.interEleToInnerContainerH = interEleToInnerContainerH; + + } + + public Map getContainerRowCol() { + return containerRowCol; + } + + public Map getElementRowCol() { + return elementRowCol; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public void setInnerContainer(Map innerCon) { + containerRowCol = innerCon; + } + + public void setElements(Map innerE) { + elementRowCol = innerE; + } + + public Position getP() { + return p; + } + + public void setP(Position p) { + this.p = p; + } + + public void setTop(double top) { + this.top = top; + } + + public void setLeft(double left) { + this.left = left; + } + + public void setHeight(double height) { + this.height = height; + } + + public void setWidth(double width) { + this.width = width; + } + + public void setInnerCList(List innerCList) { + this.innerCList = innerCList; + } + + public void setElementList(List elementList) { + this.elementList = elementList; + } + + public void setVisibilityType(String visibilityType) { + this.visibilityType = visibilityType; + } + + public Size computeSize() { + Size size = new Size(); + double width = 0; + double height = 0; + for (int i = 0; i < numOfRows; i++) { + if ((containerRowCol != null && containerRowCol.containsKey(i + String.valueOf(numOfCols - 1))) + || (elementRowCol != null && elementRowCol.containsKey(i + String.valueOf(numOfCols - 1)))) { + for (int j = 0; j < numOfCols; j++) { + if (containerRowCol != null && containerRowCol.containsKey(i + String.valueOf(j))) { + width += containerRowCol.get(i + String.valueOf(j)).computeSize().getWidth(); + } else if (elementRowCol != null && elementRowCol.containsKey(i + String.valueOf(j))) + width += elementRowCol.get(i + String.valueOf(j)).computeSize().getWidth(); + } + break; + } + } + + if (this.getName().equals("Broadworks complex") || this.getName().equals("Application Servers") + || this.getName().equals("Call Session Control") || this.getName().equals("GMLC Provider") + || this.getName().equals("Neo") || this.getName().equals("Support")) { + width += (numOfCols - 1) * interEleWd + 2 * interEleToInnerContainerWd; + } else { + width += (numOfCols - 1) * interEleWd + 2 * interEleToContainerWd; + } + size.setWidth(width); + for (int j = 0; j < numOfCols; j++) { + if ((containerRowCol != null && containerRowCol.containsKey(String.valueOf(numOfRows - 1) + j)) + || (elementRowCol != null && elementRowCol.containsKey(String.valueOf(numOfRows - 1) + j))) { + for (int i = 0; i < numOfRows; i++) { + if (containerRowCol != null && containerRowCol.containsKey(i + String.valueOf(j))) { + height += containerRowCol.get(i + String.valueOf(j)).computeSize().getHeight(); + } else if (elementRowCol != null && elementRowCol.containsKey(i + String.valueOf(j))) + height += elementRowCol.get(String.valueOf(i) + String.valueOf(j)).computeSize().getHeight(); + } + break; + } + } + if (this.getName().equals("Broadworks complex") || this.getName().equals("Application Servers") + || this.getName().equals("Call Session Control") || this.getName().equals("GMLC Provider") + || this.getName().equals("Neo") || this.getName().equals("Support")) { + height += (numOfRows - 1) * interEleH + 2 * interEleToInnerContainerH + 0.1; + } else { + if (this.getName().equals("VoLTE UE") || this.getName().equals("3G UE") || this.getName().equals("HC UE-A") + || this.getName().equals("HC UE-B") || this.getName().equals("VNI UE") + || this.getName().equals("PSTN")) { + height += (numOfRows - 1) * interEleH + interEleToContainerH / 2; + } else + height += (numOfRows - 1) * interEleH + 2 * interEleToContainerH; + } + size.setHeight(height); + return size; + } + + public void computeElementPositions() { + double xsum = 0; + double ysum = 0; + for (int i = 0; i < numOfRows; i++) { + for (int j = 0; j < numOfCols; j++) { + if (containerRowCol != null && containerRowCol.containsKey(String.valueOf(i) + String.valueOf(j))) { + Container c = containerRowCol.get(String.valueOf(i) + String.valueOf(j)); + Position p = new Position(); + p.x = j * interEleWd + xsum + this.getP().getX() + interEleToContainerWd; + ysum = 0; + for (int k = 0; k < i; k++) { + if (containerRowCol.containsKey(String.valueOf(k) + String.valueOf(j))) + ysum += containerRowCol.get(String.valueOf(k) + String.valueOf(j)).computeSize() + .getHeight(); + else if (elementRowCol.containsKey(String.valueOf(k) + String.valueOf(j))) + ysum += elementRowCol.get(String.valueOf(k) + String.valueOf(j)).computeSize().getHeight(); + } + p.y = i * interEleH + ysum + this.getP().getY() + interEleToContainerH; + // containerCoord.add(c,p); + xsum += c.computeSize().getWidth(); + c.setP(p); + + } else if (elementRowCol != null && elementRowCol.containsKey(String.valueOf(i) + String.valueOf(j))) { + Element e = elementRowCol.get(String.valueOf(i) + String.valueOf(j)); + Position p = new Position(); + if (j == numOfCols - 1) { + for (int t = 0; t < i; t++) { + if (containerRowCol != null + && containerRowCol.containsKey(String.valueOf(t) + String.valueOf(j - 1))) { + if (!elementRowCol.containsKey(String.valueOf(i) + String.valueOf(j - 1)) + && !containerRowCol.containsKey(String.valueOf(i) + String.valueOf(j - 1))) { + xsum += containerRowCol.get(String.valueOf(t) + String.valueOf(j - 1)).computeSize() + .getWidth(); + break; + } + } + } + } + if (this.getName().equals("Broadworks complex") || this.getName().equals("Application Servers") + || this.getName().equals("Call Session Control") || this.getName().equals("GMLC Provider") + || this.getName().equals("Neo") || this.getName().equals("Support")) { + p.x = j * interEleWd + xsum + this.getP().getX() + interEleToInnerContainerWd; + } else if (this.getName().equals("VNI UE") || this.getName().equals("PSTN") + || this.getName().equals("3G UE") || this.getName().equals("HC UE-A") + || this.getName().equals("HC UE-B")) { + p.x = j * interEleWd + xsum + this.getP().getX() + interEleToContainerWd - 0.8; + } else { + p.x = j * interEleWd + xsum + this.getP().getX() + interEleToContainerWd; + } + ysum = 0; + for (int k = 0; k < i; k++) { + if (containerRowCol != null + && containerRowCol.containsKey(String.valueOf(k) + String.valueOf(j))) + ysum += containerRowCol.get(String.valueOf(k) + String.valueOf(j)).computeSize() + .getHeight(); + else if (elementRowCol != null + && elementRowCol.containsKey(String.valueOf(k) + String.valueOf(j))) + ysum += elementRowCol.get(String.valueOf(k) + String.valueOf(j)).computeSize().getHeight(); + else if (containerRowCol != null) { + for (int chk = j; chk > 0; chk--) { + if (containerRowCol.containsKey(String.valueOf(k) + String.valueOf(chk - 1))) { + if (containerRowCol.get(String.valueOf(k) + String.valueOf(chk - 1)).computeSize() + .getWidth() + + containerRowCol.get(String.valueOf(k) + String.valueOf(chk - 1)).getP() + .getX() > p.x) { + ysum += containerRowCol.get(String.valueOf(k) + String.valueOf(chk - 1)) + .computeSize().getHeight(); + break; + } + } + } + } + + } + if (this.getName().equals("Broadworks complex") || this.getName().equals("Application Servers") + || this.getName().equals("Call Session Control") || this.getName().equals("GMLC Provider") + || this.getName().equals("Neo") || this.getName().equals("Support")) { + p.y = this.getP().getY() + ysum + i * interEleH + interEleToInnerContainerH + 1; + } else { + if (e.getName().equals("")) { + p.y = this.getP().getY() + ysum + i * interEleH + (interEleToContainerH); + } else + p.y = this.getP().getY() + ysum + i * interEleH + interEleToContainerH; + } + xsum += e.computeSize().getWidth(); + e.setP(p); + } + } + xsum = 0; + } + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java new file mode 100644 index 00000000..dcf4fd54 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java @@ -0,0 +1,222 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import java.util.List; +import java.util.Map; + +public class Domain { + // Unique identifier of the domain + String id; + String name; + Size size; + Position p; + // Horizontal space between a pair of containers + double interContWd = 1.0; + // Vertical space between a pair of containers + double interContH; + double domainToLayoutWd; + double domainToContH; + double domainToLayoutH; + int numOfRowsofContainer; + int numOfColsofContainer; + boolean indexChanged; + Map containerRowCol; + double top; + double left; + double height; + double width; + List containerList; + double newXafterColl; + double YafterColl; + + public Domain(String id, String name, double interContWd, double interContH, double domainToLayoutWd, + double domainToLayoutH, double domainToContH, int numOfRowsofContainer, int numOfColsofContainer) { + this.id = id; + this.name = name; + this.interContWd = interContWd; + this.interContH = interContH; + this.domainToLayoutWd = domainToLayoutWd; + this.domainToLayoutH = domainToLayoutH; + this.domainToContH = domainToContH; + this.numOfRowsofContainer = numOfRowsofContainer; + this.numOfColsofContainer = numOfColsofContainer; + } + + public Position getP() { + return p; + } + + public void setP(Position p) { + this.p = p; + } + + public void setNewXafterColl(double newXafterColl) { + this.newXafterColl = newXafterColl; + } + + public double getNewXafterColl() { + return newXafterColl; + } + + public double getYafterColl() { + return YafterColl; + } + + public void setYafterColl(double yafterColl) { + YafterColl = yafterColl; + } + + public void setDomainToLayoutWd(double domainToLayoutWd) { + this.domainToLayoutWd = domainToLayoutWd; + } + + public double getDomainToLayoutWd() { + return domainToLayoutWd; + } + + public double getTop() { + return top; + } + + public void setTop(double top) { + this.top = top; + } + + public double getLeft() { + return left; + } + + public void setLeft(double left) { + this.left = left; + } + + public double getHeight() { + return height; + } + + public void setHeight(double height) { + this.height = height; + } + + public double getWidth() { + return width; + } + + public void setWidth(double width) { + this.width = width; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setContainers(Map containerRowCol) { + this.containerRowCol = containerRowCol; + } + + public Map getContainerRowCol() { + return containerRowCol; + } + + public void setContainerList(List containerList) { + this.containerList = containerList; + } + + public boolean isIndexChanged() { + return indexChanged; + } + + public void setIndexChanged(boolean indexChanged) { + this.indexChanged = indexChanged; + } + + // Compute the size of any domain + public Size computeSize() { + size = new Size(); + size.setHeight(5); + double myWidth = 0; + for (int i = 0; i < numOfRowsofContainer; i++) { + if (containerRowCol != null + && containerRowCol.containsKey(String.valueOf(i) + String.valueOf(numOfColsofContainer - 1))) { + for (int j = 0; j < numOfColsofContainer; j++) { + myWidth += containerRowCol.get(String.valueOf(i) + String.valueOf(j)).computeSize().getWidth(); + } + break; + } + + } + myWidth += (numOfColsofContainer - 1) * interContWd; + if (this.getName().equals("VNI")) + size.setWidth(myWidth - 4); + else + size.setWidth(myWidth); + return size; + } + + public void computeConatinerPositions() { + + double xsum = 0; + for (int i = 0; i < numOfRowsofContainer; i++) { + for (int j = 0; j < numOfColsofContainer; j++) { + if (containerRowCol != null && containerRowCol.containsKey(String.valueOf(i) + String.valueOf(j))) { + Container c = containerRowCol.get(String.valueOf(i) + String.valueOf(j)); + Position p = new Position(); + p.x = j * interContWd + xsum + domainToLayoutWd; + double ysum = 0; + for (int k = 0; k < i; k++) { + if (containerRowCol.containsKey(String.valueOf(k) + String.valueOf(j))) + ysum += containerRowCol.get(String.valueOf(k) + String.valueOf(j)).computeSize() + .getHeight(); + } + p.y = domainToLayoutH + ysum + this.computeSize().getHeight() + domainToContH + i * interContH; + c.setP(p); + xsum += c.computeSize().getWidth(); + } + } + xsum = 0; + + } + + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/DomainVo.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/DomainVo.java new file mode 100644 index 00000000..d2f41c90 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/DomainVo.java @@ -0,0 +1,198 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import org.onap.portalsdk.core.domain.FusionVo; + +/* Super class from which all data objects descend */ +@SuppressWarnings("rawtypes") +public class DomainVo extends FusionVo implements Serializable, Cloneable, Comparable { + +// TODO: Remove after the EELFLoggerImpl +// private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DomainVo.class); + + private static final long serialVersionUID = 1L; + protected Long id; + protected Date created; + protected Date modified; + protected Long createdId; + protected Long modifiedId; + protected Long rowNum; + protected Serializable auditUserId; + protected Set auditTrail = null; + + public DomainVo() { + super(); + } + + public void setId(Long i) { + id = i; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setModified(Date modified) { + this.modified = modified; + } + + public void setCreatedId(Long createdId) { + this.createdId = createdId; + } + + public void setModifiedId(Long modifiedId) { + this.modifiedId = modifiedId; + } + + public void setAuditUserId(Serializable auditUserId) { + this.auditUserId = auditUserId; + } + + public void setRowNum(Long rowNum) { + this.rowNum = rowNum; + } + + public void setAuditTrail(Set auditTrail) { + this.auditTrail = auditTrail; + } + + public Long getId() { + return id; + } + + public Date getCreated() { + return created; + } + + public Date getModified() { + return modified; + } + + public Long getCreatedId() { + return createdId; + } + + public Long getModifiedId() { + return modifiedId; + } + + public Serializable getAuditUserId() { + return auditUserId; + } + + public Long getRowNum() { + return rowNum; + } + + public Set getAuditTrail() { + return auditTrail; + } + + public Object copy() { + return copy(false); + } + + public Object copy(boolean isIdNull) { + // let's create a "copy" of the object using serialization + ByteArrayOutputStream baos = null; + ByteArrayInputStream bais = null; + ObjectOutputStream oos = null; + ObjectInputStream ois = null; + + DomainVo newVo = null; + try { + baos = new ByteArrayOutputStream(); + oos = new ObjectOutputStream(baos); + oos.writeObject(this); + + bais = new ByteArrayInputStream(baos.toByteArray()); + ois = new ObjectInputStream(bais); + newVo = (DomainVo) ois.readObject(); + + if (isIdNull) { + newVo.setId(null); + } + + } catch (Exception e) { + +// TODO: Remove after the EELFLoggerImpl logger.error(EELFLoggerDelegate.errorLogger, "copy failed", e); + e.printStackTrace(); + } + + return newVo; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + @Override + public boolean equals(Object other) { + if (this == other) + return true; + if (other == null) + return false; + if (!(other instanceof DomainVo)) + return false; + DomainVo castOther = (DomainVo) other; + return this.getId() == castOther.getId() + && this.getCreated().equals(castOther.getCreated()) + && this.getCreatedId() == castOther.getCreatedId() + && this.getModified().equals(castOther.getModified()) + && this.getModifiedId() == castOther.getModifiedId() + ; + } + + @Override + public int compareTo(Object obj) { + Long c1 = getId(); + Long c2 = ((DomainVo) obj).getId(); + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Element.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Element.java new file mode 100644 index 00000000..9da4a242 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Element.java @@ -0,0 +1,154 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +public class Element { + + String id; + String name; + + double top; + + double left; + + double height; + + double width; + + String imgFileName; + + String borderType; + + String bgColor; + + ElementDetails details; + + Position p; + + public Element(String id, String name) { + this.id = id; + this.name = name; + } + + public Element(String id, String name, String imgFilename, String bgColor, String borderType, + ElementDetails details) { + this.id = id; + this.name = name; + this.imgFileName = imgFilename; + this.bgColor = bgColor; + this.borderType = borderType; + this.details = details; + + } + + public void setBgColor(String bgColor) { + this.bgColor = bgColor; + } + + public void setId(String id) { + this.id = id; + } + + public void setTop(double top) { + this.top = top; + } + + public void setLeft(double left) { + this.left = left; + } + + public void setHeight(double height) { + this.height = height; + } + + public void setWidth(double width) { + this.width = width; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Position getP() { + return p; + } + + public void setP(Position p) { + this.p = p; + } + + public void setBorderType(String borderType) { + this.borderType = borderType; + } + + public String getImgFileName() { + return imgFileName; + } + + public void setImgFileName(String imgFileName) { + this.imgFileName = imgFileName; + } + + public String getBorderType() { + return borderType; + } + + public ElementDetails getDetails() { + return details; + } + + public void setDetails(ElementDetails details) { + this.details = details; + } + + public Size computeSize() { + Size size = new Size(); + size.setWidth(0.5 * 7.0); + size.setHeight(0.5 * 3.0); + return size; + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/ElementDetails.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/ElementDetails.java new file mode 100644 index 00000000..61fc6497 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/ElementDetails.java @@ -0,0 +1,77 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +public class ElementDetails { + + String logical_group; + String display_longname; + String description; + String primary_function; + String network_function; + String key_interfaces; + String location; + String vendor; + String vendor_shortname; + String enclosingContainer; + + public ElementDetails(String logical_group, String display_longname, String description, String primary_function, + String network_function, String key_interfaces, String location, String vendor, String vendor_shortname, + String enclosingContainer) { + + this.logical_group = logical_group; + this.display_longname = display_longname; + this.description = description; + this.primary_function = primary_function; + this.network_function = network_function; + this.key_interfaces = key_interfaces; + this.location = location; + this.vendor = vendor; + this.vendor_shortname = vendor_shortname; + this.enclosingContainer = enclosingContainer; + } + + public String getLogical_group() { + return logical_group; + } + + public void setLogical_group(String logical_group) { + this.logical_group = logical_group; + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/FusionCommand.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/FusionCommand.java new file mode 100644 index 00000000..b79dc064 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/FusionCommand.java @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import org.onap.portalsdk.core.domain.FusionObject; + +public class FusionCommand implements FusionObject { + + private String task; + + public String getTask() { + return task; + } + + public void setTask(String task) { + this.task = task; + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java new file mode 100644 index 00000000..33a347de --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java @@ -0,0 +1,955 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +public class Layout { + + Map domainRowCol; + + Map originalDomainRowCol; + + // Horizontal space between a pair of domains + double interDomainWd; + // Vertical space between a pair of domains + double interDomainH; + // Computing the co-ordinates of any domain + int numberofRowsofDomains; + + int numberofColsofDomains; + + Map collapsedDomains; + + List collapsedDomainsNewList; + + public Layout(Map domainRowCol, double interDomainWd, double interDomainH, + int numberofRowsofDomains, int numberofColsofDomains) { + + this.domainRowCol = domainRowCol; + this.interDomainWd = interDomainWd; + this.interDomainH = interDomainH; + this.numberofRowsofDomains = numberofRowsofDomains; + this.numberofColsofDomains = numberofColsofDomains; + this.collapsedDomains = new HashMap<>(); + this.originalDomainRowCol = new TreeMap<>(); + // nline + this.collapsedDomainsNewList = new ArrayList<>(); + } + + public List getCollapsedDomainsNewList() { + return collapsedDomainsNewList; + } + + public void setCollapsedDomainsNewList(List collapsedDomainsNewList) { + this.collapsedDomainsNewList = collapsedDomainsNewList; + } + + public void setCollapsedDomains(Map collapsedDomains) { + this.collapsedDomains = collapsedDomains; + } + + public Map getCollapsedDomains() { + return collapsedDomains; + } + + public int getNumberofColsofDomains() { + return numberofColsofDomains; + } + + public void setNumberofColsofDomains(int numberofColsofDomains) { + this.numberofColsofDomains = numberofColsofDomains; + } + + public Map getDomainRowCol() { + return domainRowCol; + } + + public void setDomainRowCol(Map domainRowCol) { + this.domainRowCol = domainRowCol; + } + + public void computeDomainPositions() { + double xsum = 0; + double domainTolayout = 10.6; + for (int i = 0; i < numberofRowsofDomains; i++) { + for (int j = 0; j < numberofColsofDomains; j++) { + if (domainRowCol.containsKey(String.valueOf(i) + String.valueOf(j))) { + Domain d = domainRowCol.get(String.valueOf(i) + String.valueOf(j)); + Position p = new Position(); + if (j == 0) + p.x = domainTolayout; + else + p.x = j * interDomainWd + xsum + domainTolayout; + if (getCollapsedDomainsNewList().size() > 0) + p.x += accountForPlusSpaceBefore(d); + xsum += d.computeSize().getWidth(); + double ysum = 0; + for (int k = 0; k < i; k++) { + if (domainRowCol.containsKey(String.valueOf(k) + String.valueOf(j))) + ysum += domainRowCol.get(String.valueOf(k) + String.valueOf(j)).computeSize().getHeight(); + } + p.y = (i + 1) * interDomainH + ysum; + d.setP(p); + + } + } + xsum = 0; + } + } + + public void computeDomainPositionsModified() { + for (int i = 0; i < numberofRowsofDomains; i++) { + for (int j = 0; j < numberofColsofDomains; j++) { + if (domainRowCol.containsKey(String.valueOf(i) + String.valueOf(j))) { + Domain d = domainRowCol.get(String.valueOf(i) + String.valueOf(j)); + Position p = new Position(); + Map enclosedContainers = d.getContainerRowCol(); + for (Map.Entry entry : enclosedContainers.entrySet()) { + if (entry.getKey().equals("00")) { + double containerX = entry.getValue().getP().getX(); + p.x = containerX; + double ysum = 0; + for (int k = 0; k < i; k++) { + if (domainRowCol.containsKey(String.valueOf(k) + String.valueOf(j))) + ysum += domainRowCol.get(String.valueOf(k) + String.valueOf(j)).computeSize() + .getHeight(); + } + p.y = (i + 1) * interDomainH + ysum; + d.setP(p); + break; + } + } + } + } + } + + } + + public Layout collapseDomainModified(String domainsToCollapse) { + + if (domainsToCollapse == null || domainsToCollapse.isEmpty()) + return null; + + Map updatedRC = new HashMap<>(); + + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + updatedRC.put(copyEntry.getKey(), copyEntry.getValue()); + } + + Map updatedRCSorted = new TreeMap<>(updatedRC); + + Map collapsedDomainMap = getCollapsedDomains(); + + List collapsedDomainNewL = getCollapsedDomainsNewList(); + + if (collapsedDomainNewL.size() == 0) { + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + originalDomainRowCol.put(copyEntry.getKey(), copyEntry.getValue()); + } + } + + Map updatedRCSortedTrunc = new TreeMap<>(); + + int colToDelete = 0; + for (Map.Entry entry : updatedRCSorted.entrySet()) { + if (entry.getValue().getName().equals(domainsToCollapse)) { + if (entry.getValue().isIndexChanged()) { + collapsedDomainMap.put("0" + String.valueOf(Integer.parseInt(entry.getKey()) + 1), + entry.getValue()); + + } else { + collapsedDomainMap.put(entry.getKey(), entry.getValue()); + } + + collapsedDomainNewL.add(entry.getValue()); + setNumberofColsofDomains(getNumberofColsofDomains() - 1); + updatedRC.remove(entry.getKey()); + colToDelete = Character.getNumericValue(entry.getKey().toCharArray()[1]); + break; + } + } + + for (Map.Entry copyEntry : updatedRCSorted.entrySet()) { + updatedRCSortedTrunc.put(copyEntry.getKey(), copyEntry.getValue()); + } + + for (Map.Entry rmv : updatedRCSorted.entrySet()) { + if (Character.getNumericValue(rmv.getKey().toCharArray()[1]) <= colToDelete) { + updatedRCSortedTrunc.remove(rmv.getKey()); + } + } + + for (Map.Entry updateOthers : updatedRCSortedTrunc.entrySet()) { + char update[] = updateOthers.getKey().toCharArray(); + int charToupdate = Character.getNumericValue(update[1]); + --charToupdate; + String resultRowCol = String.valueOf(update[0]) + String.valueOf(charToupdate); + updateOthers.getValue().setIndexChanged(true); + updatedRC.put(resultRowCol, updateOthers.getValue()); + updatedRC.remove(updateOthers.getKey()); + + } + setDomainRowCol(updatedRC); + + double currDistFromLftM = 11.0; + for (Map.Entry cd : updatedRC.entrySet()) { + Domain d = cd.getValue(); + double accountPlus = accountForPlusSpaceBefore(d); + d.setDomainToLayoutWd(currDistFromLftM + accountPlus); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + currDistFromLftM += d.computeSize().getWidth() + 2; + } + + // nline + // Insert method invocation + updatePlusPosition(collapsedDomainNewL, updatedRC); + + // order changed + setCollapsedDomains(collapsedDomainMap); + setCollapsedDomainsNewList(collapsedDomainNewL); + + computeDomainPositionsModified(); + return this; + } + + public Layout collapseDomainNew(String domainsToCollapse) { + + if (domainsToCollapse == null || domainsToCollapse.isEmpty()) + return null; + + Map updatedRC = new HashMap<>(); + + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + updatedRC.put(copyEntry.getKey(), copyEntry.getValue()); + } + + Map updatedRCSorted = new TreeMap<>(updatedRC); + + Map collapsedDomainMap = getCollapsedDomains(); + + List collapsedDomainNewL = getCollapsedDomainsNewList(); + + if (collapsedDomainNewL.isEmpty()) { + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + originalDomainRowCol.put(copyEntry.getKey(), copyEntry.getValue()); + } + } + + Map updatedRCSortedTrunc = new TreeMap<>(); + + int colToDelete = 0; + for (Map.Entry entry : updatedRCSorted.entrySet()) { + if (entry.getValue().getName().equals(domainsToCollapse)) { + if (entry.getValue().isIndexChanged()) { + collapsedDomainMap.put("0" + String.valueOf(Integer.parseInt(entry.getKey()) + 1), + entry.getValue()); + + } else { + collapsedDomainMap.put(entry.getKey(), entry.getValue()); + } + + collapsedDomainNewL.add(entry.getValue()); + setNumberofColsofDomains(getNumberofColsofDomains() - 1); + updatedRC.remove(entry.getKey()); + colToDelete = Character.getNumericValue(entry.getKey().toCharArray()[1]); + break; + } + } + + for (Map.Entry copyEntry : updatedRCSorted.entrySet()) { + updatedRCSortedTrunc.put(copyEntry.getKey(), copyEntry.getValue()); + } + + for (Map.Entry rmv : updatedRCSorted.entrySet()) { + if (Character.getNumericValue(rmv.getKey().toCharArray()[1]) <= colToDelete) { + updatedRCSortedTrunc.remove(rmv.getKey()); + } + } + + for (Map.Entry updateOthers : updatedRCSortedTrunc.entrySet()) { + char[] update = updateOthers.getKey().toCharArray(); + int charToupdate = Character.getNumericValue(update[1]); + --charToupdate; + String resultRowCol = String.valueOf(update[0]) + String.valueOf(charToupdate); + updateOthers.getValue().setIndexChanged(true); + updatedRC.put(resultRowCol, updateOthers.getValue()); + updatedRC.remove(updateOthers.getKey()); + + } + setDomainRowCol(updatedRC); + + double currDistFromLftM = 11.0; + + boolean isDisplayed; + for (Map.Entry orgEntry : originalDomainRowCol.entrySet()) { + isDisplayed = false; + for (Map.Entry cd : updatedRC.entrySet()) { + if (cd.getValue().getName().equals(orgEntry.getValue().getName())) { + Domain d = cd.getValue(); + d.setDomainToLayoutWd(currDistFromLftM); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + currDistFromLftM += d.computeSize().getWidth() + 1; + isDisplayed = true; + break; + } + } + + if (!isDisplayed) { + Domain myCollapsed = orgEntry.getValue(); + myCollapsed.setNewXafterColl(currDistFromLftM); + myCollapsed.setYafterColl(myCollapsed.getP().getY()); + currDistFromLftM += 4; + } + } + + setCollapsedDomains(collapsedDomainMap); + setCollapsedDomainsNewList(collapsedDomainNewL); + + computeDomainPositionsModified(); + return this; + + } + + public Layout collapseDomain(String domainsToCollapse) { + + Map updatedRC = new HashMap<>(); + + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + updatedRC.put(copyEntry.getKey(), copyEntry.getValue()); + } + + Map updatedRCSorted = new TreeMap<>(updatedRC); + + Map collapsedDomainMap = getCollapsedDomains(); + + if (collapsedDomainMap.size() == 0) { + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + originalDomainRowCol.put(copyEntry.getKey(), copyEntry.getValue()); + } + } + + double prevDomXCordinate = 0.0; + Map updatedRCSortedTrunc = new TreeMap<>(); + int colToDelete = 0; + for (Map.Entry entry : updatedRCSorted.entrySet()) { + if (entry.getValue().getName().equals(domainsToCollapse)) { + if (entry.getValue().isIndexChanged()) + collapsedDomainMap.put("0" + String.valueOf(Integer.parseInt(entry.getKey()) + 1), + entry.getValue()); + else + collapsedDomainMap.put(entry.getKey(), entry.getValue()); + prevDomXCordinate = entry.getValue().getP().getX(); + entry.getValue().getP().setX(prevDomXCordinate - 2); + setNumberofColsofDomains(getNumberofColsofDomains() - 1); + updatedRC.remove(entry.getKey()); + colToDelete = Character.getNumericValue(entry.getKey().toCharArray()[1]); + break; + } + } + + setCollapsedDomains(collapsedDomainMap); + + for (Map.Entry copyEntry : updatedRCSorted.entrySet()) { + updatedRCSortedTrunc.put(copyEntry.getKey(), copyEntry.getValue()); + } + + for (Map.Entry rmv : updatedRCSorted.entrySet()) { + if (Character.getNumericValue(rmv.getKey().toCharArray()[1]) <= colToDelete) { + updatedRCSortedTrunc.remove(rmv.getKey()); + } + } + + for (Map.Entry updateOthers : updatedRCSortedTrunc.entrySet()) { + char update[] = updateOthers.getKey().toCharArray(); + int charToupdate = Character.getNumericValue(update[1]); + --charToupdate; + String resultRowCol = String.valueOf(update[0]) + String.valueOf(charToupdate); + updateOthers.getValue().setIndexChanged(true); + updatedRC.put(resultRowCol, updateOthers.getValue()); + updatedRC.remove(updateOthers.getKey()); + + } + + setDomainRowCol(updatedRC); + + for (Map.Entry entry : updatedRCSortedTrunc.entrySet()) { + Domain d = entry.getValue(); + if (collapsedDomains.size() == 2 && collapsedDomains.containsKey("00") && collapsedDomains.containsKey("01") + && domainsToCollapse.equals("RAN")) { + if (d.getName().equals("USP")) + d.setDomainToLayoutWd(prevDomXCordinate); + else if (d.getName().equals("VNI")) + d.setDomainToLayoutWd(prevDomXCordinate + 8); + else + d.setDomainToLayoutWd(prevDomXCordinate + 10); + } else if (domainsToCollapse.equals("RAN") && !d.getName().equals("EPC") && collapsedDomains.size() < 3) + d.setDomainToLayoutWd(prevDomXCordinate + 11); + else if (domainsToCollapse.equals("RAN") && collapsedDomains.size() == 3 + && collapsedDomains.containsKey("01") && collapsedDomains.containsKey("04")) { + if (d.getName().equals("USP")) + d.setDomainToLayoutWd(prevDomXCordinate); + else + d.setDomainToLayoutWd(prevDomXCordinate + 10); + } + + else if (collapsedDomains.containsKey("00") && collapsedDomains.size() == 3 + && collapsedDomains.containsKey("01") && collapsedDomains.containsKey("02")) { + if (d.getName().equals("VNI")) + d.setDomainToLayoutWd(prevDomXCordinate + 10); + else + d.setDomainToLayoutWd(prevDomXCordinate); + + } + + else if (collapsedDomains.containsKey("00") && collapsedDomains.size() == 3 + && collapsedDomains.containsKey("01") && collapsedDomains.containsKey("03")) { + if (d.getName().equals("VNI")) + d.setDomainToLayoutWd(prevDomXCordinate + 10); + else + d.setDomainToLayoutWd(prevDomXCordinate); + + } + + else { + d.setDomainToLayoutWd(prevDomXCordinate); + } + d.computeConatinerPositions(); + prevDomXCordinate = d.getP().getX(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + } + computeDomainPositions(); + return this; + + } + + public Layout uncollapseDomainModified(String domainToUnCollapse) { + Map currentDomainsSorted = new TreeMap<>(domainRowCol); + Map updateDomains = new TreeMap<>(); + Map collapsedDomainList = getCollapsedDomains(); + Map collapsedDomainListSorted = new TreeMap<>(collapsedDomainList); + + List domainstoUpd = new ArrayList<>(); + + int colToUnCollapse = 99; + + Domain domainToInsert = null; + + if (collapsedDomains.size() == 0) { + for (Map.Entry unindexDomain : originalDomainRowCol.entrySet()) { + Domain dm = unindexDomain.getValue(); + dm.setIndexChanged(false); + } + } + + for (Map.Entry entry : collapsedDomainListSorted.entrySet()) { + if (entry.getValue().getName().equals(domainToUnCollapse)) { + colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]); + domainToInsert = entry.getValue(); + collapsedDomainList.remove(entry.getKey()); + break; + } + } + + domainstoUpd.add(domainToInsert); + + int lastKeyCol = -1; + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + int currcol = Character.getNumericValue(entry.getKey().toCharArray()[1]); + if (currcol < colToUnCollapse) { + for (Map.Entry currDomainsEntry : currentDomainsSorted.entrySet()) { + if (currDomainsEntry.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(currDomainsEntry.getKey(), currDomainsEntry.getValue()); + lastKeyCol = Character.getNumericValue(currDomainsEntry.getKey().toCharArray()[1]); + break; + } + } + } else { + String newKey = "0" + String.valueOf(lastKeyCol + 1); + if (currcol == colToUnCollapse) { + updateDomains.put(newKey, domainToInsert); + ++lastKeyCol; + } else { + for (Map.Entry currDomainsEnt : currentDomainsSorted.entrySet()) { + if (currDomainsEnt.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(newKey, currDomainsEnt.getValue()); + domainstoUpd.add(currDomainsEnt.getValue()); + ++lastKeyCol; + break; + } + } + } + + } + } + + setNumberofColsofDomains(getNumberofColsofDomains() + 1); + setDomainRowCol(updateDomains); + setCollapsedDomains(collapsedDomainList); + + for (int i = 0; i < domainstoUpd.size(); i++) { + Domain d = domainstoUpd.get(i); + double newX = 0.0; + if (i + 1 < domainstoUpd.size()) + newX = domainstoUpd.get(i + 1).getP().getX(); + else + newX = domainstoUpd.get(i).getP().getX() + 32; + + if (d.getName().equals("Datacenter with AIC")) + newX += 2; + d.setDomainToLayoutWd(newX); + + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + + } + + computeDomainPositions(); + return this; + + } + + public Layout uncollapseDomain(String domainToCollapse) { + Map currentDomainsSorted = new TreeMap<>(domainRowCol); + Map updateDomains = new TreeMap(); + Map collapsedDomainList = getCollapsedDomains(); + Map collapsedDomainListSorted = new TreeMap(collapsedDomainList); + + List domainstoUpd = new ArrayList<>(); + for (Map.Entry entry : collapsedDomainListSorted.entrySet()) { + if (entry.getValue().getName().equals(domainToCollapse)) { + Domain domainInserted = entry.getValue(); + if (currentDomainsSorted != null) { + int colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]); + for (Map.Entry curr : currentDomainsSorted.entrySet()) { + if (Character.getNumericValue(curr.getKey().toCharArray()[1]) < colToUnCollapse) { + updateDomains.put(curr.getKey(), curr.getValue()); + } else { + updateDomains.put("0" + String.valueOf(Integer.parseInt(curr.getKey()) + 1), + curr.getValue()); + domainstoUpd.add(curr.getValue()); + } + } + } + updateDomains.put(entry.getKey(), entry.getValue()); + collapsedDomainList.remove(entry.getKey()); + break; + + } + } + setNumberofColsofDomains(getNumberofColsofDomains() + 1); + setDomainRowCol(updateDomains); + setCollapsedDomains(collapsedDomainList); + + for (int i = 0; i < domainstoUpd.size(); i++) { + Domain d = domainstoUpd.get(i); + double newX = 0.0; + if (i + 1 < domainstoUpd.size()) + newX = domainstoUpd.get(i + 1).getP().getX(); + // d.setDomainToLayoutWd(domainstoUpd.get(i+1).getP().getX()); + else + newX = domainstoUpd.get(i).getP().getX() + 38; + + d.setDomainToLayoutWd(newX); + + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + } + + computeDomainPositions(); + return this; + } + + public Layout uncollapseDomainNew(String domainToUnCollapse) { + Map currentDomainsSorted = new TreeMap(domainRowCol); + Map updateDomains = new TreeMap(); + Map collapsedDomainList = getCollapsedDomains(); + + List domainstoUpd = new ArrayList<>(); + + // nline + List collapsedDomainNewLL = getCollapsedDomainsNewList(); + + int colToUnCollapse = 99; + + Domain domainToInsert = null; + + // nline + if (collapsedDomainNewLL.isEmpty()) { + for (Map.Entry unindexDomain : originalDomainRowCol.entrySet()) { + Domain dm = unindexDomain.getValue(); + dm.setIndexChanged(false); + } + } + + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + if (entry.getValue().getName().equals(domainToUnCollapse)) { + colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]); + domainToInsert = entry.getValue(); + collapsedDomainList.remove(entry.getKey()); + // nline + collapsedDomainNewLL.remove(entry.getValue()); + break; + } + } + + domainstoUpd.add(domainToInsert); + + int lastKeyCol = -1; + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + int currcol = Character.getNumericValue(entry.getKey().toCharArray()[1]); + if (currcol < colToUnCollapse) { + for (Map.Entry currDomainsEntry : currentDomainsSorted.entrySet()) { + if (currDomainsEntry.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(currDomainsEntry.getKey(), currDomainsEntry.getValue()); + lastKeyCol = Character.getNumericValue(currDomainsEntry.getKey().toCharArray()[1]); + break; + } + } + } else { + String newKey = "0" + String.valueOf(lastKeyCol + 1); + if (currcol == colToUnCollapse) { + updateDomains.put(newKey, domainToInsert); + ++lastKeyCol; + } else { + for (Map.Entry currDomainsEnt : currentDomainsSorted.entrySet()) { + if (currDomainsEnt.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(newKey, currDomainsEnt.getValue()); + domainstoUpd.add(currDomainsEnt.getValue()); + ++lastKeyCol; + break; + } + } + } + + } + } + + setNumberofColsofDomains(getNumberofColsofDomains() + 1); + setDomainRowCol(updateDomains); + + double currDistFromLftMargin = 11.0; + for (Map.Entry cd : updateDomains.entrySet()) { + Domain d = cd.getValue(); + double accountPlus = accountForPlusSpaceBefore(d); + d.setDomainToLayoutWd(currDistFromLftMargin + accountPlus); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + currDistFromLftMargin += d.computeSize().getWidth() + 2; + + } + + // nline + updatePlusPosition(collapsedDomainNewLL, updateDomains); + + // order changed + setCollapsedDomains(collapsedDomainList); + + // nline + setCollapsedDomainsNewList(collapsedDomainNewLL); + + computeDomainPositionsModified(); + return this; + + } + + public Layout uncollapseDomainNew1(String domainToUnCollapse) { + + if (domainToUnCollapse == null || domainToUnCollapse.isEmpty()) + return null; + + Map currentDomainsSorted = new TreeMap(domainRowCol); + Map updateDomains = new TreeMap(); + Map collapsedDomainList = getCollapsedDomains(); + + List domainstoUpd = new ArrayList<>(); + + // nline + List collapsedDomainNewLL = getCollapsedDomainsNewList(); + + int colToUnCollapse = 99; + + Domain domainToInsert = null; + + // nline + if (collapsedDomainNewLL.isEmpty()) { + for (Map.Entry unindexDomain : originalDomainRowCol.entrySet()) { + Domain dm = unindexDomain.getValue(); + dm.setIndexChanged(false); + } + } + + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + if (entry.getValue().getName().equals(domainToUnCollapse)) { + colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]); + domainToInsert = entry.getValue(); + collapsedDomainList.remove(entry.getKey()); + // nline + collapsedDomainNewLL.remove(entry.getValue()); + break; + } + } + + domainstoUpd.add(domainToInsert); + + int lastKeyCol = -1; + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + int currcol = Character.getNumericValue(entry.getKey().toCharArray()[1]); + if (currcol < colToUnCollapse) { + for (Map.Entry currDomainsEntry : currentDomainsSorted.entrySet()) { + if (currDomainsEntry.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(currDomainsEntry.getKey(), currDomainsEntry.getValue()); + lastKeyCol = Character.getNumericValue(currDomainsEntry.getKey().toCharArray()[1]); + break; + } + } + } else { + String newKey = "0" + String.valueOf(lastKeyCol + 1); + if (currcol == colToUnCollapse) { + updateDomains.put(newKey, domainToInsert); + ++lastKeyCol; + } else { + for (Map.Entry currDomainsEnt : currentDomainsSorted.entrySet()) { + if (currDomainsEnt.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(newKey, currDomainsEnt.getValue()); + domainstoUpd.add(currDomainsEnt.getValue()); + ++lastKeyCol; + break; + } + } + } + + } + } + + setNumberofColsofDomains(getNumberofColsofDomains() + 1); + setDomainRowCol(updateDomains); + + double currDistFromLftM = 11.0; + + boolean isDisplayed; + for (Map.Entry orgEntry : originalDomainRowCol.entrySet()) { + isDisplayed = false; + for (Map.Entry cd : updateDomains.entrySet()) { + if (cd.getValue().getName().equals(orgEntry.getValue().getName())) { + Domain d = cd.getValue(); + d.setDomainToLayoutWd(currDistFromLftM); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + currDistFromLftM += d.computeSize().getWidth() + 1; + isDisplayed = true; + break; + } + } + + if (!isDisplayed) { + Domain myCollapsed = orgEntry.getValue(); + myCollapsed.setNewXafterColl(currDistFromLftM); + currDistFromLftM += 4; + } + } + + // order changed + setCollapsedDomains(collapsedDomainList); + + // nline + setCollapsedDomainsNewList(collapsedDomainNewLL); + + computeDomainPositionsModified(); + return this; + + } + + private void updatePlusPosition(List collapsedDNewL, Map displayedDomainMap) { + List copyCollapseList = new ArrayList<>(); + + for (Domain copyCollapse : collapsedDNewL) { + copyCollapseList.add(copyCollapse); + } + + int orgColofCollapsed = -1; + int orgColofDisplayed = -1; + int orgColofDisplayedOtherPlus = -1; + + for (Domain plus : collapsedDNewL) { + double distOfCollFrmLft = 0.0; + for (Map.Entry colCheck : originalDomainRowCol.entrySet()) { + if (colCheck.getValue().getName().equals(plus.getName())) { + orgColofCollapsed = Character.getNumericValue(colCheck.getKey().toCharArray()[1]); + break; + } + } + for (Map.Entry displayedEntry : displayedDomainMap.entrySet()) { + + for (Map.Entry colCheck1 : originalDomainRowCol.entrySet()) { + if (colCheck1.getValue().getName().equals(displayedEntry.getValue().getName())) { + orgColofDisplayed = Character.getNumericValue(colCheck1.getKey().toCharArray()[1]); + break; + } + } + if (orgColofDisplayed < orgColofCollapsed) { + distOfCollFrmLft += displayedEntry.getValue().computeSize().getWidth(); + } + + } + + for (Domain collp : copyCollapseList) { + if (!collp.getName().equals(plus.getName())) { + for (Map.Entry colCheck2 : originalDomainRowCol.entrySet()) { + if (colCheck2.getValue().getName().equals(collp.getName())) { + orgColofDisplayedOtherPlus = Character.getNumericValue(colCheck2.getKey().toCharArray()[1]); + break; + } + } + if (orgColofDisplayedOtherPlus < orgColofCollapsed) { + distOfCollFrmLft += 3.0; + } + } + } + + plus.setNewXafterColl(distOfCollFrmLft + 1.5); + + } + } + + private double accountForPlusSpaceBefore(Domain d) { + + int orgColofCollapsed = 0; + int orgColofDisplayed = 0; + double distFromLftM = 0.0; + + for (Map.Entry colCheckk : originalDomainRowCol.entrySet()) { + if (colCheckk.getValue().getName().equals(d.getName())) { + orgColofDisplayed = Character.getNumericValue(colCheckk.getKey().toCharArray()[1]); + break; + } + } + + for (Domain collapsed : getCollapsedDomainsNewList()) { + for (Map.Entry colCheck : originalDomainRowCol.entrySet()) { + if (colCheck.getValue().getName().equals(collapsed.getName())) { + orgColofCollapsed = Character.getNumericValue(colCheck.getKey().toCharArray()[1]); + break; + } + } + + if (orgColofCollapsed < orgColofDisplayed) { + distFromLftM += 2; + } + } + return distFromLftM; + + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/NameValueId.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/NameValueId.java new file mode 100644 index 00000000..eb1ba450 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/NameValueId.java @@ -0,0 +1,105 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import java.io.Serializable; + +public class NameValueId implements Serializable { + + private static final long serialVersionUID = 1L; + private String lab; + private String val; + + public NameValueId() { + // No-arg constructor + } + + public NameValueId(String value, String label) { + setVal(value); + setLab(label); + } + + public String getLab() { + return lab; + } + + public String getVal() { + return val; + } + + public void setLab(String label) { + this.lab = label; + } + + public void setVal(String value) { + this.val = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null) { + return false; + } + + if (!(o instanceof NameValueId)) { + return false; + } + + final NameValueId nameValueId = (NameValueId) o; + + if (!getVal().equals(nameValueId.getVal())) { + return false; + } + + if (!getLab().equals(nameValueId.getLab())) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + return getVal().hashCode(); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Position.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Position.java new file mode 100644 index 00000000..e19da235 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Position.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +public class Position { + double x; + double y; + + public double getX() { + return x; + } + + public void setX(double x) { + this.x = x; + } + + public double getY() { + return y; + } + + public void setY(double y) { + this.y = y; + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Size.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Size.java new file mode 100644 index 00000000..d4c7942b --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Size.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +public class Size { + private double width; + private double height; + + public double getWidth() { + return width; + } + + public void setWidth(double width) { + this.width = width; + } + + public double getHeight() { + return height; + } + + public void setHeight(double height) { + this.height = height; + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AppTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AppTest.java new file mode 100644 index 00000000..d54a314b --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AppTest.java @@ -0,0 +1,124 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.App; + +public class AppTest { + + public App mockApp() { + App app = new App(); + app.setName("testApp"); + app.setImageUrl("testmageUrl"); + app.setDescription("testdescription"); + app.setNotes("testNotes"); + app.setUrl("testUrl"); + app.setAlternateUrl("testAlternateUrl"); + app.setRestEndpoint("testRestEndpoint"); + app.setMlAppName("testMlAppName"); + app.setMlAppAdminId("testMlAppAdminId"); + app.setMotsId("testMotsId"); + app.setAppPassword("testAppPassword"); + app.setOpen("testOpen"); + app.setEnabled("testEnabled"); + app.setThumbnail(null); + app.setUsername("testUsername"); + app.setUebKey("testUebKey"); + app.setUebSecret("testUebSecret"); + app.setUebTopicName("testuebTopicName"); + return app; + } + + @Test + public void appTest() + { + App mockApp = mockApp(); + App app = new App(); + app.setName("testApp"); + app.setImageUrl("testmageUrl"); + app.setDescription("testdescription"); + app.setNotes("testNotes"); + app.setUrl("testUrl"); + app.setAlternateUrl("testAlternateUrl"); + app.setRestEndpoint("testRestEndpoint"); + app.setMlAppName("testMlAppName"); + app.setMlAppAdminId("testMlAppAdminId"); + app.setMotsId("testMotsId"); + app.setAppPassword("testAppPassword"); + app.setOpen("testOpen"); + app.setEnabled("testEnabled"); + app.setThumbnail(null); + app.setUsername("testUsername"); + app.setUebKey("testUebKey"); + app.setUebSecret("testUebSecret"); + app.setUebTopicName("testuebTopicName"); + + assertEquals(app.getName(), mockApp.getName()); + assertEquals(app.getImageUrl(), mockApp.getImageUrl()); + assertEquals(app.getDescription(), mockApp.getDescription()); + assertEquals(app.getNotes(), mockApp.getNotes()); + assertEquals(app.getUrl(), mockApp.getUrl()); + assertEquals(app.getAlternateUrl(), mockApp.getAlternateUrl()); + assertEquals(app.getRestEndpoint(), mockApp.getRestEndpoint()); + assertEquals(app.getMlAppName(), mockApp.getMlAppName()); + assertEquals(app.getMlAppAdminId(), mockApp.getMlAppAdminId()); + assertEquals(app.getMotsId(), mockApp.getMotsId()); + assertEquals(app.getOpen(), mockApp.getOpen()); + assertEquals(app.getEnabled(), mockApp.getEnabled()); + assertEquals(app.getThumbnail(), mockApp.getThumbnail()); + assertEquals(app.getUsername(), mockApp.getUsername()); + assertEquals(app.getUebKey(), mockApp.getUebKey()); + assertEquals(app.getUebSecret(), mockApp.getUebSecret()); + assertEquals(app.getUebTopicName(), mockApp.getUebTopicName()); + assertEquals(app.getAppPassword(), mockApp.getAppPassword()); + + } + + @Test + public void compareToTest() + { + App app = new App(); + app.setId((long) 1); + int result = app.compareTo(app); + assertEquals(result, 0); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java new file mode 100644 index 00000000..d293797c --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java @@ -0,0 +1,74 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.AuditLog; + +public class AuditLogTest { + + public AuditLog mockAuditLog() + { + AuditLog auditLog = new AuditLog(); + auditLog.setActivityCode("activityCode"); + auditLog.setAffectedRecordId("affectedRecordId"); + auditLog.setComments("comments"); + auditLog.setAuditDate(null); + auditLog.setUserId((long) 1); + return auditLog; + } + + @Test + public void auditLogTest() + { + AuditLog mockAuditLog = mockAuditLog(); + AuditLog auditLog = new AuditLog(); + auditLog.setActivityCode("activityCode"); + auditLog.setAffectedRecordId("affectedRecordId"); + auditLog.setComments("comments"); + auditLog.setAuditDate(null); + auditLog.setUserId((long) 1); + assertEquals(auditLog.getActivityCode(), mockAuditLog.getActivityCode()); + assertEquals(auditLog.getAffectedRecordId(), mockAuditLog.getAffectedRecordId()); + assertEquals(auditLog.getComments(), mockAuditLog.getComments()); + assertEquals(auditLog.getAuditDate(), mockAuditLog.getAuditDate()); + assertEquals(auditLog.getUserId(), mockAuditLog.getUserId()); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java new file mode 100644 index 00000000..85250421 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java @@ -0,0 +1,102 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.BroadcastMessage; + +public class BroadcastMessageTest { + + public BroadcastMessage mockBroadcastMessage() { + BroadcastMessage broadcastMessage = new BroadcastMessage(); + broadcastMessage.setMessageText("messageText"); + broadcastMessage.setLocationId(1); + broadcastMessage.setStartDate(null); + broadcastMessage.setEndDate(null); + broadcastMessage.setSortOrder(1); + broadcastMessage.setActive(false); + broadcastMessage.setSiteCd("siteCd"); + return broadcastMessage; + } + + @Test + public void broadcastMessageTest() { + BroadcastMessage mockBroadcastMessage = mockBroadcastMessage(); + BroadcastMessage broadcastMessage = new BroadcastMessage(); + broadcastMessage.setMessageText("messageText"); + broadcastMessage.setLocationId(1); + broadcastMessage.setStartDate(null); + broadcastMessage.setEndDate(null); + broadcastMessage.setSortOrder(1); + broadcastMessage.setActive(false); + broadcastMessage.setSiteCd("siteCd"); + assertEquals(broadcastMessage.getMessageText(), mockBroadcastMessage.getMessageText()); + assertEquals(broadcastMessage.getLocationId(), mockBroadcastMessage.getLocationId()); + assertEquals(broadcastMessage.getStartDate(), mockBroadcastMessage.getStartDate()); + assertEquals(broadcastMessage.getEndDate(), mockBroadcastMessage.getEndDate()); + assertEquals(broadcastMessage.getSortOrder(), mockBroadcastMessage.getSortOrder()); + assertEquals(broadcastMessage.getActive(), mockBroadcastMessage.getActive()); + assertEquals(broadcastMessage.getSiteCd(), mockBroadcastMessage.getSiteCd()); + } + + @Test + public void compareToTest() + { + BroadcastMessage broadcastMessage = new BroadcastMessage(); + broadcastMessage.setLocationId(1); + broadcastMessage.setSortOrder(1); + broadcastMessage.setId((long) 2); + int result = broadcastMessage.compareTo(broadcastMessage); + assertEquals(result, 0); + } + + @Test + public void compareToDiffTest() + { + BroadcastMessage broadcastMessage = new BroadcastMessage(); + BroadcastMessage broadcastMessage1 = new BroadcastMessage(); + broadcastMessage.setLocationId(0); + broadcastMessage1.setLocationId(1); + broadcastMessage.setSortOrder(1); + broadcastMessage.setId((long) 2); + int result = broadcastMessage1.compareTo(broadcastMessage); + assertEquals(result, 1); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java new file mode 100644 index 00000000..cc66d694 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java @@ -0,0 +1,99 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.FnMenu; + +public class FnMenuTest { + + public FnMenu mockFnMenuTest() { + FnMenu fnMenu = new FnMenu(); + fnMenu.setMenuId(1); + fnMenu.setLabel("label"); + fnMenu.setParentId(1); + fnMenu.setAction("action"); + fnMenu.setFunctionCd("functionCd"); + fnMenu.setSortOrder(1); + fnMenu.setServlet("servlet"); + fnMenu.setQueryString("queryString"); + fnMenu.setExternalUrl("externalUrl"); + fnMenu.setTarget("target"); + fnMenu.setActive("active"); + fnMenu.setSeparator("separator"); + fnMenu.setImageSrc("imageSrc"); + fnMenu.setMenuSetCode("menuSetCode"); + return fnMenu; + } + + @Test + public void fnMenuTest() { + FnMenu mockFnMenu = mockFnMenuTest(); + FnMenu fnMenu = new FnMenu(); + fnMenu.setMenuId(1); + fnMenu.setLabel("label"); + fnMenu.setParentId(1); + fnMenu.setAction("action"); + fnMenu.setFunctionCd("functionCd"); + fnMenu.setSortOrder(1); + fnMenu.setServlet("servlet"); + fnMenu.setQueryString("queryString"); + fnMenu.setExternalUrl("externalUrl"); + fnMenu.setTarget("target"); + fnMenu.setActive("active"); + fnMenu.setSeparator("separator"); + fnMenu.setImageSrc("imageSrc"); + fnMenu.setMenuSetCode("menuSetCode"); + assertEquals(fnMenu.getMenuId(), mockFnMenu.getMenuId()); + assertEquals(fnMenu.getLabel(), mockFnMenu.getLabel()); + assertEquals(fnMenu.getParentId(), mockFnMenu.getParentId()); + assertEquals(fnMenu.getAction(), mockFnMenu.getAction()); + assertEquals(fnMenu.getSortOrder(), mockFnMenu.getSortOrder()); + assertEquals(fnMenu.getServlet(), mockFnMenu.getServlet()); + assertEquals(fnMenu.getQueryString(), mockFnMenu.getQueryString()); + assertEquals(fnMenu.getExternalUrl(), mockFnMenu.getExternalUrl()); + assertEquals(fnMenu.getTarget(), mockFnMenu.getTarget()); + assertEquals(fnMenu.getActive(), mockFnMenu.getActive()); + assertEquals(fnMenu.getSeparator(), mockFnMenu.getSeparator()); + assertEquals(fnMenu.getImageSrc(), mockFnMenu.getImageSrc()); + assertEquals(fnMenu.getMenuSetCode(), mockFnMenu.getMenuSetCode()); + assertEquals(fnMenu.getFunctionCd(), mockFnMenu.getFunctionCd()); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java new file mode 100644 index 00000000..b6f625f2 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java @@ -0,0 +1,84 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.LoginBean; + +public class LoginBeanTest { + + public LoginBean mockLoginBean() { + LoginBean loginBean = new LoginBean(); + loginBean.setLoginId("loginId"); + loginBean.setLoginPwd("loginPwd"); + loginBean.setHrid("hrid"); + loginBean.setOrgUserId("orgUserId"); + loginBean.setSiteAccess("siteAccess"); + loginBean.setLoginErrorMessage("loginErrorMessage"); + loginBean.setUser(null); + loginBean.setMenu(null); + loginBean.setBusinessDirectMenu(null); + return loginBean; + } + + @Test + public void loginBeanTest() { + LoginBean mockLoginBean = mockLoginBean(); + LoginBean loginBean = new LoginBean(); + loginBean.setLoginId("loginId"); + loginBean.setLoginPwd("loginPwd"); + loginBean.setHrid("hrid"); + loginBean.setOrgUserId("orgUserId"); + loginBean.setSiteAccess("siteAccess"); + loginBean.setLoginErrorMessage("loginErrorMessage"); + loginBean.setUser(null); + loginBean.setMenu(null); + loginBean.setBusinessDirectMenu(null); + assertEquals(loginBean.getLoginId(), mockLoginBean.getLoginId()); + assertEquals(loginBean.getLoginPwd(), mockLoginBean.getLoginPwd()); + assertEquals(loginBean.getHrid(), mockLoginBean.getHrid()); + assertEquals(loginBean.getOrgUserId(), mockLoginBean.getOrgUserId()); + assertEquals(loginBean.getSiteAccess(), mockLoginBean.getSiteAccess()); + assertEquals(loginBean.getLoginErrorMessage(), mockLoginBean.getLoginErrorMessage()); + assertEquals(loginBean.getUser(), mockLoginBean.getUser()); + assertEquals(loginBean.getMenu(), mockLoginBean.getMenu()); + assertEquals(loginBean.getBusinessDirectMenu(), mockLoginBean.getBusinessDirectMenu()); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java new file mode 100644 index 00000000..60e01d04 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java @@ -0,0 +1,77 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.Lookup; +import org.onap.portalsdk.core.domain.support.NameValueId; + +public class LookupTest { + + public Lookup mockLookUp() { + Lookup lookup = new Lookup(); + NameValueId nameValueId = new NameValueId(); + nameValueId.setLab("label"); + nameValueId.setVal("value"); + lookup.setLabel(nameValueId.getLab()); + lookup.setValue(nameValueId.getVal()); + lookup.setNameValueId(nameValueId); + return lookup; + } + + @Test + public void lookupTest() { + Lookup lookup = mockLookUp(); + Lookup lookup1 = new Lookup("label", "value"); + assertEquals(lookup.getLabel(), "label"); + assertEquals(lookup.getValue(), "value"); + assertEquals(lookup, lookup1); + assertNotNull(lookup.hashCode()); + assertTrue(lookup.equals(lookup1)); + Lookup lookup2 = null; + assertFalse(lookup.equals(lookup2)); + NameValueId nameValueId = new NameValueId(); + assertFalse(lookup.equals(nameValueId)); + assertEquals(lookup.getNameValueId().getLab(), lookup1.getNameValueId().getLab()); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java new file mode 100644 index 00000000..92df23a3 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java @@ -0,0 +1,78 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.LuCountry; + +public class LuCountryTest { + + public LuCountry mockLuCountry() { + LuCountry luCountry = new LuCountry(); + luCountry.setAbbr("abbr"); + luCountry.setCountry("country"); + luCountry.setFullName("fullName"); + luCountry.setWebphoneCountryLabel("webphoneCountryLabel"); + return luCountry; + } + + @Test + public void luCountryTest() { + LuCountry mockluCountry = mockLuCountry(); + LuCountry luCountry = new LuCountry(); + luCountry.setAbbr("abbr"); + luCountry.setCountry("country"); + luCountry.setFullName("fullName"); + luCountry.setWebphoneCountryLabel("webphoneCountryLabel"); + assertEquals(luCountry.getAbbr(), mockluCountry.getAbbr()); + assertEquals(luCountry.getCountry(), mockluCountry.getCountry()); + assertEquals(luCountry.getFullName(), mockluCountry.getFullName()); + assertEquals(luCountry.getWebphoneCountryLabel(), mockluCountry.getWebphoneCountryLabel()); + } + + @Test + public void compareToTest() + { + LuCountry mockluCountry = mockLuCountry(); + LuCountry luCountry = new LuCountry(); + luCountry.setCountry("test"); + assertEquals(mockluCountry.compareTo(luCountry),-17); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java new file mode 100644 index 00000000..011a076d --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java @@ -0,0 +1,66 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.LuState; + +public class LuStateTest { + + public LuState mockLuState() { + LuState luState = new LuState(); + luState.setAbbr("abbr"); + luState.setState("state"); + return luState; + } + + @Test + public void luStateTest() { + LuState mockluState = mockLuState(); + LuState luState = new LuState(); + luState.setAbbr("abbr"); + luState.setState("state"); + assertEquals(mockluState.getAbbr(), luState.getAbbr()); + assertEquals(mockluState.getState(), luState.getState()); + LuState luState1 = new LuState(); + luState1.setState("stateTest"); + assertEquals(luState.compareTo(luState1), -4); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java new file mode 100644 index 00000000..a36bf0ac --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.LuTimeZone; + +public class LuTimeZoneTest { + + public LuTimeZone mockLuTimeZone() { + LuTimeZone luTimeZone = new LuTimeZone(); + luTimeZone.setName("name"); + luTimeZone.setTimezoneId((long) 1); + luTimeZone.setValue("value"); + return luTimeZone; + } + + @Test + public void luTimeZone() + { + LuTimeZone luTimeZone = mockLuTimeZone(); + LuTimeZone luTimeZone1 = mockLuTimeZone(); + assertEquals(luTimeZone.getName(), luTimeZone1.getName()); + assertEquals(luTimeZone.getValue(), luTimeZone1.getValue()); + assertEquals(luTimeZone.getTimezoneId(), luTimeZone1.getTimezoneId()); + assertEquals(luTimeZone.getId(), null); + luTimeZone.setId((long) 1); + luTimeZone1.setId((long) 2); + assertTrue(luTimeZone.compareTo(luTimeZone1) == -1); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java new file mode 100644 index 00000000..878d3e69 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java @@ -0,0 +1,73 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.MenuData; + +public class MenuDataTest { + + public MenuData mockMenuTest() { + MenuData menuData = new MenuData(); + menuData.setParentMenu(null); + menuData.setChildMenus(null); + return menuData; + } + + @Test + public void menuDataTest() { + MenuData menuData = mockMenuTest(); + assertNull(menuData.getParentMenu()); + assertNull(menuData.getChildMenus()); + assertEquals(menuData.getActiveAsString(), "false"); + assertEquals(menuData.getParentIdAsString(), "null"); + assertEquals(menuData.getSeparatorAsString(), "false"); + MenuData menuData1 = mockMenuTest(); + menuData1.setSortOrder(null); + assertTrue(menuData1.compareTo(menuData) == 1); + menuData1.setSortOrder((short) 1); + menuData.setSortOrder(null); + assertTrue(menuData1.compareTo(menuData) == 1); + menuData.setSortOrder((short) 1); + assertTrue(menuData1.compareTo(menuData) == 1); + menuData.setSortOrder((short) 2); + assertTrue(menuData1.compareTo(menuData) == -1); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java new file mode 100644 index 00000000..ab1f62a6 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java @@ -0,0 +1,85 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.Menu; + +public class MenuTest { + + public Menu mockMenu() { + Menu menu = new Menu(); + menu.setMenuLevel("menuLevel"); + menu.setLabel("label"); + menu.setParentId((long) 1); + menu.setAction("action"); + menu.setFunctionCd("functionCd"); + menu.setSortOrder((short) 1); + menu.setServlet("servlet"); + menu.setQueryString("queryString"); + menu.setExternalUrl("externalUrl"); + menu.setTarget("target"); + menu.setActive(false); + menu.setMenuSetCode("menuSetCode"); + menu.setSeparator(false); + menu.setImageSrc("imageSrc"); + return menu; + } + + @Test + public void menuTest() { + Menu menu = mockMenu(); + Menu menu1 = mockMenu(); + assertEquals(menu.getMenuLevel(), menu1.getMenuLevel()); + assertEquals(menu.getLabel(), menu1.getLabel()); + assertEquals(menu.getParentId(), menu1.getParentId()); + assertEquals(menu.getAction(), menu1.getAction()); + assertEquals(menu.getFunctionCd(), menu1.getFunctionCd()); + assertEquals(menu.getSortOrder(), menu1.getSortOrder()); + assertEquals(menu.getServlet(), menu1.getServlet()); + assertEquals(menu.getQueryString(), menu1.getQueryString()); + assertEquals(menu.getExternalUrl(), menu1.getExternalUrl()); + assertEquals(menu.getTarget(), menu1.getTarget()); + assertEquals(menu.isActive(), menu1.isActive()); + assertEquals(menu.getMenuSetCode(), menu1.getMenuSetCode()); + assertEquals(menu.isSeparator(), menu1.isSeparator()); + assertEquals(menu.getImageSrc(), menu1.getImageSrc()); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java new file mode 100644 index 00000000..7a85a839 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java @@ -0,0 +1,71 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.Profile; + +public class ProfileTest { + + public Profile mockProfile() { + Profile profile = new Profile(); + profile.setId((long) 1); + profile.setFirst_name("first_name"); + profile.setLast_name("last_name"); + profile.setEmail("email"); + profile.setOrgManagerUserId("orgManagerUserId"); + profile.setActive_yn("active_yn"); + profile.setOrgUserId("orgUserId"); + return profile; + } + + @Test + public void profileTest() { + Profile profile = mockProfile(); + Profile profile1 = mockProfile(); + assertEquals(profile.getId(), profile1.getId()); + assertEquals(profile.getFirst_name(), profile1.getFirst_name()); + assertEquals(profile.getLast_name(), profile1.getLast_name()); + assertEquals(profile.getEmail(), profile1.getEmail()); + assertEquals(profile.getOrgManagerUserId(), profile1.getOrgManagerUserId()); + assertEquals(profile.getActive_yn(), profile1.getActive_yn()); + assertEquals(profile.getOrgUserId(), profile1.getOrgUserId()); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java new file mode 100644 index 00000000..bb29443f --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java @@ -0,0 +1,70 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.RoleFunction; + +public class RoleFunctionTest { + + public RoleFunction mockRoleFunction() { + RoleFunction roleFunction = new RoleFunction(); + roleFunction.setCode("code"); + roleFunction.setName("name"); + return roleFunction; + } + + @Test + public void rolefunctionTest() { + RoleFunction roleFunction = mockRoleFunction(); + RoleFunction roleFunction1 = mockRoleFunction(); + assertEquals(roleFunction.getCode(), roleFunction1.getCode()); + assertEquals(roleFunction.getName(), roleFunction1.getName()); + assertEquals(roleFunction.getEditUrl(), roleFunction1.getEditUrl()); + roleFunction1.setName(null); + assertTrue(roleFunction.compareTo(roleFunction1) == 1); + RoleFunction roleFunction2 = mockRoleFunction(); + roleFunction2.setName(null); + RoleFunction roleFunction3 = mockRoleFunction(); + assertTrue(roleFunction2.compareTo(roleFunction3) == 1); + assertTrue(roleFunction.compareTo(roleFunction3) == 0); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java new file mode 100644 index 00000000..dd1e1b1f --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java @@ -0,0 +1,113 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Set; +import java.util.TreeSet; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.RoleFunction; + +public class RoleTest { + + public Role mockRole() { + Role role = new Role(); + role.setName("test"); + role.setActive(false); + role.setPriority(1); + Set roleFunctions = new TreeSet<>(); + RoleFunction roleFunction = new RoleFunction(); + roleFunction.setCode("code"); + roleFunction.setName("name"); + roleFunctions.add(roleFunction); + role.setRoleFunctions(roleFunctions); + Set roles = new TreeSet<>(); + Role newrole = new Role(); + role.setChildRoles(roles); + role.setParentRoles(roles); + return role; + } + + @Test + public void roleTest() { + Role role = mockRole(); + Role role1 = mockRole(); + assertEquals(role.getName(), role1.getName()); + assertEquals(role.getActive(), role1.getActive()); + assertEquals(role.getRoleFunctions().size(), role1.getRoleFunctions().size()); + assertEquals(role.getParentRoles(), role1.getParentRoles()); + assertEquals(role.getChildRoles(), role1.getChildRoles()); + assertEquals(role.getPriority(), role1.getPriority()); + RoleFunction roleFunction = new RoleFunction(); + roleFunction.setCode("code1"); + roleFunction.setName("name1"); + role.addRoleFunction(roleFunction); + Role parentrole = new Role(); + parentrole.setId((long) 1); + role.addParentRole(parentrole); + Role childrole = new Role(); + childrole.setId((long) 2); + role.addChildRole(childrole); + assertEquals(role.getToggleActiveAltText(), "Click to Activate Role"); + assertEquals(role.getToggleActiveImage(), "/static/fusion/images/inactive.png"); + role.removeChildRole((long) 2); + role.removeParentRole((long) 1); + role.removeRoleFunction("code1"); + role.setActive(true); + assertEquals(role.getToggleActiveImage(), "/static/fusion/images/active.png"); + assertEquals(role.getToggleActiveAltText(), "Click to Deactivate Role"); + assertEquals(role.getEditUrl(),"/role.htm?role_id=null"); + } + + @Test + public void compareToTest() { + Role role = mockRole(); + role.setName(null); + Role role1 = mockRole(); + assertTrue(role.compareTo(role1) == 1); + role.setName("test"); + role1.setName(null); + assertTrue(role.compareTo(role1) == 1); + role1.setName("test"); + assertTrue(role.compareTo(role1) == 0); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java new file mode 100644 index 00000000..a1540f2c --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java @@ -0,0 +1,79 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.UrlsAccessibleKey; +import org.onap.portalsdk.core.domain.User; + +public class UrlsAccessibleKeyTest { + + public UrlsAccessibleKey mockUrlsAccessibleKey() { + UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey(); + urlsAccessibleKey.setUrl("url"); + urlsAccessibleKey.setFunctionCd("functionCd"); + return urlsAccessibleKey; + } + + @Test + public void urlsAccessibleKeyTest() { + UrlsAccessibleKey mockurlsAccessibleKey = mockUrlsAccessibleKey(); + UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey("url", "functionCd"); + assertEquals(urlsAccessibleKey.getUrl(), mockurlsAccessibleKey.getUrl()); + assertEquals(urlsAccessibleKey.getFunctionCd(), mockurlsAccessibleKey.getFunctionCd()); + } + + @Test + public void equalsandHashCodetest() { + UrlsAccessibleKey mockurlsAccessibleKey = mockUrlsAccessibleKey(); + UrlsAccessibleKey mockurlsAccessibleKey1 = mockUrlsAccessibleKey(); + UrlsAccessibleKey urlsAccessibleKey = mockurlsAccessibleKey; + assertTrue(mockurlsAccessibleKey.equals(urlsAccessibleKey)); + assertFalse(mockurlsAccessibleKey.equals(null)); + User user = new User(); + assertFalse(mockurlsAccessibleKey.equals(user)); + assertTrue(mockurlsAccessibleKey.equals(mockurlsAccessibleKey1)); + UrlsAccessibleKey mockurlsAccessibleKey2 = new UrlsAccessibleKey("test", "test"); + assertFalse(mockurlsAccessibleKey2.equals(mockurlsAccessibleKey1)); + UrlsAccessibleKey mockurlsAccessibleKey3 = new UrlsAccessibleKey("url", "test"); + assertFalse(mockurlsAccessibleKey3.equals(mockurlsAccessibleKey1)); + assertNotNull(mockurlsAccessibleKey2.hashCode()); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java new file mode 100644 index 00000000..dfe76e1f --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java @@ -0,0 +1,78 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.UrlsAccessible; +import org.onap.portalsdk.core.domain.UrlsAccessibleKey; +import org.onap.portalsdk.core.domain.User; + +public class UrlsAccessibleTest { + + public UrlsAccessible mockUrlsAccessible() { + UrlsAccessible urlsAccessible = new UrlsAccessible(); + UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey(); + urlsAccessibleKey.setUrl("url"); + urlsAccessibleKey.setFunctionCd("functionCd"); + urlsAccessible.setUrlsAccessibleKey(urlsAccessibleKey); + return urlsAccessible; + } + + @Test + public void urlsAccessibleTest() { + UrlsAccessible urlsAccessible = mockUrlsAccessible(); + UrlsAccessible urlsAccessible1 = new UrlsAccessible("url", "functionCd"); + assertEquals(urlsAccessible.getUrlsAccessibleKey(), urlsAccessible1.getUrlsAccessibleKey()); + assertEquals(urlsAccessible.getUrl(), urlsAccessible1.getUrl()); + assertEquals(urlsAccessible.getFunctionCd(), urlsAccessible1.getFunctionCd()); + assertNotNull(urlsAccessible.hashCode()); + } + + @Test + public void equlasTest() { + UrlsAccessible urlsAccessible = mockUrlsAccessible(); + UrlsAccessible urlsAccessible1 = mockUrlsAccessible(); + User user = new User(); + assertFalse(urlsAccessible.equals(null)); + assertFalse(urlsAccessible.equals(user)); + assertTrue(urlsAccessible.equals(urlsAccessible1)); + + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java new file mode 100644 index 00000000..00b05bed --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java @@ -0,0 +1,91 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.App; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.UserAppId; + +public class UserAppIdTest { + + + public UserAppId mockUserAppId() { + UserAppId userAppId = new UserAppId(); + Role role = new Role(); + role.setId((long) 1); + App app = new App(); + app.setId((long) 1); + userAppId.setUserId((long) 1); + userAppId.setApp(app); + userAppId.setRole(role); + return userAppId; + } + + @Test + public void userAppIdTest() { + UserAppId userAppId = mockUserAppId(); + UserAppId userAppId1 = mockUserAppId(); + User user = new User(); + assertEquals(userAppId.getUserId(), userAppId1.getUserId()); + assertEquals(userAppId.getApp().getId(), userAppId1.getApp().getId()); + assertEquals(userAppId.getRole().getId(), userAppId1.getRole().getId()); + assertTrue(userAppId.equals(userAppId1)); + assertFalse(userAppId1.equals(user)); + assertFalse(userAppId1.equals(null)); + UserAppId userAppId2 = userAppId1; + assertTrue(userAppId2.equals(userAppId1)); + } + + @Test + public void hashCodeTest() { + UserAppId userAppId = mockUserAppId(); + assertNotNull(userAppId.hashCode()); + userAppId.setUserId(null); + userAppId.getApp().setId(null); + userAppId.getRole().setId(null); + assertNotNull(userAppId.hashCode()); + + + } + + +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java new file mode 100644 index 00000000..2433d93b --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java @@ -0,0 +1,93 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.App; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.UserApp; + +public class UserAppTest { + + public UserApp mockUserApp() { + UserApp userapp = new UserApp(); + Role role = new Role(); + role.setId((long) 1); + userapp.setRole(role); + App app = new App(); + app.setId((long) 1); + userapp.setApp(app); + userapp.setUserId((long) 1); + userapp.setPriority(null); + return userapp; + } + + @Test + public void userAppTest() { + UserApp userapp1 = mockUserApp(); + UserApp userapp2 = mockUserApp(); + userapp2.setUserId((long) 2); + assertNull(userapp1.getPriority()); + assertEquals(userapp2.compareTo(userapp1), 1); + assertNotNull(userapp1.hashCode()); + userapp2.setUserId((long) 1); + assertTrue(userapp1.equals(userapp2)); + User user = new User(); + assertFalse(userapp2.equals(user)); + assertFalse(user.equals(null)); + UserApp userapp3 = userapp2; + assertTrue(userapp3.equals(userapp2)); + } + + + @Test + public void hashCodeTest() { + UserApp userapp1 = mockUserApp(); + assertNotNull(userapp1.hashCode()); + userapp1.setUserId(null); + userapp1.getApp().setId(null); + userapp1.getRole().setId(null); + userapp1.setPriority(null); + assertNotNull(userapp1.hashCode()); + + + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserTest.java new file mode 100644 index 00000000..598ee900 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserTest.java @@ -0,0 +1,220 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain; + +import static org.junit.Assert.*; + +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.App; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.UserApp; + +public class UserTest { + + public User mockUser() + { + User user = new User(); + user.setOrgId((long) 1); + user.setManagerId((long) 12); + user.setFirstName("firstName"); + user.setMiddleInitial("middleInitial"); + user.setLastName("lastName"); + user.setPhone("phone"); + user.setFax("fax"); + user.setCellular("cellular"); + user.setEmail("email"); + user.setAddressId((long) 1); + user.setAlertMethodCd("alertMethodCd"); + user.setHrid("hrid"); + user.setOrgUserId("orgUserId"); + user.setOrgCode("orgCode"); + user.setAddress1("address1"); + user.setAddress2("address2"); + user.setCity("city"); + user.setState("state"); + user.setZipCode("zipCode"); + user.setCountry("country"); + user.setOrgManagerUserId("orgManagerUserId"); + user.setLocationClli("locationClli"); + user.setBusinessCountryCode("businessCountryCode"); + user.setBusinessCountryName("businessCountryName"); + user.setBusinessUnit("businessUnit"); + user.setBusinessUnitName("businessUnitName"); + user.setDepartment("department"); + user.setDepartmentName("departmentName"); + user.setCompanyCode("companyCode"); + user.setCompany("company"); + user.setZipCodeSuffix("zipCodeSuffix"); + user.setJobTitle("jobTitle"); + user.setCommandChain("commandChain"); + user.setSiloStatus("siloStatus"); + user.setCostCenter("costCenter"); + user.setFinancialLocCode("financialLocCode"); + user.setLoginId("loginId"); + user.setLoginPwd("loginPwd"); + user.setLastLoginDate(null); + user.setActive(false); + user.setInternal(false); + user.setSelectedProfileId((long) 1); + user.setTimeZoneId((long) 1); + user.setChatId("chatId"); + user.setUserApps(null); + user.setPseudoRoles(null); + user.setOnline(false); + return user; + } + + @Test + public void userTest() + { + User mockUser = mockUser(); + User user = mockUser(); + assertEquals(user.getOrgId(), mockUser.getOrgId()); + assertEquals(user.getManagerId(), mockUser.getManagerId()); + assertEquals(user.getFirstName(), mockUser.getFirstName()); + assertEquals(user.getMiddleInitial(), mockUser.getMiddleInitial()); + assertEquals(user.getLastName(), mockUser.getLastName()); + assertEquals(user.getPhone(), mockUser.getPhone()); + assertEquals(user.getFax(), mockUser.getFax()); + assertEquals(user.getCellular(), mockUser.getCellular()); + assertEquals(user.getEmail(), mockUser.getEmail()); + assertEquals(user.getAddressId(), mockUser.getAddressId()); + assertEquals(user.getAlertMethodCd(), mockUser.getAlertMethodCd()); + assertEquals(user.getHrid(), mockUser.getHrid()); + assertEquals(user.getOrgUserId(), mockUser.getOrgUserId()); + assertEquals(user.getOrgCode(), mockUser.getOrgCode()); + assertEquals(user.getAddress1(), mockUser.getAddress1()); + assertEquals(user.getAddress2(), mockUser.getAddress2()); + assertEquals(user.getCity(), mockUser.getCity()); + assertEquals(user.getState(), mockUser.getState()); + assertEquals(user.getZipCode(), mockUser.getZipCode()); + assertEquals(user.getCountry(), mockUser.getCountry()); + assertEquals(user.getOrgManagerUserId(), mockUser.getOrgManagerUserId()); + assertEquals(user.getLocationClli(), mockUser.getLocationClli()); + assertEquals(user.getBusinessCountryCode(), mockUser.getBusinessCountryCode()); + assertEquals(user.getBusinessCountryName(), mockUser.getBusinessCountryName()); + assertEquals(user.getBusinessUnit(), mockUser.getBusinessUnit()); + assertEquals(user.getBusinessUnitName(), mockUser.getBusinessUnitName()); + assertEquals(user.getDepartment(), mockUser.getDepartment()); + assertEquals(user.getDepartmentName(), mockUser.getDepartmentName()); + assertEquals(user.getCompanyCode(), mockUser.getCompanyCode()); + assertEquals(user.getCompany(), mockUser.getCompany()); + assertEquals(user.getZipCodeSuffix(), mockUser.getZipCodeSuffix()); + assertEquals(user.getJobTitle(), mockUser.getJobTitle()); + assertEquals(user.getCommandChain(), mockUser.getCommandChain()); + assertEquals(user.getSiloStatus(), mockUser.getSiloStatus()); + assertEquals(user.getCostCenter(), mockUser.getCostCenter()); + assertEquals(user.getFinancialLocCode(), mockUser.getFinancialLocCode()); + assertEquals(user.getLoginId(), mockUser.getLoginId()); + assertEquals(user.getLoginPwd(), mockUser.getLoginPwd()); + assertEquals(user.getLastLoginDate(), mockUser.getLastLoginDate()); + assertEquals(user.getActive(), mockUser.getActive()); + assertEquals(user.getInternal(), mockUser.getInternal()); + assertEquals(user.getSelectedProfileId(), mockUser.getSelectedProfileId()); + assertEquals(user.getTimeZoneId(), mockUser.getTimeZoneId()); + assertEquals(user.getChatId(), mockUser.getChatId()); + assertEquals(user.getUserApps(), mockUser.getUserApps()); + assertEquals(user.getPseudoRoles(), mockUser.getPseudoRoles()); + assertEquals(user.getFullName(), mockUser.getFullName()); + assertFalse(user.isOnline()); + + + } + + @Test + public void addAppRolesIfRolesNullTest() + { + User user = mockUser(); + Set userApps = new TreeSet(); + UserApp userapp = new UserApp(); + userApps.add(userapp); + user.setUserApps(userApps); + user.setUserApps(userApps); + App app = new App(); + user.addAppRoles(app, null); + } + + @Test + public void addAppRolesTest() + { + User user = mockUser(); + App app = new App(); + + SortedSet roles = new TreeSet<>(); + Role role = new Role(); + role.setId((long) 1); + role.setName("test"); + roles.add(role); + user.addAppRoles(app, roles); + } + + @SuppressWarnings("unchecked") + @Test + public void addandRemoveRoleTest() + { + User user = mockUser(); + Set userApps = new TreeSet(); + UserApp userapp = new UserApp(); + SortedSet roles = new TreeSet(); + Role role = new Role(); + role.setId((long) 1); + roles.add(role); + userapp.setRole(role); + userApps.add(userapp); + user.setUserApps(userApps); + user.removeRole((long) 1); + user.addRole(role); + user.setRoles(roles); + UserApp userapplication = user.getDefaultUserApp(); + assertTrue(userapplication.getRole().getId() == 1); + } + + @Test + public void comapreToTest() { + + User user1 = mockUser(); + User user = mockUser(); + user.setFirstName("test"); + assertEquals(user.compareTo(user1), 14); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/AttributeTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/AttributeTest.java new file mode 100644 index 00000000..d86163b5 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/AttributeTest.java @@ -0,0 +1,79 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Attribute; + +public class AttributeTest { + + private static final double DELTA = 1e-15; + + public Attribute mockAttribute(){ + Attribute attribute = new Attribute(); + + attribute.setName("test"); + attribute.setHeight(10); + attribute.setLeft(10); + attribute.setTop(10); + attribute.setWidth(10); + + return attribute; + } + + @Test + public void attributeTest(){ + Attribute attribute = mockAttribute(); + + Attribute attribute1 = new Attribute(); + attribute1.setName("test"); + attribute1.setHeight(10); + attribute1.setLeft(10); + attribute1.setTop(10); + attribute1.setWidth(10); + + assertEquals(attribute.getHeight(), attribute1.getHeight(), DELTA); + assertEquals(attribute.getName(), attribute1.getName()); + assertEquals(attribute.getLeft(), attribute1.getLeft(), DELTA); + assertEquals(attribute.getTop(), attribute1.getTop(), DELTA); + assertEquals(attribute.getWidth(), attribute1.getWidth(), DELTA); + + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/CollaborateListTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/CollaborateListTest.java new file mode 100644 index 00000000..a1dc2e02 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/CollaborateListTest.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.CollaborateList; + +public class CollaborateListTest { + + @SuppressWarnings("static-access") + @Test + public void addAndRemoveUserListTest(){ + String user1 = "Test User1"; + String user2 = "Test User2"; + CollaborateList collaborateList = CollaborateList.getInstance(); + collaborateList.addUserName(user1); + collaborateList.addUserName(user2); + collaborateList.delUserName(user2); + + assertEquals(true, collaborateList.getAllUserName().contains(user1)); + assertEquals(false, collaborateList.getAllUserName().contains(user2)); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ContainerTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ContainerTest.java new file mode 100644 index 00000000..c468bec6 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ContainerTest.java @@ -0,0 +1,185 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.MockitoAnnotations; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.support.Container; +import org.onap.portalsdk.core.domain.support.Element; +import org.onap.portalsdk.core.domain.support.Position; +import org.onap.portalsdk.core.domain.support.Size; + +public class ContainerTest { + + @InjectMocks + Container container = new Container(); + + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + //MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + + NullPointerException nullPointerException = new NullPointerException(); + + User user = new User(); + + private static final double DELTA = 1e-15; + + public Container mockContainer(){ + Container container = new Container("test","test",1,1,10,10,10,10,10,10); + + Size size = new Size(); + size.setHeight(10); + size.setWidth(10); + + Position position = new Position(); + position.setX(10); + position.setY(10); + + Map containerRowCol = new HashMap(); + Map elementRowCol = new HashMap(); + + List innerCList = new ArrayList(); + List elementList = new ArrayList(); + + container.setName("test"); + container.setVisibilityType("test"); + container.setHeight(10); + container.setLeft(10); + container.setWidth(10); + container.setInnerContainer(null); + container.setElements(null); + container.setInnerCList(null); + container.setElementList(null); + container.setP(null); + return container; + } + + @Test + public void containerTest(){ + Container container = mockContainer(); + + Container container1 = new Container("test","test",1,1,10,10,10,10,10,10); + + Size size1 = new Size(); + size1.setHeight(10); + size1.setWidth(10); + + Position position1 = new Position(); + position1.setX(10); + position1.setY(10); + container1.setP(null); + + + container1.setName("test"); + container.setVisibilityType("test"); + container.setHeight(10); + container.setLeft(10); + container.setWidth(10); + container.setInnerContainer(null); + container.setElements(null); + container.setInnerCList(null); + container.setElementList(null); + + assertEquals(container.getContainerRowCol(), container1.getContainerRowCol()); + assertEquals(container.getElementRowCol(), container1.getElementRowCol()); + assertEquals(container.getName(), container1.getName()); + assertEquals(container.getP(), container1.getP()); + } + + @Test + public void computeSizeTest(){ + + Map containerRowCol = new HashMap<>(); + Container container = new Container("test","test",1,1,10,10,10,10,10,10); + containerRowCol.put("00", container); + + Map elementRowCol = new HashMap<>(); + Element element = new Element("1", "test"); + elementRowCol.put("00", element); + + Container containerTest = new Container("test","Broadworks complex",1,1,10,10,10,10,10,10); + containerTest.setElements(elementRowCol); + containerTest.setInnerContainer(containerRowCol); + Size size = containerTest.computeSize(); + assertEquals(40.0,size.getWidth(), DELTA); + assertEquals(40.1, size.getHeight(), DELTA); + } + + @Test + public void computeElementPositionsTest(){ + + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Container container01 = new Container("test","test",1,1,10,10,10,10,10,10); + containerRowCol.put("00", container00); + containerRowCol.put("10", container01); + containerRowCol.put("11", container01); + + Map elementRowCol = new HashMap<>(); + Element element = new Element("1", "test"); + elementRowCol.put("01", element); + elementRowCol.put("02", element); + + Container containerTest = new Container("test","Broadworks complex",2,3,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + containerTest.setP(position); + containerTest.setElements(elementRowCol); + containerTest.setInnerContainer(containerRowCol); + containerTest.computeElementPositions(); + assertEquals(20.0,containerTest.getContainerRowCol().get("00").getP().getX(), DELTA); + assertEquals(20.0,containerTest.getContainerRowCol().get("00").getP().getY(), DELTA); + assertEquals(50.0,containerTest.getContainerRowCol().get("11").getP().getX(), DELTA); + assertEquals(31.5,containerTest.getContainerRowCol().get("11").getP().getY(), DELTA); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java new file mode 100644 index 00000000..ec455b43 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java @@ -0,0 +1,143 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Container; +import org.onap.portalsdk.core.domain.support.Domain; +import org.onap.portalsdk.core.domain.support.Size; + +public class DomainTest { + + private static final double DELTA = 1e-15; + + public Domain mockDomain(){ + + Domain domain = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0); + + domain.setP(null); + domain.setNewXafterColl(0); + domain.setYafterColl(0); + domain.setDomainToLayoutWd(0); + domain.setTop(0); + domain.setLeft(0); + domain.setHeight(0); + domain.setWidth(0); + domain.setName("test"); + domain.setIndexChanged(false); + domain.setContainers(null); + + return domain; + } + + @Test + public void domainTest(){ + Domain domain = mockDomain(); + + Domain domain1 = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0); + + domain1.setP(null); + domain1.setNewXafterColl(0); + domain1.setYafterColl(0); + domain1.setDomainToLayoutWd(0); + domain1.setTop(0); + domain1.setLeft(0); + domain1.setHeight(0); + domain1.setWidth(0); + domain1.setName("test"); + domain1.setIndexChanged(false); + domain1.setContainers(null); + + assertEquals(domain.getP(), domain1.getP()); + assertEquals(domain.getNewXafterColl(), domain1.getNewXafterColl(), DELTA); + assertEquals(domain.getYafterColl(), domain1.getYafterColl(), DELTA); + assertEquals(domain.getDomainToLayoutWd(), domain1.getDomainToLayoutWd(), DELTA); + assertEquals(domain.getTop(), domain1.getTop(), DELTA); + assertEquals(domain.getLeft(), domain1.getLeft(), DELTA); + assertEquals(domain.getHeight(), domain1.getHeight(), DELTA); + assertEquals(domain.getWidth(), domain1.getWidth(), DELTA); + assertEquals(domain.getName(), domain1.getName()); + assertEquals(domain.isIndexChanged(), domain1.isIndexChanged()); + assertEquals(domain.getContainerRowCol(), domain1.getContainerRowCol()); + } + + @Test + public void computeSizeTest(){ + Domain domain = new Domain("test", "VNI", 0, 0, 0, 0, 0, 2, 2); + Container container = new Container("test","test",1,1,10,10,10,10,10,10); + Map containerRowCol = new HashMap<>(); + containerRowCol.put("00", container); + containerRowCol.put("10", container); + containerRowCol.put("11", container); + domain.setContainers(containerRowCol); + Size size = domain.computeSize(); + assertEquals(5.0, size.getHeight(), DELTA); + } + @Test + public void computeSizeWithoutNameTest(){ + Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Container container = new Container("test","test",1,1,10,10,10,10,10,10); + Map containerRowCol = new HashMap<>(); + containerRowCol.put("00", container); + containerRowCol.put("10", container); + containerRowCol.put("11", container); + domain.setContainers(containerRowCol); + Size size = domain.computeSize(); + assertEquals(5.0, size.getHeight(), DELTA); + } + + @Test + public void computeConatinerPositionsTest(){ + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Container container01 = new Container("test","test",1,1,10,10,10,10,10,10); + containerRowCol.put("00", container00); + containerRowCol.put("10", container01); + containerRowCol.put("11", container01); + + Domain domain = new Domain("test", "XYZ", 0, 1, 1, 4, 4, 2, 2); + domain.setContainers(containerRowCol); + domain.computeConatinerPositions(); + assertEquals(21.0, domain.getContainerRowCol().get("10").getP().getX(), DELTA); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java new file mode 100644 index 00000000..93678128 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java @@ -0,0 +1,107 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import java.util.Date; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.DomainVo; + +public class DomainVOTest { + + public DomainVo mockDomainVO(){ + DomainVo domainVo = new DomainVo(); + + domainVo.setId((long) 1); + domainVo.setCreated(new Date()); + domainVo.setModified(new Date()); + domainVo.setCreatedId((long) 1); + domainVo.setModifiedId((long) 1); + domainVo.setRowNum((long) 1); + domainVo.setAuditUserId(null); + domainVo.setAuditTrail(null); + + return domainVo; + } + + @Test + public void domainVoTest(){ + DomainVo domainVo = mockDomainVO(); + + DomainVo domainVo1 = new DomainVo(); + domainVo1.setId((long) 1); + domainVo1.setCreated(new Date()); + domainVo1.setModified(new Date()); + domainVo1.setCreatedId((long) 1); + domainVo1.setModifiedId((long) 1); + domainVo1.setRowNum((long) 1); + domainVo1.setAuditUserId(null); + domainVo1.setAuditTrail(null); + + assertEquals(domainVo.getId(), domainVo1.getId()); +// assertEquals(domainVo.getCreated(), domainVo1.getCreated()); +// assertEquals(domainVo.getModified(), domainVo1.getModified()); + assertEquals(domainVo.getCreatedId(), domainVo1.getCreatedId()); + assertEquals(domainVo.getModifiedId(), domainVo1.getModifiedId()); + assertEquals(domainVo.getRowNum(), domainVo1.getRowNum()); + assertEquals(domainVo.getAuditUserId(), domainVo1.getAuditUserId()); + assertEquals(domainVo.getAuditTrail(), domainVo1.getAuditTrail()); + } + + @Test + public void copyTest(){ + DomainVo domainVo = mockDomainVO(); + domainVo.copy(true); + } + + @Test + public void equalTest(){ + DomainVo domainVo1 = mockDomainVO(); + DomainVo domainVo2 = mockDomainVO(); +// assertEquals(true, domainVo1.equals(domainVo2)); + } + + @Test + public void compareTest(){ + DomainVo domainVo1 = mockDomainVO(); + DomainVo domainVo2 = mockDomainVO(); + assertEquals(0, domainVo1.compareTo(domainVo2)); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementDetailsTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementDetailsTest.java new file mode 100644 index 00000000..d6b9c11b --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementDetailsTest.java @@ -0,0 +1,64 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.ElementDetails; + +public class ElementDetailsTest { + + public ElementDetails mockElementDetails(){ + ElementDetails elementDetails = new ElementDetails("test","test","test","test","test","test","test","test","test","test"); + + elementDetails.setLogical_group("test"); + + return elementDetails; + } + + @Test + public void elementDetailsTest(){ + ElementDetails elementDetails = mockElementDetails(); + + ElementDetails elementDetails1 = new ElementDetails("test","test","test","test","test","test","test","test","test","test"); + elementDetails1.setLogical_group("test"); + + assertEquals(elementDetails.getLogical_group(), elementDetails1.getLogical_group()); + } +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementTest.java new file mode 100644 index 00000000..6eec6f00 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementTest.java @@ -0,0 +1,77 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Element; + +public class ElementTest { + + public Element mockElement(){ + Element element = new Element("test","test","test","test","test",null); + + element.setId("test"); + element.setName("test"); + element.setTop(10); + element.setLeft(10); + element.setHeight(10); + element.setWidth(10); + element.setImgFileName("test"); + element.setBorderType("test"); + element.setBgColor("test"); + element.setP(null); + + return element; + } + + @Test + public void elementTest(){ + Element element = mockElement(); + + Element element1 = new Element("test","test","test","test","test",null); + + assertEquals(element.getId(), element1.getId()); + assertEquals(element.getName(), element1.getName()); + assertEquals(element.getImgFileName(), element1.getImgFileName()); + assertEquals(element.getBorderType(), element1.getBorderType()); + assertEquals(element.getP(), element1.getP()); + } + +} diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/FusionCommandTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/FusionCommandTest.java new file mode 100644 index 00000000..f54bacbe --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/FusionCommandTest.java @@ -0,0 +1,65 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.FusionCommand; + +public class FusionCommandTest { + + public FusionCommand mockFusionCommand(){ + FusionCommand fusionCommand = new FusionCommand(); + + fusionCommand.setTask("test"); + + return fusionCommand; + } + + @Test + public void fusionCommandTest(){ + FusionCommand fusionCommand = mockFusionCommand(); + + FusionCommand fusionCommand1 = new FusionCommand(); + fusionCommand1.setTask("test"); + + assertEquals(fusionCommand.getTask(), fusionCommand1.getTask()); + } + +} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java new file mode 100644 index 00000000..c7038144 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java @@ -0,0 +1,336 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Container; +import org.onap.portalsdk.core.domain.support.Domain; +import org.onap.portalsdk.core.domain.support.Layout; +import org.onap.portalsdk.core.domain.support.Position; + +public class LayoutTest { + + private static final double DELTA = 1e-15; + + public Layout mockLayout(){ + Layout layout = new Layout(null, 0, 0, 0, 0); + + layout.setCollapsedDomainsNewList(null); + layout.setCollapsedDomains(null); + layout.setNumberofColsofDomains(0); + layout.setDomainRowCol(null); + + return layout; + } + + @Test + public void layoutTest(){ + Layout layout = mockLayout(); + + Layout layout1 = new Layout(null, 0, 0, 0, 0); + layout1.setCollapsedDomainsNewList(null); + layout1.setCollapsedDomains(null); + layout1.setNumberofColsofDomains(0); + layout1.setDomainRowCol(null); + + assertEquals(layout.getCollapsedDomains(), layout1.getCollapsedDomains()); + assertEquals(layout.getCollapsedDomainsNewList(), layout1.getCollapsedDomainsNewList()); + assertEquals(layout.getNumberofColsofDomains(), layout1.getNumberofColsofDomains()); + assertEquals(layout.getDomainRowCol(), layout1.getDomainRowCol()); + } + + @Test + public void computeDomainPositionsTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map domainRowCol = new HashMap<>(); + List domainList = new ArrayList<>(); + domainList.add(domain); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.setCollapsedDomainsNewList(domainList); + layout.computeDomainPositions(); + assertEquals(5.0, layout.getDomainRowCol().get("00").getP().getY(), DELTA); + } + + @Test + public void computeDomainPositionsModifiedTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + container00.setP(position); + containerRowCol.put("00", container00); + domain.setContainers(containerRowCol); + Map domainRowCol = new HashMap<>(); + List domainList = new ArrayList<>(); + domainList.add(domain); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.setCollapsedDomainsNewList(domainList); + layout.computeDomainPositionsModified(); + assertEquals(5.0, layout.getDomainRowCol().get("00").getP().getY(), DELTA); + } + + @Test + public void collapseDomainModifiedTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + container00.setP(position); + containerRowCol.put("00", container00); + containerRowCol.put("01", container00); + domain.setContainers(containerRowCol); + domain2.setContainers(containerRowCol); + domain.setIndexChanged(true); + Map domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain2); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomainModified("XYZ"); + assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA); + } + + @Test + public void collapseDomainNewTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + container00.setP(position); + containerRowCol.put("00", container00); + containerRowCol.put("01", container00); + domain.setContainers(containerRowCol); + domain2.setContainers(containerRowCol); + domain.setIndexChanged(true); + Map domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain2); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomainNew("XYZ"); + assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA); + } + + @Test + public void collapseDomainTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + container00.setP(position); + containerRowCol.put("00", container00); + containerRowCol.put("01", container00); + domain.setContainers(containerRowCol); + domain.setP(position); + domain2.setP(position); + domain2.setContainers(containerRowCol); + domain.setIndexChanged(true); + Map domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain2); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomain("XYZ"); + assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA); + } + + + @Test + public void uncollapseDomainModifiedTest(){ + + Layout layout = new Layout(null, 0, 0, 2, 2); + + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Position position = new Position(); + position.setX(10); + position.setY(10); + domain.setP(position); + Map domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + + Map innerContainerRowCol = new HashMap<>(); + Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10); + innerContainerRowCol.put("00", innerContainer); + + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + container00.setInnerContainer(innerContainerRowCol); + containerRowCol.put("00", container00); + + domain.setContainers(containerRowCol); + + Map originalDomainRowCol = new HashMap<>(); + originalDomainRowCol.put("00", domain); + + layout.setDomainRowCol(domainRowCol); + layout.setCollapsedDomains(originalDomainRowCol); + + layout.uncollapseDomainModified("XYZ"); + assertEquals(3, layout.getNumberofColsofDomains(), DELTA); + + } + + + @Test + public void uncollapseDomainTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Position position = new Position(); + position.setX(10); + position.setY(10); + domain.setP(position); + Map domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + + Map innerContainerRowCol = new HashMap<>(); + Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10); + innerContainerRowCol.put("00", innerContainer); + + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + container00.setInnerContainer(innerContainerRowCol); + containerRowCol.put("00", container00); + + domain.setContainers(containerRowCol); + + Map originalDomainRowCol = new HashMap<>(); + originalDomainRowCol.put("00", domain); + + layout.setDomainRowCol(domainRowCol); + layout.setCollapsedDomains(originalDomainRowCol); + + layout.uncollapseDomain("XYZ"); + assertEquals(10.6, layout.getDomainRowCol().get("00").getP().getX(), DELTA); + } + + @Test + public void uncollapseDomainNewTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Position position = new Position(); + position.setX(10); + position.setY(10); + domain.setP(position); + Map domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + + Map innerContainerRowCol = new HashMap<>(); + Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10); + innerContainerRowCol.put("00", innerContainer); + + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + container00.setInnerContainer(innerContainerRowCol); + containerRowCol.put("00", container00); + + domain.setContainers(containerRowCol); + + Map originalDomainRowCol = new HashMap<>(); + originalDomainRowCol.put("00", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomain("XYZ"); + layout.uncollapseDomainNew("XYZ"); + assertEquals(11.0, layout.getDomainRowCol().get("00").getP().getX(), DELTA); + } + + @Test + public void uncollapseDomainNew1Test(){ + + Layout layout = new Layout(null, 0, 0, 2, 2); + + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Position position = new Position(); + position.setX(10); + position.setY(10); + domain.setP(position); + Map domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + + Map innerContainerRowCol = new HashMap<>(); + Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10); + innerContainerRowCol.put("00", innerContainer); + + Map containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + container00.setInnerContainer(innerContainerRowCol); + containerRowCol.put("00", container00); + + domain.setContainers(containerRowCol); + + Map originalDomainRowCol = new HashMap<>(); + originalDomainRowCol.put("00", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomain("XYZ"); + layout.uncollapseDomainNew1("XYZ"); + assertEquals(11.0, layout.getDomainRowCol().get("00").getP().getX(), DELTA); + + } + +} + diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/NameValueIdTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/NameValueIdTest.java new file mode 100644 index 00000000..087079b7 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/NameValueIdTest.java @@ -0,0 +1,81 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.NameValueId; + +public class NameValueIdTest { + + public NameValueId mockNameValueId(){ + NameValueId nameValueId = new NameValueId("test","test"); + + nameValueId.setLab("test"); + nameValueId.setVal("test"); + + return nameValueId; + } + + @Test + public void nameValueIdTest(){ + NameValueId nameValueId = mockNameValueId(); + + NameValueId nameValueId1 = new NameValueId("test","test"); + nameValueId1.setLab("test"); + nameValueId1.setVal("test"); + + assertEquals(nameValueId.getLab(), nameValueId1.getLab()); + assertEquals(nameValueId.getVal(), nameValueId1.getVal()); + } + + @Test + public void equalsTest(){ + NameValueId nameValueId1 = mockNameValueId(); + NameValueId nameValueId2 = mockNameValueId(); + assertEquals(true, nameValueId1.equals(nameValueId2)); + } + + @Test + public void hashCodeTest(){ + NameValueId nameValueId1 = mockNameValueId(); + assertNotNull(nameValueId1.hashCode()); + } +} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/PositionTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/PositionTest.java new file mode 100644 index 00000000..57508c30 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/PositionTest.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Position; + +public class PositionTest { + + private static final double DELTA = 1e-15; + + public Position mockPosition(){ + Position position = new Position(); + position.setX(10); + position.setY(10); + + return position; + } + + @Test + public void positionTest(){ + Position position = mockPosition(); + + Position position1 = new Position(); + position1.setX(10); + position1.setY(10); + + assertEquals(position.getX(), position1.getX(), DELTA); + assertEquals(position.getY(), position1.getY(), DELTA); + } +} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/SizeTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/SizeTest.java new file mode 100644 index 00000000..f993db20 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/SizeTest.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + * + */ +package org.onap.portalsdk.core.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Size; + +public class SizeTest { + + private static final double DELTA = 1e-15; + + public Size mockSize(){ + Size size = new Size(); + size.setHeight(10); + size.setWidth(10); + + return size; + } + + @Test + public void sizeTest(){ + Size size = mockSize(); + + Size size1 = new Size(); + size1.setHeight(10); + size1.setWidth(10); + + assertEquals(size.getHeight(), size1.getHeight(), DELTA); + assertEquals(size.getWidth(), size1.getWidth(), DELTA); + } + +} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-fw/pom.xml b/ecomp-sdk/epsdk-fw/pom.xml index 55f68744..91487ad8 100644 --- a/ecomp-sdk/epsdk-fw/pom.xml +++ b/ecomp-sdk/epsdk-fw/pom.xml @@ -6,7 +6,7 @@ org.onap.portal.sdk epsdk-project - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT @@ -92,20 +92,20 @@ log4j - xerces - xercesImpl + xerces + xercesImpl - xalan - xalan + xalan + xalan - commons-beanutils - commons-beanutils-core + commons-beanutils + commons-beanutils-core - commons-httpclient - commons-httpclient + commons-httpclient + commons-httpclient org.beanshell diff --git a/ecomp-sdk/epsdk-music/pom.xml b/ecomp-sdk/epsdk-music/pom.xml index d1b6ef27..44970e13 100644 --- a/ecomp-sdk/epsdk-music/pom.xml +++ b/ecomp-sdk/epsdk-music/pom.xml @@ -5,12 +5,12 @@ org.onap.portal.sdk epsdk-project - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT - + org.onap.portal.sdk epsdk-music - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT jar ONAP Portal SDK Music @@ -114,13 +114,20 @@ + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + org.onap.music MUSIC 2.5.3 - - + + com.fasterxml.jackson.core diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java index ad90d4ec..7d2e51ff 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java @@ -85,6 +85,7 @@ public class MusicSessionRepositoryHandler { sessions.put(id, musicSession); try { MusicService.setMetaAttribute(musicSession); + MusicService.cleanUpMusic(); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "setMetaAttribute failed with id " + id, e); } diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java new file mode 100644 index 00000000..aa9e2e3e --- /dev/null +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java @@ -0,0 +1,70 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + *. + */ + +package org.onap.portalapp.music.filter; + +import java.io.IOException; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +import org.onap.music.eelf.logging.EELFLoggerDelegate; +import org.onap.portalapp.music.util.MusicUtil; +import org.springframework.web.filter.DelegatingFilterProxy; + +public class MusicSessionRepositoryFilter extends DelegatingFilterProxy{ + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicUtil.class); + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) + throws ServletException, IOException { + try{ + if (request instanceof HttpServletRequest) { + String path = ((HttpServletRequest)request).getRequestURI().substring(((HttpServletRequest) request).getContextPath().length()); + if(MusicUtil.isExcludedApi(path)) + request.setAttribute("org.springframework.session.web.http.SessionRepositoryFilter.FILTERED", Boolean.TRUE); + } + }catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, "Failed to check the exclude apis ", e); + } + super.doFilter(request, response, filterChain); + } +} diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java index 4ceac22c..801e9c03 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java @@ -38,7 +38,12 @@ package org.onap.portalapp.music.service; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.onap.music.datastore.PreparedQueryObject; @@ -61,6 +66,7 @@ import org.springframework.session.Session; import org.springframework.web.client.RestTemplate; import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.Row; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -539,5 +545,108 @@ public class MusicService { path.append("/"); return path.toString(); } + + /** + * Get a list of sessions that need to be cleaned up + * + * @return List + */ + private static List getSessionToBeDeleted(){ + logger.debug(EELFLoggerDelegate.debugLogger, "initial getSessionToBeDeleted ..."); + + PreparedQueryObject queryObject = new PreparedQueryObject(); + ResultSet result = null; + List sessionIDList = new ArrayList<>(); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + StringBuilder querySB = new StringBuilder(); + String cleanUpThreshold = MusicProperties.getProperty(MusicProperties.MUSIC_CLEAN_UP_THRESHOLD); //Clean up sessions that's cleanUpThreshold hours ago + Date dateForCleanup = new Date(System.currentTimeMillis() - 3600 * 1000 * Integer.valueOf(cleanUpThreshold)); // Get the threshold date that needs to be clean up + String dateForCleanupCondition = dateFormat.format(dateForCleanup); + querySB.append("SELECT ").append(MusicProperties.PRIMARY_ID).append(" FROM ").append(musicKeySpace) + .append(".").append(getTableName(true)).append(" WHERE ").append(MusicProperties.LAST_ACCESS_TIME) + .append("< ? ").append(" ALLOW FILTERING"); + queryObject.appendQueryString(querySB.toString()); + queryObject.addValue(dateForCleanupCondition); + + try{ + if (isAtomicGet) + result = MusicCore.atomicGet(musicKeySpace, musicMetaTable, null, queryObject); + else + result = MusicCore.get(queryObject); + Row row = result.one(); + while(row!=null){ + sessionIDList.add(row.get(MusicProperties.PRIMARY_ID, String.class)); + row = result.one(); + } + }catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, "Error while cleaning up music tables" , e); + } + return sessionIDList; + } + + /** + * Remove session data in music base on the defined frequency + * + * @return List + */ + public static void cleanUpMusic() { + boolean timeToCleanUp = MusicUtil.cleanUp(); // Decide whether to clean up or not + ReturnType result = null; + if(timeToCleanUp){ + /**Getting a list of sessions that need to be cleaned up*/ + List sessionIDList = getSessionToBeDeleted(); + if(sessionIDList!=null || sessionIDList.size()!=0){ + StringBuilder sessionIDListCondition = new StringBuilder(); + sessionIDListCondition.append("('"); + for(String s : sessionIDList){ + sessionIDListCondition.append(s); + sessionIDListCondition.append("','"); + } + sessionIDListCondition.deleteCharAt(sessionIDListCondition.length()-1); + sessionIDListCondition.deleteCharAt(sessionIDListCondition.length()-1); + sessionIDListCondition.append(")"); + StringBuilder querySB = new StringBuilder(); + PreparedQueryObject queryObject = new PreparedQueryObject(); + /**Deleting attributes table**/ + querySB = new StringBuilder(); + queryObject = new PreparedQueryObject(); + querySB.append("DELETE FROM ").append(musicKeySpace) + .append(".").append(getTableName(false)).append(" WHERE ").append(MusicProperties.PRIMARY_ID) + .append(" in ").append(sessionIDListCondition); + queryObject.appendQueryString(querySB.toString()); + try{ + if (isAtomicPut) + result = MusicCore.atomicPut(musicKeySpace, null, null, queryObject, null); + else + result = MusicCore.eventualPut(queryObject); + }catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, "Error while cleaning up music attributes tables" , e); + } + logger.debug(EELFLoggerDelegate.debugLogger, "Music sessions have been cleaned up !"); + + /**Deleting meta table**/ + logger.debug(EELFLoggerDelegate.debugLogger, "Cleaning up meta table ..."); + querySB = new StringBuilder(); + queryObject = new PreparedQueryObject(); + querySB.append("DELETE FROM ").append(musicKeySpace) + .append(".").append(getTableName(true)).append(" WHERE ").append(MusicProperties.PRIMARY_ID) + .append(" in ").append(sessionIDListCondition); + queryObject.appendQueryString(querySB.toString()); + try{ + if (isAtomicPut) + result = MusicCore.atomicPut(musicKeySpace, null, null, queryObject, null); + else + result = MusicCore.eventualPut(queryObject); + }catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, "Error while cleaning up music meta tables" , e); + } + + logger.debug(EELFLoggerDelegate.debugLogger, "Cleaned up attributes table ... "); + }else{ + logger.debug(EELFLoggerDelegate.debugLogger, "No Session needs to be cleaned up"); + } + + } + } } diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicCleanUp.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicCleanUp.java new file mode 100644 index 00000000..aab04eaf --- /dev/null +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicCleanUp.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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============================================ + * + *. + */ + +package org.onap.portalapp.music.util; + +import java.util.Date; + +public class MusicCleanUp { + private static volatile MusicCleanUp musicCleanUp = new MusicCleanUp(); + // private constructor restricted to this class itself + private MusicCleanUp(){ + } + + private Date lastCleanUpTime = new Date(); + + public static MusicCleanUp getInstance(){ + return musicCleanUp; + } + + public Date getLastCleanUpTime(){ + return lastCleanUpTime; + } + + public synchronized void updateLastCleanUpTimeToCurrent() { + lastCleanUpTime = new Date(); + } +} diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java index bdc9c543..802634b6 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java @@ -93,6 +93,12 @@ public class MusicProperties { public static final String MUSIC_ATOMIC_POST = "music.atomic.post"; + public static final String MUSIC_EXCLUDE_API = "music.exclude.api"; + + public static final String MUSIC_CLEAN_UP_FREQUENCY = "music.cleanup.frequency"; + + public static final String MUSIC_CLEAN_UP_THRESHOLD = "music.cleanup.threshold"; + public static final String SESSION_MAX_INACTIVE_INTERVAL_SECONDS = "music.session.max.inactive.interval.seconds"; public static final String ATTRIBUTE_NAME = "ATTRIBUTE_NAME"; diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java index 2744796e..ff1edb74 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java @@ -46,6 +46,7 @@ import java.nio.ByteBuffer; import java.time.Duration; import java.time.Instant; import java.util.Arrays; +import java.util.Date; import java.util.HashSet; import java.util.Set; import java.util.zip.GZIPInputStream; @@ -64,6 +65,7 @@ public class MusicUtil { private static String atomicPut = MusicProperties.getProperty(MusicProperties.MUSIC_ATOMIC_PUT); private static String atomicGet = MusicProperties.getProperty(MusicProperties.MUSIC_ATOMIC_GET); private static String cached = MusicProperties.getProperty(MusicProperties.MUSIC_CACHE); + private static String cleanUpFreq = MusicProperties.getProperty(MusicProperties.MUSIC_CLEAN_UP_FREQUENCY); private static String musicSerializeCompress = MusicProperties.getProperty(MusicProperties.MUSIC_SERIALIZE_COMPRESS); public static boolean isSessionMetaAttr(String key){ return sessionAttrNameSet.contains(key); @@ -127,6 +129,23 @@ public class MusicUtil { musicSession.setMaxInactiveInterval(Duration.parse(row.getString("max_inactive_interval"))); return musicSession; } + + public static Set getMusicExcludedAPI(){ + Set excludedApiSet = new HashSet<>(); + String musicExcludedApi = MusicProperties.getProperty(MusicProperties.MUSIC_EXCLUDE_API); + String[] musicExcludedApiArray = musicExcludedApi.split(","); + if(musicExcludedApiArray.length>0){ + for(String str : musicExcludedApiArray){ + excludedApiSet.add(str.trim()); + } + } + return excludedApiSet; + } + + public static boolean isExcludedApi(String api){ + Set excludedApiSet = getMusicExcludedAPI(); + return excludedApiSet.contains(api); + } public static boolean isMusicSerializeCompress(){ if(musicSerializeCompress==null){ @@ -159,4 +178,25 @@ public class MusicUtil { } return cached.trim().equalsIgnoreCase("true"); } + + public static int convertHoursToMillSec(int hour){ + return hour*3600000; + } + + public static boolean cleanUp(){ + Date lastCleanUpDate = MusicCleanUp.getInstance().getLastCleanUpTime(); + if(lastCleanUpDate==null) + return false; + else{ + int cleanUpDurationMili = convertHoursToMillSec(Integer.valueOf(cleanUpFreq)); + Date currentTime = new Date(); + long diffInMillies = Math.abs(currentTime.getTime() - lastCleanUpDate.getTime()); + if(diffInMillies > cleanUpDurationMili){ + MusicCleanUp.getInstance().updateLastCleanUpTimeToCurrent(); + return true; + } + else + return false; + } + } } diff --git a/ecomp-sdk/epsdk-workflow/pom.xml b/ecomp-sdk/epsdk-workflow/pom.xml index 0a817850..eaac5a44 100644 --- a/ecomp-sdk/epsdk-workflow/pom.xml +++ b/ecomp-sdk/epsdk-workflow/pom.xml @@ -5,7 +5,7 @@ org.onap.portal.sdk epsdk-project - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT diff --git a/ecomp-sdk/epsdk-workflow/src/test/java/org/onap/portalsdk/workflow/models/WorkflowTest.java b/ecomp-sdk/epsdk-workflow/src/test/java/org/onap/portalsdk/workflow/models/WorkflowTest.java index 414007f7..53896038 100644 --- a/ecomp-sdk/epsdk-workflow/src/test/java/org/onap/portalsdk/workflow/models/WorkflowTest.java +++ b/ecomp-sdk/epsdk-workflow/src/test/java/org/onap/portalsdk/workflow/models/WorkflowTest.java @@ -37,10 +37,10 @@ */ package org.onap.portalsdk.workflow.models; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.onap.portalsdk.core.domain.support.NameValueId; public class WorkflowTest { diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml index e3db8a97..8acbdac6 100644 --- a/ecomp-sdk/pom.xml +++ b/ecomp-sdk/pom.xml @@ -14,7 +14,7 @@ org.onap.portal.sdk epsdk-project - 2.2.0-SNAPSHOT + 2.4.0-SNAPSHOT pom portal-sdk https://wiki.onap.org/display/DW/Portal @@ -23,6 +23,8 @@ epsdk-fw epsdk-core epsdk-analytics + epsdk-domain + epsdk-aaf epsdk-music epsdk-workflow epsdk-app-common -- cgit 1.2.3-korg