diff options
author | 2019-08-26 13:42:05 +0200 | |
---|---|---|
committer | 2019-08-26 14:35:31 +0200 | |
commit | 682a90dad9795a3fa9aaffbf43c488057b8529e7 (patch) | |
tree | 6fdf51400b407c556cb5fd996d17a69818ea54bc /portal-BE/src/main/java | |
parent | 8c6ccfe62953f28f704891c76258d595dc9d0b03 (diff) |
Hibernate db fix
Hibernate db fix + tests up
Issue-ID: PORTAL-710
Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com>
Change-Id: I9b799399c08918322e9665e44b42b2e59bb7420b
Diffstat (limited to 'portal-BE/src/main/java')
61 files changed, 1483 insertions, 199 deletions
diff --git a/portal-BE/src/main/java/org/onap/portal/aop/service/FnUserServiceAOP.java b/portal-BE/src/main/java/org/onap/portal/aop/service/FnUserServiceAOP.java index 0cb17cc6..84f430e7 100644 --- a/portal-BE/src/main/java/org/onap/portal/aop/service/FnUserServiceAOP.java +++ b/portal-BE/src/main/java/org/onap/portal/aop/service/FnUserServiceAOP.java @@ -1,3 +1,43 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + package org.onap.portal.aop.service; import java.security.Principal; @@ -6,6 +46,8 @@ import javax.validation.ConstraintViolation; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portal.domain.mapper.FnUserMapper; +import org.onap.portal.service.fn.FnUserService; import org.onap.portal.validation.DataValidator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -15,23 +57,42 @@ import org.springframework.stereotype.Component; @Aspect @Component public class FnUserServiceAOP { + private static final Logger LOGGER = LoggerFactory.getLogger(FnLanguageServiceAOP.class); + private final DataValidator dataValidator; + private final FnUserMapper fnUserMapper; + private final FnUserService fnUserService; + @Autowired - private DataValidator dataValidator; + public FnUserServiceAOP(final DataValidator dataValidator, final FnUserMapper fnUserMapper, + final FnUserService fnUserService) { + this.dataValidator = dataValidator; + this.fnUserMapper = fnUserMapper; + this.fnUserService = fnUserService; + } @Before("execution(* org.onap.portal.service.fn.FnUserService.saveFnUser(..)) && args(principal, fnUser)") public void save(final Principal principal, final FnUser fnUser) { + FnUser user; if (fnUser == null) { LOGGER.error("User " + principal.getName() + " try to save NULL fnUser"); throw new NullPointerException("FnUser cannot be null or empty"); } - if (!dataValidator.isValid(fnUser)) { - String violations = dataValidator.getConstraintViolations(fnUser).stream() + try { + user = fnUserMapper.fnUserToFnUser(fnUser); + } catch (NullPointerException e) { + throw new NullPointerException(e.getLocalizedMessage() + ", " + e.getMessage()); + } + + if (!dataValidator.isValid(user)) { + String violations = dataValidator.getConstraintViolations(user).stream() .map(ConstraintViolation::getMessage) .collect(Collectors.joining(", ")); LOGGER.error("User " + principal.getName() + " try to save not valid fnUser: " + violations); throw new IllegalArgumentException("FnUser is not valid, " + violations); + } else { + LOGGER.error("User " + principal.getName() + " send valid fnUser"); } } } diff --git a/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java b/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java index adee349b..8f2e50e6 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java @@ -47,6 +47,9 @@ import org.onap.portal.domain.db.fn.FnLanguage; import org.onap.portal.domain.db.fn.FnUser; import org.onap.portal.domain.dto.PortalRestResponse; import org.onap.portal.domain.dto.PortalRestStatusEnum; +import org.onap.portal.domain.dto.fn.FnLanguageDto; +import org.onap.portal.domain.mapper.FnLanguageMapper; +import org.onap.portal.domain.mapper.FnUserMapper; import org.onap.portal.service.fn.FnLanguageService; import org.onap.portal.service.fn.FnUserService; import org.slf4j.Logger; @@ -69,33 +72,47 @@ public class LanguageController { private final FnLanguageService languageService; private final FnUserService fnUserService; + private final FnUserMapper fnUserMapper; + private final FnLanguageMapper fnLanguageMapper; + @Autowired public LanguageController(final FnLanguageService languageService, - final FnUserService fnUserService) { + final FnUserService fnUserService, final FnUserMapper fnUserMapper, + final FnLanguageMapper fnLanguageMapper) { this.languageService = languageService; this.fnUserService = fnUserService; + this.fnUserMapper = fnUserMapper; + this.fnLanguageMapper = fnLanguageMapper; } @GetMapping(value = "/language", produces = MediaType.APPLICATION_JSON_VALUE) - public List<FnLanguage> getLanguageList(final Principal principal) { - return languageService.getLanguages(principal); + public List<FnLanguageDto> getLanguageList(final Principal principal) { + return fnLanguageMapper.fnLanguageListToDtoList(languageService.getLanguages(principal)); } @PostMapping(value = "/languageSetting/user/{loginId}") public PortalRestResponse<String> setUpUserLanguage(Principal principal, @RequestBody FnLanguage fnLanguage, @PathVariable("loginId") Long userId) { PortalRestResponse<String> response = new PortalRestResponse<>(); + LOGGER.info("User " + principal.getName() + " try to setUpUserLanguage fnUser with id " + userId); try { - if (fnUserService.getUser(userId).isPresent()) { + if (fnUserService.existById(userId)) { + LOGGER.info("User " + principal.getName() + " found fnUser with id " + userId); + @SuppressWarnings("OptionalGetWithoutIsPresent") FnUser user = fnUserService.getUser(userId).get(); user.setLanguageId(fnLanguage); fnUserService.saveFnUser(principal, user); + //response.setResponse(fnUserMapper.fnUserToFnUserDto(user).toString()); + response.setMessage("SUCCESS"); + response.setStatus(PortalRestStatusEnum.OK); + } else { + response.setMessage("FAILURE"); + response.setResponse("User for id:" + userId + " do not exist"); + response.setStatus(PortalRestStatusEnum.ERROR); } - response.setMessage("SUCCESS"); - response.setStatus(PortalRestStatusEnum.OK); } catch (Exception e) { response.setMessage("FAILURE"); - response.setResponse(e.getMessage()); + response.setResponse(e.toString()); response.setStatus(PortalRestStatusEnum.ERROR); return response; } diff --git a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTimezoneDao.java b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTimezoneDao.java index eca61ddd..d98d893b 100644 --- a/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTimezoneDao.java +++ b/portal-BE/src/main/java/org/onap/portal/dao/fn/FnLuTimezoneDao.java @@ -47,6 +47,6 @@ import org.springframework.transaction.annotation.Transactional; @Repository @Transactional -public interface FnLuTimezoneDao extends JpaRepository<FnLuTimezone, Integer> { +public interface FnLuTimezoneDao extends JpaRepository<FnLuTimezone, Long> { } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserBuilder.java b/portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserBuilder.java new file mode 100644 index 00000000..fe8aadb6 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserBuilder.java @@ -0,0 +1,470 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.builder; + +import java.time.LocalDateTime; +import java.util.Set; +import java.util.UUID; +import javax.validation.Valid; +import javax.validation.constraints.Digits; +import javax.validation.constraints.Email; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.PastOrPresent; +import javax.validation.constraints.Size; +import org.hibernate.validator.constraints.SafeHtml; +import org.onap.portal.domain.db.cr.CrReportFileHistory; +import org.onap.portal.domain.db.ep.EpPersUserWidgetPlacement; +import org.onap.portal.domain.db.ep.EpPersUserWidgetSel; +import org.onap.portal.domain.db.ep.EpUserNotification; +import org.onap.portal.domain.db.ep.EpUserRolesRequest; +import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; +import org.onap.portal.domain.db.fn.FnAuditLog; +import org.onap.portal.domain.db.fn.FnLanguage; +import org.onap.portal.domain.db.fn.FnLuAlertMethod; +import org.onap.portal.domain.db.fn.FnLuTimezone; +import org.onap.portal.domain.db.fn.FnMenuFunctional; +import org.onap.portal.domain.db.fn.FnOrg; +import org.onap.portal.domain.db.fn.FnPersUserAppSel; +import org.onap.portal.domain.db.fn.FnRole; +import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portal.domain.db.fn.FnUserRole; +import org.springframework.stereotype.Component; + +@Component +public class FnUserBuilder { + + private @Digits(integer = 11, fraction = 0) Long userId; + private @Valid FnOrg orgId; + private @Valid FnUser managerId; + private @Size(max = 50) + @SafeHtml String firstName; + private @Size(max = 50) + @SafeHtml String middleName; + private @Size(max = 50) + @SafeHtml String lastName; + private @Size(max = 25) + @SafeHtml String phone; + private @Size(max = 25) + @SafeHtml String fax; + private @Size(max = 25) + @SafeHtml String cellular; + private @Size(max = 50) @Email + @SafeHtml String email; + private @Digits(integer = 11, fraction = 0) Long addressId; + private FnLuAlertMethod alertMethodCd; + private @Size(max = 20) + @SafeHtml String hrid; + private @Size(max = 20) + @SafeHtml String orgUserId; + private @Size(max = 30) + @SafeHtml String org_code; + private @Size(max = 25) + @SafeHtml String loginId; + private @Size(max = 100) + @SafeHtml String loginPwd; + private @PastOrPresent LocalDateTime lastLoginDate; + private @Size(max = 1) + @SafeHtml + @NotNull(message = "activeYn must not be null") String activeYn; + private @Valid FnUser createdId; + private @PastOrPresent LocalDateTime createdDate; + private @Valid FnUser modifiedId; + private @PastOrPresent LocalDateTime modifiedDate; + private @Size(max = 1) + @SafeHtml + @NotNull(message = "isInternalYn must not be null") String isInternalYn; + private @Size(max = 100) + @SafeHtml String addressLine1; + private @Size(max = 100) + @SafeHtml String addressLine2; + private @Size(max = 50) + @SafeHtml String city; + private @Size(max = 3) + @SafeHtml String stateCd; + private @Size(max = 11) + @SafeHtml String zipCode; + private @Size(max = 3) + @SafeHtml String countryCd; + private @Size(max = 8) + @SafeHtml String locationClli; + private @Size(max = 20) + @SafeHtml String orgManagerUserId; + private @Size(max = 100) + @SafeHtml String company; + private @Size(max = 200) + @SafeHtml String departmentName; + private @Size(max = 100) + @SafeHtml String jobTitle; + private @Valid FnLuTimezone timezone; + private @Size(max = 25) + @SafeHtml String department; + private @Size(max = 25) + @SafeHtml String businessUnit; + private @Size(max = 100) + @SafeHtml String businessUnitName; + private @Size(max = 25) + @SafeHtml String cost_center; + private @Size(max = 10) + @SafeHtml String finLocCode; + private @Size(max = 10) + @SafeHtml String siloStatus; + private @Valid @NotNull(message = "languageId must not be null") FnLanguage languageId; + private @NotNull(message = "guest must not be null") boolean guest; + private Set<CrReportFileHistory> crReportFileHistorie; + private Set<FnRole> fnRoles; + private Set<FnMenuFunctional> fnRoleList; + private Set<FnAuditLog> fnAuditLogs; + private Set<FnUser> fnUsersCreatedId; + private Set<FnUser> fnUsersManagerId; + private Set<FnUser> fnUsersModifiedId; + private Set<EpUserRolesRequest> epUserRolesRequests; + private Set<FnPersUserAppSel> persUserAppSels; + private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters; + private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements; + private Set<EpPersUserWidgetSel> epPersUserWidgetSels; + private Set<FnUserRole> fnUserRoles; + private Set<EpUserNotification> epUserNotifications; + + public FnUserBuilder setUserId(@Digits(integer = 11, fraction = 0) Long userId) { + this.userId = userId; + return this; + } + + public FnUserBuilder setOrgId(@Valid FnOrg orgId) { + this.orgId = orgId; + return this; + } + + public FnUserBuilder setManagerId(@Valid FnUser managerId) { + this.managerId = managerId; + return this; + } + + public FnUserBuilder setFirstName(@Size(max = 50) @SafeHtml String firstName) { + this.firstName = firstName; + return this; + } + + public FnUserBuilder setMiddleName(@Size(max = 50) @SafeHtml String middleName) { + this.middleName = middleName; + return this; + } + + public FnUserBuilder setLastName(@Size(max = 50) @SafeHtml String lastName) { + this.lastName = lastName; + return this; + } + + public FnUserBuilder setPhone(@Size(max = 25) @SafeHtml String phone) { + this.phone = phone; + return this; + } + + public FnUserBuilder setFax(@Size(max = 25) @SafeHtml String fax) { + this.fax = fax; + return this; + } + + public FnUserBuilder setCellular(@Size(max = 25) @SafeHtml String cellular) { + this.cellular = cellular; + return this; + } + + public FnUserBuilder setEmail(@Size(max = 50) @Email @SafeHtml String email) { + this.email = email; + return this; + } + + public FnUserBuilder setAddressId(@Digits(integer = 11, fraction = 0) Long addressId) { + this.addressId = addressId; + return this; + } + + public FnUserBuilder setAlertMethodCd(FnLuAlertMethod alertMethodCd) { + this.alertMethodCd = alertMethodCd; + return this; + } + + public FnUserBuilder setHrid(@Size(max = 20) @SafeHtml String hrid) { + this.hrid = hrid; + return this; + } + + public FnUserBuilder setOrgUserId(@Size(max = 20) @SafeHtml String orgUserId) { + this.orgUserId = orgUserId; + return this; + } + + public FnUserBuilder setOrg_code(@Size(max = 30) @SafeHtml String org_code) { + this.org_code = org_code; + return this; + } + + public FnUserBuilder setLoginId(@Size(max = 25) @SafeHtml String loginId) { + this.loginId = loginId; + return this; + } + + public FnUserBuilder setLoginPwd(@Size(max = 100) @SafeHtml String loginPwd) { + this.loginPwd = loginPwd; + return this; + } + + public FnUserBuilder setLastLoginDate(@PastOrPresent LocalDateTime lastLoginDate) { + this.lastLoginDate = lastLoginDate; + return this; + } + + public FnUserBuilder setActiveYn( + @Size(max = 1) @SafeHtml @NotNull(message = "activeYn must not be null") String activeYn) { + this.activeYn = activeYn; + return this; + } + + public FnUserBuilder setCreatedId(@Valid FnUser createdId) { + this.createdId = createdId; + return this; + } + + public FnUserBuilder setCreatedDate(@PastOrPresent LocalDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + public FnUserBuilder setModifiedId(@Digits(integer = 11, fraction = 0) FnUser modifiedId) { + this.modifiedId = modifiedId; + return this; + } + + public FnUserBuilder setModifiedDate(@PastOrPresent LocalDateTime modifiedDate) { + this.modifiedDate = modifiedDate; + return this; + } + + public FnUserBuilder setIsInternalYn( + @Size(max = 1) @SafeHtml @NotNull(message = "isInternalYn must not be null") String isInternalYn) { + this.isInternalYn = isInternalYn; + return this; + } + + public FnUserBuilder setAddressLine1(@Size(max = 100) @SafeHtml String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + public FnUserBuilder setAddressLine2(@Size(max = 100) @SafeHtml String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + public FnUserBuilder setCity(@Size(max = 50) @SafeHtml String city) { + this.city = city; + return this; + } + + public FnUserBuilder setStateCd(@Size(max = 3) @SafeHtml String stateCd) { + this.stateCd = stateCd; + return this; + } + + public FnUserBuilder setZipCode(@Size(max = 11) @SafeHtml String zipCode) { + this.zipCode = zipCode; + return this; + } + + public FnUserBuilder setCountryCd(@Size(max = 3) @SafeHtml String countryCd) { + this.countryCd = countryCd; + return this; + } + + public FnUserBuilder setLocationClli(@Size(max = 8) @SafeHtml String locationClli) { + this.locationClli = locationClli; + return this; + } + + public FnUserBuilder setOrgManagerUserId(@Size(max = 20) @SafeHtml String orgManagerUserId) { + this.orgManagerUserId = orgManagerUserId; + return this; + } + + public FnUserBuilder setCompany(@Size(max = 100) @SafeHtml String company) { + this.company = company; + return this; + } + + public FnUserBuilder setDepartmentName(@Size(max = 200) @SafeHtml String departmentName) { + this.departmentName = departmentName; + return this; + } + + public FnUserBuilder setJobTitle(@Size(max = 100) @SafeHtml String jobTitle) { + this.jobTitle = jobTitle; + return this; + } + + public FnUserBuilder setTimezone(@Valid FnLuTimezone timezone) { + this.timezone = timezone; + return this; + } + + public FnUserBuilder setDepartment(@Size(max = 25) @SafeHtml String department) { + this.department = department; + return this; + } + + public FnUserBuilder setBusinessUnit(@Size(max = 25) @SafeHtml String businessUnit) { + this.businessUnit = businessUnit; + return this; + } + + public FnUserBuilder setBusinessUnitName(@Size(max = 100) @SafeHtml String businessUnitName) { + this.businessUnitName = businessUnitName; + return this; + } + + public FnUserBuilder setCost_center(@Size(max = 25) @SafeHtml String cost_center) { + this.cost_center = cost_center; + return this; + } + + public FnUserBuilder setFinLocCode(@Size(max = 10) @SafeHtml String finLocCode) { + this.finLocCode = finLocCode; + return this; + } + + public FnUserBuilder setSiloStatus(@Size(max = 10) @SafeHtml String siloStatus) { + this.siloStatus = siloStatus; + return this; + } + + public FnUserBuilder setLanguageId( + @Valid @NotNull(message = "languageId must not be null") FnLanguage languageId) { + this.languageId = languageId; + return this; + } + + public FnUserBuilder setGuest(@NotNull(message = "guest must not be null") boolean guest) { + this.guest = guest; + return this; + } + + public FnUserBuilder setCrReportFileHistorie(Set<CrReportFileHistory> crReportFileHistorie) { + this.crReportFileHistorie = crReportFileHistorie; + return this; + } + + public FnUserBuilder setFnRoles(Set<FnRole> fnRoles) { + this.fnRoles = fnRoles; + return this; + } + + public FnUserBuilder setFnRoleList(Set<FnMenuFunctional> fnRoleList) { + this.fnRoleList = fnRoleList; + return this; + } + + public FnUserBuilder setFnAuditLogs(Set<FnAuditLog> fnAuditLogs) { + this.fnAuditLogs = fnAuditLogs; + return this; + } + + public FnUserBuilder setFnUsersCreatedId(Set<FnUser> fnUsersCreatedId) { + this.fnUsersCreatedId = fnUsersCreatedId; + return this; + } + + public FnUserBuilder setFnUsersManagerId(Set<FnUser> fnUsersManagerId) { + this.fnUsersManagerId = fnUsersManagerId; + return this; + } + + public FnUserBuilder setFnUsersModifiedId(Set<FnUser> fnUsersModifiedId) { + this.fnUsersModifiedId = fnUsersModifiedId; + return this; + } + + public FnUserBuilder setEpUserRolesRequests(Set<EpUserRolesRequest> epUserRolesRequests) { + this.epUserRolesRequests = epUserRolesRequests; + return this; + } + + public FnUserBuilder setPersUserAppSels(Set<FnPersUserAppSel> persUserAppSels) { + this.persUserAppSels = persUserAppSels; + return this; + } + + public FnUserBuilder setEpWidgetCatalogParameters(Set<EpWidgetCatalogParameter> epWidgetCatalogParameters) { + this.epWidgetCatalogParameters = epWidgetCatalogParameters; + return this; + } + + public FnUserBuilder setEpPersUserWidgetPlacements(Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements) { + this.epPersUserWidgetPlacements = epPersUserWidgetPlacements; + return this; + } + + public FnUserBuilder setEpPersUserWidgetSels(Set<EpPersUserWidgetSel> epPersUserWidgetSels) { + this.epPersUserWidgetSels = epPersUserWidgetSels; + return this; + } + + public FnUserBuilder setFnUserRoles(Set<FnUserRole> fnUserRoles) { + this.fnUserRoles = fnUserRoles; + return this; + } + + public FnUserBuilder setEpUserNotifications(Set<EpUserNotification> epUserNotifications) { + this.epUserNotifications = epUserNotifications; + return this; + } + + public FnUser createFnUser() { + return new FnUser(userId, orgId, managerId, firstName, middleName, lastName, phone, fax, cellular, email, + addressId, alertMethodCd, hrid, orgUserId, org_code, loginId, loginPwd, lastLoginDate, activeYn, + createdId, createdDate, modifiedId, modifiedDate, isInternalYn, addressLine1, addressLine2, city, + stateCd, zipCode, countryCd, locationClli, orgManagerUserId, company, departmentName, jobTitle, + timezone, department, businessUnit, businessUnitName, cost_center, finLocCode, siloStatus, + languageId, guest, crReportFileHistorie, fnRoles, fnRoleList, fnAuditLogs, fnUsersCreatedId, + fnUsersManagerId, fnUsersModifiedId, epUserRolesRequests, persUserAppSels, + epWidgetCatalogParameters, epPersUserWidgetPlacements, epPersUserWidgetSels, fnUserRoles, + epUserNotifications); + } +}
\ No newline at end of file diff --git a/portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserDtoBuilder.java b/portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserDtoBuilder.java new file mode 100644 index 00000000..c6075dd6 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserDtoBuilder.java @@ -0,0 +1,331 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.builder; + +import java.time.LocalDateTime; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.onap.portal.domain.dto.fn.FnUserDto; +import org.springframework.stereotype.Component; + +@Component +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +public class FnUserDtoBuilder { + + private Long userId; + private Long orgId; + private Long managerId; + private String firstName; + private String middleName; + 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 org_code; + private String loginId; + private String loginPwd; + private LocalDateTime lastLoginDate; + private String activeYn; + private Long createdId; + private LocalDateTime createdDate; + private Long modifiedId; + private LocalDateTime modifiedDate; + private String isInternalYn; + private String addressLine1; + private String addressLine2; + private String city; + private String stateCd; + private String zipCode; + private String countryCd; + private String locationClli; + private String orgManagerUserId; + private String company; + private String departmentName; + private String jobTitle; + private Long timezone; + private String department; + private String businessUnit; + private String businessUnitName; + private String cost_center; + private String finLocCode; + private String siloStatus; + private Long languageId; + private boolean guest; + + public FnUserDtoBuilder setUserId(Long userId) { + this.userId = userId; + return this; + } + + public FnUserDtoBuilder setOrgId(Long orgId) { + this.orgId = orgId; + return this; + } + + public FnUserDtoBuilder setManagerId(Long managerId) { + this.managerId = managerId; + return this; + } + + public FnUserDtoBuilder setFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + public FnUserDtoBuilder setMiddleName(String middleName) { + this.middleName = middleName; + return this; + } + + public FnUserDtoBuilder setLastName(String lastName) { + this.lastName = lastName; + return this; + } + + public FnUserDtoBuilder setPhone(String phone) { + this.phone = phone; + return this; + } + + public FnUserDtoBuilder setFax(String fax) { + this.fax = fax; + return this; + } + + public FnUserDtoBuilder setCellular(String cellular) { + this.cellular = cellular; + return this; + } + + public FnUserDtoBuilder setEmail(String email) { + this.email = email; + return this; + } + + public FnUserDtoBuilder setAddressId(Long addressId) { + this.addressId = addressId; + return this; + } + + public FnUserDtoBuilder setAlertMethodCd(String alertMethodCd) { + this.alertMethodCd = alertMethodCd; + return this; + } + + public FnUserDtoBuilder setHrid(String hrid) { + this.hrid = hrid; + return this; + } + + public FnUserDtoBuilder setOrgUserId(String orgUserId) { + this.orgUserId = orgUserId; + return this; + } + + public FnUserDtoBuilder setOrg_code(String org_code) { + this.org_code = org_code; + return this; + } + + public FnUserDtoBuilder setLoginId(String loginId) { + this.loginId = loginId; + return this; + } + + public FnUserDtoBuilder setLoginPwd(String loginPwd) { + this.loginPwd = loginPwd; + return this; + } + + public FnUserDtoBuilder setLastLoginDate(LocalDateTime lastLoginDate) { + this.lastLoginDate = lastLoginDate; + return this; + } + + public FnUserDtoBuilder setActiveYn(String activeYn) { + this.activeYn = activeYn; + return this; + } + + public FnUserDtoBuilder setCreatedId(Long createdId) { + this.createdId = createdId; + return this; + } + + public FnUserDtoBuilder setCreatedDate(LocalDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + public FnUserDtoBuilder setModifiedId(Long modifiedId) { + this.modifiedId = modifiedId; + return this; + } + + public FnUserDtoBuilder setModifiedDate(LocalDateTime modifiedDate) { + this.modifiedDate = modifiedDate; + return this; + } + + public FnUserDtoBuilder setIsInternalYn(String isInternalYn) { + this.isInternalYn = isInternalYn; + return this; + } + + public FnUserDtoBuilder setAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + public FnUserDtoBuilder setAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + public FnUserDtoBuilder setCity(String city) { + this.city = city; + return this; + } + + public FnUserDtoBuilder setStateCd(String stateCd) { + this.stateCd = stateCd; + return this; + } + + public FnUserDtoBuilder setZipCode(String zipCode) { + this.zipCode = zipCode; + return this; + } + + public FnUserDtoBuilder setCountryCd(String countryCd) { + this.countryCd = countryCd; + return this; + } + + public FnUserDtoBuilder setLocationClli(String locationClli) { + this.locationClli = locationClli; + return this; + } + + public FnUserDtoBuilder setOrgManagerUserId(String orgManagerUserId) { + this.orgManagerUserId = orgManagerUserId; + return this; + } + + public FnUserDtoBuilder setCompany(String company) { + this.company = company; + return this; + } + + public FnUserDtoBuilder setDepartmentName(String departmentName) { + this.departmentName = departmentName; + return this; + } + + public FnUserDtoBuilder setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + return this; + } + + public FnUserDtoBuilder setTimezone(Long timezone) { + this.timezone = timezone; + return this; + } + + public FnUserDtoBuilder setDepartment(String department) { + this.department = department; + return this; + } + + public FnUserDtoBuilder setBusinessUnit(String businessUnit) { + this.businessUnit = businessUnit; + return this; + } + + public FnUserDtoBuilder setBusinessUnitName(String businessUnitName) { + this.businessUnitName = businessUnitName; + return this; + } + + public FnUserDtoBuilder setCost_center(String cost_center) { + this.cost_center = cost_center; + return this; + } + + public FnUserDtoBuilder setFinLocCode(String finLocCode) { + this.finLocCode = finLocCode; + return this; + } + + public FnUserDtoBuilder setSiloStatus(String siloStatus) { + this.siloStatus = siloStatus; + return this; + } + + public FnUserDtoBuilder setLanguageId(Long languageId) { + this.languageId = languageId; + return this; + } + + public FnUserDtoBuilder setGuest(boolean guest) { + this.guest = guest; + return this; + } + + public FnUserDto createFnUserDto() { + return new FnUserDto(userId, orgId, managerId, firstName, middleName, lastName, phone, fax, cellular, + email, addressId, alertMethodCd, hrid, orgUserId, org_code, loginId, loginPwd, lastLoginDate, + activeYn, createdId, createdDate, modifiedId, modifiedDate, isInternalYn, addressLine1, + addressLine2, city, stateCd, zipCode, countryCd, locationClli, orgManagerUserId, company, + departmentName, jobTitle, timezone, department, businessUnit, businessUnitName, cost_center, + finLocCode, siloStatus, languageId, guest); + } +}
\ No newline at end of file diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFavoriteReports.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFavoriteReports.java index 2fab70e1..a1d4a9a0 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFavoriteReports.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFavoriteReports.java @@ -69,7 +69,7 @@ CREATE TABLE `cr_favorite_reports` ( @Table(name = "cr_favorite_reports") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @IdClass(CrFavoriteReportsId.class) diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolder.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolder.java index a2c4240e..1791eae7 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolder.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrFolder.java @@ -41,8 +41,7 @@ package org.onap.portal.domain.db.cr; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -128,5 +127,5 @@ public class CrFolder { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrFolder> crFolders = new ArrayList<>(); + private Set<CrFolder> crFolders; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrLuFileType.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrLuFileType.java index 46384602..83c28662 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrLuFileType.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrLuFileType.java @@ -41,13 +41,11 @@ package org.onap.portal.domain.db.cr; import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -106,6 +104,6 @@ public class CrLuFileType { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrReportFileHistory> crReportFileHistories = new ArrayList<>(); + private Set<CrReportFileHistory> crReportFileHistories; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReport.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReport.java index c25f8062..16b0512f 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReport.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReport.java @@ -42,8 +42,7 @@ package org.onap.portal.domain.db.cr; import java.io.Serializable; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Embeddable; @@ -96,7 +95,7 @@ CREATE TABLE `cr_report` ( }) @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity @@ -206,34 +205,34 @@ public class CrReport implements Serializable { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrReportSchedule> crReportSchedules = new ArrayList<>(); + private Set<CrReportSchedule> crReportSchedules; @OneToMany( targetEntity = CrReportAccess.class, mappedBy = "repId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrReportAccess> crReportAccesses = new ArrayList<>(); + private Set<CrReportAccess> crReportAccesses; @OneToMany( targetEntity = CrReportLog.class, mappedBy = "repId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrReportLog> crReportLogs = new ArrayList<>(); + private Set<CrReportLog> crReportLogs; @OneToMany( targetEntity = CrReportEmailSentLog.class, mappedBy = "repId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrReportEmailSentLog> crReportEmailSentLogs = new ArrayList<>(); + private Set<CrReportEmailSentLog> crReportEmailSentLogs; @OneToMany( targetEntity = CrReportFileHistory.class, mappedBy = "repId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrReportFileHistory> crReportFileHistories = new ArrayList<>(); + private Set<CrReportFileHistory> crReportFileHistories; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportAccess.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportAccess.java index 44a53d31..2eb50c74 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportAccess.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportAccess.java @@ -80,7 +80,7 @@ CREATE TABLE `cr_report_access` ( @Table(name = "cr_report_access") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportFileHistory.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportFileHistory.java index 049057d2..53daa684 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportFileHistory.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportFileHistory.java @@ -43,6 +43,7 @@ package org.onap.portal.domain.db.cr; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -176,5 +177,5 @@ public class CrReportFileHistory { joinColumns = {@JoinColumn(name = "hist_id", referencedColumnName = "hist_id")}, inverseJoinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "user_id")} ) - private List<FnUser> fnUserList = new ArrayList<>(); + private Set<FnUser> fnUserList; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportSchedule.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportSchedule.java index f3935ffc..6d09aa40 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportSchedule.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportSchedule.java @@ -41,8 +41,7 @@ package org.onap.portal.domain.db.cr; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -183,5 +182,5 @@ public class CrReportSchedule { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrReportScheduleUsers> crReportScheduleUsers = new ArrayList<>(); + private Set<CrReportScheduleUsers> crReportScheduleUsers; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportScheduleUsers.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportScheduleUsers.java index 76c213c3..b607671f 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportScheduleUsers.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrReportScheduleUsers.java @@ -78,7 +78,7 @@ CREATE TABLE `cr_report_schedule_users` ( @Table(name = "cr_report_schedule_users") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableRole.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableRole.java index 9487b97b..445e87aa 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableRole.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableRole.java @@ -73,7 +73,7 @@ CREATE TABLE `cr_table_role` ( @Table(name = "cr_table_role") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableSource.java b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableSource.java index a98999be..b37b2c08 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableSource.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/cr/CrTableSource.java @@ -42,6 +42,7 @@ package org.onap.portal.domain.db.cr; import java.util.ArrayList; import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -116,19 +117,19 @@ public class CrTableSource { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrTableJoin> crTableJoins = new ArrayList<>(); + private Set<CrTableJoin> crTableJoins; @OneToMany( targetEntity = CrTableJoin.class, mappedBy = "destTableName", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrTableJoin> crTableJoins1 = new ArrayList<>(); + private Set<CrTableJoin> crTableJoins1; @OneToMany( targetEntity = CrTableRole.class, mappedBy = "tableName", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<CrTableRole> crTableRoles = new ArrayList<>(); + private Set<CrTableRole> crTableRoles; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java index cae3b3b1..0f2f9500 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpAppFunction.java @@ -41,8 +41,7 @@ package org.onap.portal.domain.db.ep; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -78,7 +77,7 @@ CREATE TABLE `ep_app_function` ( */ @Table(name = "ep_app_function", indexes = {@Index(name = "fk_ep_app_function_app_id", columnList = "app_id")}) -@EqualsAndHashCode + @Getter @Setter @Entity @@ -108,7 +107,7 @@ public class EpAppFunction { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpAppRoleFunction> epAppRoleFunctions = new ArrayList<>(); + private Set<EpAppRoleFunction> epAppRoleFunctions; @Getter @Setter diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpBasicAuthAccount.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpBasicAuthAccount.java index a8e08749..130e987f 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpBasicAuthAccount.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpBasicAuthAccount.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.ep; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -110,5 +109,5 @@ public class EpBasicAuthAccount { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts = new ArrayList<>(); + private Set<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpoints.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpoints.java index 5ab4cb9e..ed1fabdf 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpoints.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpEndpoints.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.ep; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -95,6 +94,6 @@ public class EpEndpoints { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts = new ArrayList<>(); + private Set<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java index 35e51be6..aa43fbe3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.ep; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -90,7 +89,7 @@ CREATE TABLE `ep_microservice` ( }) @NoArgsConstructor @AllArgsConstructor -@ToString + @Getter @Setter @Entity @@ -136,14 +135,14 @@ public class EpMicroservice { @SafeHtml private String active; @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - private List<EpWidgetCatalog> epWidgetCatalogList = new ArrayList<>(); + private Set<EpWidgetCatalog> epWidgetCatalogList; @OneToMany( targetEntity = EpMicroserviceParameter.class, mappedBy = "serviceId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpMicroserviceParameter> epMicroserviceParameters = new ArrayList<>(); + private Set<EpMicroserviceParameter> epMicroserviceParameters; public void copyOf(final EpMicroservice epMicroservice) { this.id = epMicroservice.getId(); diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroserviceParameter.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroserviceParameter.java index 51ca6f2b..c66ca723 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroserviceParameter.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroserviceParameter.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.ep; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -88,7 +87,7 @@ CREATE TABLE `ep_microservice_parameter` ( }) @NoArgsConstructor @AllArgsConstructor -@ToString + @Getter @Setter @Entity @@ -116,6 +115,6 @@ public class EpMicroserviceParameter { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpWidgetCatalogParameter> epWidgetCatalogParameters = new ArrayList<>(); + private Set<EpWidgetCatalogParameter> epWidgetCatalogParameter; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlModel.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlModel.java index 270c9927..d865fa41 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlModel.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlModel.java @@ -69,7 +69,7 @@ CREATE TABLE `ep_ml_model` ( @Table(name = "ep_ml_model") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlRec.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlRec.java index 2ed3f13b..190405cd 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlRec.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlRec.java @@ -70,7 +70,7 @@ CREATE TABLE `ep_ml_rec` ( @Table(name = "ep_ml_rec") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlUser.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlUser.java index 0f17d25d..59ff5608 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlUser.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMlUser.java @@ -72,7 +72,7 @@ CREATE TABLE `ep_ml_user` ( @Table(name = "ep_ml_user") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java index 4fe24bd7..12c161f6 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java @@ -41,8 +41,7 @@ package org.onap.portal.domain.db.ep; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -148,12 +147,12 @@ public class EpNotification { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpRoleNotification> epRoleNotifications = new ArrayList<>(); + private Set<EpRoleNotification> epRoleNotifications; @OneToMany( targetEntity = EpUserNotification.class, mappedBy = "notificationId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpUserNotification> epUserNotifications = new ArrayList<>(); + private Set<EpUserNotification> epUserNotifications; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequest.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequest.java index 0d8bfc88..13d26f71 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequest.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpUserRolesRequest.java @@ -41,8 +41,7 @@ package org.onap.portal.domain.db.ep; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -122,5 +121,5 @@ public class EpUserRolesRequest { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpUserRolesRequestDet> epUserRolesRequestDets = new ArrayList<>(); + private Set<EpUserRolesRequestDet> epUserRolesRequestDets; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java index 7bfbee8c..a125e1d1 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.ep; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -122,40 +121,40 @@ public class EpWidgetCatalog { @Index(name = "FK_EP_WIDGET_MICROSERVICE_EP_WIDGET", columnList = "widget_id") } ) - private List<EpMicroservice> epMicroservices = new ArrayList<>(); + private Set<EpMicroservice> epMicroservices; @OneToMany( targetEntity = EpWidgetCatalogRole.class, mappedBy = "widgetId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpWidgetCatalogRole> widgetCatalogRoles = new ArrayList<>(); + private Set<EpWidgetCatalogRole> widgetCatalogRoles; @OneToMany( targetEntity = EpPersUserWidgetSel.class, mappedBy = "widgetId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpPersUserWidgetSel> epPersUserWidgetSels = new ArrayList<>(); + private Set<EpPersUserWidgetSel> epPersUserWidgetSels; @OneToMany( targetEntity = EpPersUserWidgetSel.class, mappedBy = "widgetId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpPersUserWidgetSel> persUserWidgetSels = new ArrayList<>(); + private Set<EpPersUserWidgetSel> persUserWidgetSels; @OneToMany( targetEntity = EpPersUserWidgetPlacement.class, mappedBy = "widgetId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpPersUserWidgetPlacement> epPersUserWidgetPlacements = new ArrayList<>(); + private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements; @OneToMany( targetEntity = EpWidgetCatalogParameter.class, mappedBy = "widgetId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpWidgetCatalogParameter> epWidgetCatalogParameters = new ArrayList<>(); + private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java index 84f6aea0..cdc20897 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java @@ -41,8 +41,7 @@ package org.onap.portal.domain.db.fn; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Embeddable; @@ -227,61 +226,61 @@ public class FnApp extends DomainVo implements Serializable { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnMenuFunctionalRoles> fnMenuFunctionalRoles = new ArrayList<>(); + private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles; @OneToMany( targetEntity = EpUserRolesRequest.class, mappedBy = "appId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpUserRolesRequest> epUserRolesRequests = new ArrayList<>(); + private Set<EpUserRolesRequest> epUserRolesRequests; @OneToMany( targetEntity = EpAppFunction.class, mappedBy = "appId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpAppFunction> epAppFunctions = new ArrayList<>(); + private Set<EpAppFunction> epAppFunctions; @OneToMany( targetEntity = EpAppRoleFunction.class, mappedBy = "appId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpAppRoleFunction> epAppRoleFunctions = new ArrayList<>(); + private Set<EpAppRoleFunction> epAppRoleFunctions; @OneToMany( targetEntity = FnUserRole.class, mappedBy = "appId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnUserRole> fnUserRoles = new ArrayList<>(); + private Set<FnUserRole> fnUserRoles; @OneToMany( targetEntity = EpWebAnalyticsSource.class, mappedBy = "appId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpWebAnalyticsSource> epWebAnalyticsSources = new ArrayList<>(); + private Set<EpWebAnalyticsSource> epWebAnalyticsSources; @OneToMany( targetEntity = EpWidgetCatalogRole.class, mappedBy = "appId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpWidgetCatalogRole> epWidgetCatalogRoles = new ArrayList<>(); + private Set<EpWidgetCatalogRole> epWidgetCatalogRoles; @OneToMany( targetEntity = EpMicroservice.class, mappedBy = "appId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpMicroservice> epMicroservices = new ArrayList<>(); + private Set<EpMicroservice> epMicroservices; @OneToMany( targetEntity = FnPersUserAppSel.class, mappedBy = "appId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnPersUserAppSel> fnPersUserAppSels = new ArrayList<>(); + private Set<FnPersUserAppSel> fnPersUserAppSels; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditLog.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditLog.java index 8f5e5c0b..469fb74a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditLog.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnAuditLog.java @@ -94,7 +94,7 @@ public class FnAuditLog { @Column(name = "log_id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT") @Digits(integer = 11, fraction = 0) private Integer logId; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "user_id", nullable = false) @NotNull @Valid diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnFunction.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnFunction.java index 16353515..41ac1d6b 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnFunction.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnFunction.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -88,19 +87,19 @@ public class FnFunction { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnRestrictedUrl> fnRestrictedUrls = new ArrayList<>(); + private Set<FnRestrictedUrl> fnRestrictedUrls; @OneToMany( targetEntity = FnRoleFunction.class, mappedBy = "functionCd", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnRoleFunction> fnRoleFunctions = new ArrayList<>(); + private Set<FnRoleFunction> fnRoleFunctions; @OneToMany( targetEntity = FnTab.class, mappedBy = "functionCd", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnTab> fnTabs = new ArrayList<>(); + private Set<FnTab> fnTabs; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java index d9aff94c..a5255f30 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java @@ -41,8 +41,7 @@ package org.onap.portal.domain.db.fn; import com.fasterxml.jackson.annotation.JsonInclude; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -74,7 +73,7 @@ CREATE TABLE `fn_language` ( @Table(name = "fn_language") @NoArgsConstructor @AllArgsConstructor -@ToString + @Getter @Setter @Entity @@ -101,8 +100,17 @@ public class FnLanguage { targetEntity = FnUser.class, mappedBy = "languageId", cascade = CascadeType.ALL, - fetch = FetchType.EAGER + fetch = FetchType.LAZY ) - private List<FnUser> fnUsers = new ArrayList<>(); + private Set<FnUser> fnUsers; + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("FnLanguage{"); + sb.append("languageId=").append(languageId); + sb.append(", languageName='").append(languageName).append('\''); + sb.append(", languageAlias='").append(languageAlias).append('\''); + sb.append('}'); + return sb.toString(); + } } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuActivity.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuActivity.java index dc5c7e27..6b0b47c5 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuActivity.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuActivity.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -89,5 +88,5 @@ public class FnLuActivity { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnAuditLog> fnAuditLogs = new ArrayList<>(); + private Set<FnAuditLog> fnAuditLogs; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuAlertMethod.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuAlertMethod.java index bc3ef682..6ee07167 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuAlertMethod.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuAlertMethod.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -89,5 +88,5 @@ public class FnLuAlertMethod { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnUser> fnUsers = new ArrayList<>(); + private Set<FnUser> fnUsers; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuMenuSet.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuMenuSet.java index 5f3459d7..3ac88232 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuMenuSet.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuMenuSet.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -93,5 +92,5 @@ public class FnLuMenuSet { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnMenu> fnMenus = new ArrayList<>(); + private Set<FnMenu> fnMenus; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTabSet.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTabSet.java index 7c9743a3..c8c7be22 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTabSet.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTabSet.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -88,5 +87,5 @@ public class FnLuTabSet { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnTab> fnTabs = new ArrayList<>(); + private Set<FnTab> fnTabs; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTimezone.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTimezone.java index b43474fe..53b54f41 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTimezone.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLuTimezone.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -78,7 +77,7 @@ public class FnLuTimezone { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "timezone_id", length = 11, nullable = false) - private Integer timezoneId; + private Long timezoneId; @Column(name = "timezone_name", length = 100, nullable = false) @Size(max = 100) @SafeHtml @@ -96,6 +95,6 @@ public class FnLuTimezone { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnUser> fnUsers = new ArrayList<>(); + private Set<FnUser> fnUsers; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenu.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenu.java index 007d6edd..3ba60c78 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenu.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenu.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -112,7 +111,7 @@ public class FnMenu { @Size(max = 100) @SafeHtml private String label; - @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "parent_Id", columnDefinition = "int(11) DEFAULT NULL") @Valid private FnMenu parentId; @@ -171,5 +170,5 @@ public class FnMenu { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnMenu> fnMenus = new ArrayList<>(); + private Set<FnMenu> fnMenus; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctional.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctional.java index bfdc673d..cd9a362d 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctional.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnMenuFunctional.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -134,26 +133,26 @@ public class FnMenuFunctional { @Index(name = "sys_c0014619", columnList = "menu_id") } ) - private List<FnUser> fnUsers = new ArrayList<>(); + private Set<FnUser> fnUsers; @OneToMany( targetEntity = FnMenuFunctionalAncestors.class, mappedBy = "menuId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnMenuFunctionalAncestors> fnMenuFunctionalAncestorsMenuId = new ArrayList<>(); + private Set<FnMenuFunctionalAncestors> fnMenuFunctionalAncestorsMenuId; @OneToMany( targetEntity = FnMenuFunctionalAncestors.class, mappedBy = "ancestorMenuId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnMenuFunctionalAncestors> fnMenuFunctionalsAncestorMenuId = new ArrayList<>(); + private Set<FnMenuFunctionalAncestors> fnMenuFunctionalsAncestorMenuId; @OneToMany( targetEntity = FnMenuFunctionalRoles.class, mappedBy = "menuId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnMenuFunctionalRoles> fnMenuFunctionalRoles = new ArrayList<>(); + private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnOrg.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnOrg.java index 44a5e848..14bd194a 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnOrg.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnOrg.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -77,7 +76,7 @@ CREATE TABLE `fn_org` ( }) @NoArgsConstructor @AllArgsConstructor -@ToString + @Getter @Setter @Entity @@ -86,7 +85,7 @@ public class FnOrg { @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "org_id", nullable = false, length = 11) @Digits(integer = 11, fraction = 0) - private Integer orgId; + private Long orgId; @Column(name = "org_name", length = 50, nullable = false) @Size(max = 50) @SafeHtml @@ -103,5 +102,5 @@ public class FnOrg { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnUser> fnUsers = new ArrayList<>(); + private Set<FnUser> fnUsers; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzBlobTriggers.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzBlobTriggers.java index b817a19d..74765c06 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzBlobTriggers.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzBlobTriggers.java @@ -77,7 +77,7 @@ CREATE TABLE `fn_qz_blob_triggers` ( }) @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCalendars.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCalendars.java index f901474c..d13ac345 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCalendars.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCalendars.java @@ -68,7 +68,7 @@ CREATE TABLE `fn_qz_calendars` ( @Table(name = "fn_qz_calendars") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCronTriggers.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCronTriggers.java index 21ae8dd2..82968f40 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCronTriggers.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzCronTriggers.java @@ -73,7 +73,7 @@ CREATE TABLE `fn_qz_cron_triggers` ( @Table(name = "fn_qz_cron_triggers") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzFiredTriggers.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzFiredTriggers.java index 7039437c..e4c15d28 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzFiredTriggers.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzFiredTriggers.java @@ -95,7 +95,7 @@ CREATE TABLE `fn_qz_fired_triggers` ( }) @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzJobDetails.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzJobDetails.java index 11ab5115..04426353 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzJobDetails.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzJobDetails.java @@ -41,8 +41,7 @@ package org.onap.portal.domain.db.fn; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -86,7 +85,7 @@ CREATE TABLE `fn_qz_job_details` ( }) @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity @@ -145,7 +144,7 @@ public class FnQzJobDetails { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnQzTriggers> selectedTabCd = new ArrayList<>(); + private Set<FnQzTriggers> selectedTabCd; @Getter @Setter diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzLocks.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzLocks.java index 1d9fc48a..cee0ebae 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzLocks.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzLocks.java @@ -66,7 +66,7 @@ CREATE TABLE `fn_qz_locks` ( @Table(name = "fn_qz_locks") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzPausedTriggerGrps.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzPausedTriggerGrps.java index a7bcdb3b..38c65400 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzPausedTriggerGrps.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzPausedTriggerGrps.java @@ -66,7 +66,7 @@ CREATE TABLE `fn_qz_paused_trigger_grps` ( @Table(name = "fn_qz_paused_trigger_grps") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSchedulerState.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSchedulerState.java index e19c2160..b9005a66 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSchedulerState.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSchedulerState.java @@ -71,7 +71,7 @@ CREATE TABLE `fn_qz_scheduler_state` ( @Table(name = "fn_qz_scheduler_state") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSimpleTriggers.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSimpleTriggers.java index f3f9a948..23ca4c31 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSimpleTriggers.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSimpleTriggers.java @@ -76,7 +76,7 @@ CREATE TABLE `fn_qz_simple_triggers` ( @Table(name = "fn_qz_simple_triggers") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSimpropTriggers.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSimpropTriggers.java index cef8f481..23a3e06e 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSimpropTriggers.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnQzSimpropTriggers.java @@ -83,7 +83,7 @@ CREATE TABLE `fn_qz_simprop_triggers` ( @Table(name = "fn_qz_simprop_triggers") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRestrictedUrl.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRestrictedUrl.java index bbe64053..35b619cf 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRestrictedUrl.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRestrictedUrl.java @@ -75,7 +75,7 @@ CREATE TABLE `fn_restricted_url` ( }) @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java index dc457883..eda3fb26 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnRole.java @@ -40,8 +40,7 @@ package org.onap.portal.domain.db.fn; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -154,7 +153,7 @@ public class FnRole { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnRoleFunction> fnRoleFunctions = new ArrayList<>(); + private Set<FnRoleFunction> fnRoleFunctions; @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinTable( name = "fn_user_pseudo_role", @@ -164,7 +163,7 @@ public class FnRole { @Index(name = "fk_pseudo_role_user_id", columnList = "user_id") } ) - private List<FnUser> fnUsers = new ArrayList<>(); + private Set<FnUser> fnUsers; @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinTable( name = "fn_role_composite", @@ -174,49 +173,50 @@ public class FnRole { @Index(name = "fk_fn_role_composite_child", columnList = "child_role_id") } ) - private List<FnRole> fnRoles = new ArrayList<>(); - @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - private List<FnRole> fnRoleList = new ArrayList<>(); + private Set<FnRole> fnRoles; + @ManyToMany(cascade = CascadeType.ALL, + fetch = FetchType.LAZY) + private Set<FnRole> fnRoleList; @OneToMany( targetEntity = EpRoleNotification.class, mappedBy = "notificationID", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpRoleNotification> epRoleNotifications = new ArrayList<>(); + private Set<EpRoleNotification> epRoleNotifications; @OneToMany( targetEntity = FnMenuFunctionalRoles.class, mappedBy = "roleId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnMenuFunctionalRoles> fnMenuFunctionalRoles = new ArrayList<>(); + private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles; @OneToMany( targetEntity = EpWidgetCatalogRole.class, mappedBy = "roleId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpWidgetCatalogRole> epWidgetCatalogRoles = new ArrayList<>(); + private Set<EpWidgetCatalogRole> epWidgetCatalogRoles; @OneToMany( targetEntity = EpAppRoleFunction.class, mappedBy = "fnRole", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpAppRoleFunction> epAppRoleFunctions = new ArrayList<>(); + private Set<EpAppRoleFunction> epAppRoleFunctions; @OneToMany( targetEntity = EpUserRolesRequestDet.class, mappedBy = "requestedRoleId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpUserRolesRequestDet> epUserRolesRequestDets = new ArrayList<>(); + private Set<EpUserRolesRequestDet> epUserRolesRequestDets; @OneToMany( targetEntity = FnUserRole.class, mappedBy = "roleId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnUserRole> fnUserRoles = new ArrayList<>(); + private Set<FnUserRole> fnUserRoles; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTab.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTab.java index 020b3107..bfc7834c 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTab.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTab.java @@ -41,8 +41,7 @@ package org.onap.portal.domain.db.fn; import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -142,6 +141,6 @@ public class FnTab { cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnTabSelected> selectedTabCd = new ArrayList<>(); + private Set<FnTabSelected> selectedTabCd; } diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTabSelected.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTabSelected.java index 8f4c10b3..f62668e1 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTabSelected.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnTabSelected.java @@ -73,7 +73,7 @@ CREATE TABLE `fn_tab_selected` ( @Table(name = "fn_tab_selected") @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java index 4747cdf8..cbca44c1 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java @@ -41,9 +41,9 @@ package org.onap.portal.domain.db.fn; import java.time.LocalDateTime; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; +import java.util.Set; +import java.util.UUID; import java.util.stream.Collectors; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -59,22 +59,20 @@ import javax.persistence.ManyToOne; import javax.persistence.NamedNativeQueries; import javax.persistence.NamedNativeQuery; import javax.persistence.OneToMany; -import javax.persistence.OneToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.UniqueConstraint; -import javax.validation.Valid; import javax.validation.constraints.Digits; import javax.validation.constraints.Email; import javax.validation.constraints.NotNull; import javax.validation.constraints.PastOrPresent; import javax.validation.constraints.Size; import lombok.AllArgsConstructor; -import lombok.Builder.Default; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import lombok.ToString; +import org.hibernate.annotations.DynamicUpdate; +import org.hibernate.annotations.GenericGenerator; import org.hibernate.validator.constraints.SafeHtml; import org.onap.portal.domain.db.cr.CrReportFileHistory; import org.onap.portal.domain.db.ep.EpPersUserWidgetPlacement; @@ -82,7 +80,6 @@ import org.onap.portal.domain.db.ep.EpPersUserWidgetSel; import org.onap.portal.domain.db.ep.EpUserNotification; import org.onap.portal.domain.db.ep.EpUserRolesRequest; import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter; -import org.onap.portal.domain.dto.DomainVo; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; @@ -170,13 +167,16 @@ CREATE TABLE `fn_user` ( uniqueConstraints = { @UniqueConstraint(name = "fn_user_hrid", columnNames = "hrid"), @UniqueConstraint(name = "fn_user_login_id", columnNames = "login_id") + }) -@NoArgsConstructor -@AllArgsConstructor + @Getter @Setter @Entity -@SequenceGenerator(name="seq", initialValue=1000, allocationSize=100000) +@NoArgsConstructor +@AllArgsConstructor +@DynamicUpdate +@SequenceGenerator(name = "seq", initialValue = 1000, allocationSize = 100000) public class FnUser implements UserDetails { @Id @@ -184,13 +184,11 @@ public class FnUser implements UserDetails { @Column(name = "user_id", length = 11, nullable = false) @Digits(integer = 11, fraction = 0) private Long userId; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "org_id", columnDefinition = "int(11) DEFAULT NULL") - @Valid private FnOrg orgId; @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "manager_id") - @Valid private FnUser managerId; @Column(name = "first_name", length = 50, columnDefinition = "varchar(50) DEFAULT NULL") @Size(max = 50) @@ -253,18 +251,16 @@ public class FnUser implements UserDetails { @Column(name = "active_yn", length = 1, columnDefinition = "character varying(1) default 'y'", nullable = false) @Size(max = 1) @SafeHtml - //@NotNull(message = "activeYn must not be null") + @NotNull(message = "activeYn must not be null") private String activeYn; @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "created_id") - @Valid private FnUser createdId; @Column(name = "created_date", columnDefinition = "datetime DEFAULT current_timestamp()", nullable = false) @PastOrPresent protected LocalDateTime createdDate; @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "modified_id") - @Valid private FnUser modifiedId; @Column(name = "modified_date", nullable = false, columnDefinition = "datetime default now()") @PastOrPresent @@ -272,7 +268,7 @@ public class FnUser implements UserDetails { @Column(name = "is_internal_yn", length = 1, columnDefinition = "character varying(1) default 'n'", nullable = false) @Size(max = 1) @SafeHtml - //@NotNull(message = "isInternalYn must not be null") + @NotNull(message = "isInternalYn must not be null") private String isInternalYn; @Column(name = "address_line_1", length = 100, columnDefinition = "varchar(100) DEFAULT NULL") @Size(max = 100) @@ -320,7 +316,6 @@ public class FnUser implements UserDetails { private String jobTitle; @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "timezone", columnDefinition = "int(11) DEFAULT NULL") - @Valid private FnLuTimezone timezone; @Column(name = "department", length = 25, columnDefinition = "varchar(25) DEFAULT NULL") @Size(max = 25) @@ -346,97 +341,96 @@ public class FnUser implements UserDetails { @Size(max = 10) @SafeHtml private String siloStatus; - @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "language_id", nullable = false, columnDefinition = "int(11) DEFAULT 1") - @Valid - //@NotNull(message = "languageId must not be null") + @NotNull(message = "languageId must not be null") private FnLanguage languageId; @Column(name = "is_guest", columnDefinition = "boolean default 0", nullable = false) @NotNull(message = "guest must not be null") private boolean guest; @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "fnUserList") - private List<CrReportFileHistory> crReportFileHistorie = new ArrayList<>(); - @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) - private List<FnRole> fnRoles = new ArrayList<>(); + private Set<CrReportFileHistory> crReportFileHistorie; + @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Set<FnRole> fnRoles; @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - private List<FnMenuFunctional> fnRoleList = new ArrayList<>(); + private Set<FnMenuFunctional> fnRoleList; @OneToMany( targetEntity = FnAuditLog.class, mappedBy = "userId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnAuditLog> fnAuditLogs = new ArrayList<>(); + private Set<FnAuditLog> fnAuditLogs; @OneToMany( targetEntity = FnUser.class, mappedBy = "createdId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnUser> fnUsersCreatedId = new ArrayList<>(); + private Set<FnUser> fnUsersCreatedId; @OneToMany( targetEntity = FnUser.class, mappedBy = "managerId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnUser> fnUsersManagerId = new ArrayList<>(); + private Set<FnUser> fnUsersManagerId; @OneToMany( targetEntity = FnUser.class, mappedBy = "modifiedId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnUser> fnUsersModifiedId = new ArrayList<>(); + private Set<FnUser> fnUsersModifiedId; @OneToMany( targetEntity = EpUserRolesRequest.class, mappedBy = "userId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpUserRolesRequest> epUserRolesRequests = new ArrayList<>(); + private Set<EpUserRolesRequest> epUserRolesRequests; @OneToMany( targetEntity = FnPersUserAppSel.class, mappedBy = "userId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnPersUserAppSel> persUserAppSels = new ArrayList<>(); + private Set<FnPersUserAppSel> persUserAppSels; @OneToMany( targetEntity = EpWidgetCatalogParameter.class, mappedBy = "userId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpWidgetCatalogParameter> epWidgetCatalogParameters = new ArrayList<>(); + private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters; @OneToMany( targetEntity = EpPersUserWidgetPlacement.class, mappedBy = "userId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpPersUserWidgetPlacement> epPersUserWidgetPlacements = new ArrayList<>(); + private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements; @OneToMany( targetEntity = EpPersUserWidgetSel.class, mappedBy = "userId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpPersUserWidgetSel> epPersUserWidgetSels = new ArrayList<>(); + private Set<EpPersUserWidgetSel> epPersUserWidgetSels; @OneToMany( targetEntity = FnUserRole.class, mappedBy = "userId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<FnUserRole> fnUserRoles = new ArrayList<>(); + private Set<FnUserRole> fnUserRoles; @OneToMany( targetEntity = EpUserNotification.class, mappedBy = "userId", cascade = CascadeType.ALL, fetch = FetchType.LAZY ) - private List<EpUserNotification> epUserNotifications = new ArrayList<>(); + private Set<EpUserNotification> epUserNotifications; @Override public Collection<? extends GrantedAuthority> getAuthorities() { diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUserRole.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUserRole.java index 2eecd741..fb23405e 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUserRole.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUserRole.java @@ -103,7 +103,7 @@ CREATE TABLE `fn_user_role` ( }) @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode + @Getter @Setter @Entity @@ -113,11 +113,11 @@ public class FnUserRole { @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", columnDefinition = "int(11) auto_increment") private Long id; - @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "user_id") @Valid private FnUser userId; - @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "role_id") @Valid private FnRole roleId; diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java index 305af8e6..6c722bf2 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/DomainVo.java @@ -1,3 +1,43 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + package org.onap.portal.domain.dto; import java.io.ByteArrayInputStream; @@ -19,7 +59,7 @@ import org.onap.portalsdk.core.domain.FusionVo; @Getter @Setter -@EqualsAndHashCode + @NoArgsConstructor @AllArgsConstructor @Inheritance(strategy = InheritanceType.JOINED) diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/fn/FnLanguageDto.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/fn/FnLanguageDto.java new file mode 100644 index 00000000..8dfbda5e --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/fn/FnLanguageDto.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.fn; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@NoArgsConstructor +@AllArgsConstructor + +public class FnLanguageDto { + private Long languageId; + private String languageName; + private String languageAlias; +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/dto/fn/FnUserDto.java b/portal-BE/src/main/java/org/onap/portal/domain/dto/fn/FnUserDto.java new file mode 100644 index 00000000..0da1f591 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/dto/fn/FnUserDto.java @@ -0,0 +1,100 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.dto.fn; + +import java.time.LocalDateTime; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter + +@NoArgsConstructor +@AllArgsConstructor +public class FnUserDto { + private Long userId; + private Long orgId; + private Long managerId; + private String firstName; + private String middleName; + 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 org_code; + private String loginId; + private String loginPwd; + protected LocalDateTime lastLoginDate; + private String activeYn; + private Long createdId; + protected LocalDateTime createdDate; + private Long modifiedId; + protected LocalDateTime modifiedDate; + private String isInternalYn = "n"; + private String addressLine1; + private String addressLine2; + private String city; + private String stateCd; + private String zipCode; + private String countryCd; + private String locationClli; + private String orgManagerUserId; + private String company; + private String departmentName; + private String jobTitle; + private Long timezone; + private String department; + private String businessUnit; + private String businessUnitName; + private String cost_center; + private String finLocCode; + private String siloStatus; + private Long languageId; + private boolean guest; +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnLanguageMapper.java b/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnLanguageMapper.java new file mode 100644 index 00000000..b885bfd6 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnLanguageMapper.java @@ -0,0 +1,64 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.mapper; + +import java.util.List; +import java.util.stream.Collectors; +import org.onap.portal.domain.db.fn.FnLanguage; +import org.onap.portal.domain.dto.fn.FnLanguageDto; +import org.springframework.stereotype.Component; + +@Component +public class FnLanguageMapper { + + public FnLanguageDto fnLanguageToDto(final FnLanguage fnLanguage){ + FnLanguageDto dto = new FnLanguageDto(); + dto.setLanguageId(fnLanguage.getLanguageId()); + dto.setLanguageName(fnLanguage.getLanguageName()); + dto.setLanguageAlias(fnLanguage.getLanguageAlias()); + return dto; + } + + public List<FnLanguageDto> fnLanguageListToDtoList(final List<FnLanguage> fnLanguages){ + return fnLanguages.stream().map(this::fnLanguageToDto).collect( + Collectors.toList()); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnUserMapper.java b/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnUserMapper.java new file mode 100644 index 00000000..757eff51 --- /dev/null +++ b/portal-BE/src/main/java/org/onap/portal/domain/mapper/FnUserMapper.java @@ -0,0 +1,160 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portal.domain.mapper; + +import lombok.NoArgsConstructor; +import org.onap.portal.domain.builder.FnUserBuilder; +import org.onap.portal.domain.builder.FnUserDtoBuilder; +import org.onap.portal.domain.db.fn.FnUser; +import org.onap.portal.domain.dto.fn.FnUserDto; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +@NoArgsConstructor +public class FnUserMapper { + + private FnUserDtoBuilder fnUserDtoBuilder; + private FnUserBuilder fnUserBuilder; + + @Autowired + public FnUserMapper(final FnUserDtoBuilder fnUserDtoBuilder, + FnUserBuilder fnUserBuilder) { + this.fnUserDtoBuilder = fnUserDtoBuilder; + this.fnUserBuilder = fnUserBuilder; + } + + public FnUserDto fnUserToFnUserDto(final FnUser fnUser){ + return fnUserDtoBuilder + .setUserId(fnUser.getUserId()) + .setOrgId(fnUser.getOrgId().getOrgId()) + .setManagerId(fnUser.getManagerId().getUserId()) + .setFirstName(fnUser.getFirstName()) + .setMiddleName(fnUser.getMiddleName()) + .setLastName(fnUser.getLastName()) + .setPhone(fnUser.getPhone()) + .setFax(fnUser.getFax()) + .setCellular(fnUser.getCellular()) + .setEmail(fnUser.getEmail()) + .setAddressId(fnUser.getAddressId()) + .setAlertMethodCd(fnUser.getAlertMethodCd().getAlertMethodCd()) + .setHrid(fnUser.getHrid()) + .setOrgUserId(fnUser.getOrgUserId()) + .setOrg_code(fnUser.getOrg_code()) + .setLoginId(fnUser.getLoginId()) + .setLoginPwd(fnUser.getLoginPwd()) + .setLastLoginDate(fnUser.getLastLoginDate()) + .setActiveYn(fnUser.getActiveYn()) + .setCreatedId(fnUser.getCreatedId().getUserId()) + .setCreatedDate(fnUser.getCreatedDate()) + .setModifiedId(fnUser.getModifiedId().getUserId()) + .setModifiedDate(fnUser.getModifiedDate()) + .setIsInternalYn(fnUser.getIsInternalYn()) + .setAddressLine1(fnUser.getAddressLine1()) + .setAddressLine2(fnUser.getAddressLine2()) + .setCity(fnUser.getCity()) + .setStateCd(fnUser.getStateCd()) + .setZipCode(fnUser.getZipCode()) + .setCountryCd(fnUser.getCountryCd()) + .setLocationClli(fnUser.getLocationClli()) + .setOrgManagerUserId(fnUser.getOrgManagerUserId()) + .setCompany(fnUser.getCompany()) + .setDepartmentName(fnUser.getDepartmentName()) + .setJobTitle(fnUser.getJobTitle()) + .setTimezone(fnUser.getTimezone().getTimezoneId()) + .setDepartment(fnUser.getDepartment()) + .setBusinessUnit(fnUser.getBusinessUnit()) + .setBusinessUnitName(fnUser.getBusinessUnitName()) + .setCost_center(fnUser.getCost_center()) + .setFinLocCode(fnUser.getFinLocCode()) + .setSiloStatus(fnUser.getSiloStatus()) + .setLanguageId(fnUser.getLanguageId().getLanguageId()) + .setGuest(fnUser.isGuest()).createFnUserDto(); + } + + public FnUser fnUserToFnUser(final FnUser fnUser){ + return fnUserBuilder + .setUserId(fnUser.getUserId()) + .setOrgId(fnUser.getOrgId()) + .setManagerId(fnUser.getManagerId()) + .setFirstName(fnUser.getFirstName()) + .setMiddleName(fnUser.getMiddleName()) + .setLastName(fnUser.getLastName()) + .setPhone(fnUser.getPhone()) + .setFax(fnUser.getFax()) + .setCellular(fnUser.getCellular()) + .setEmail(fnUser.getEmail()) + .setAddressId(fnUser.getAddressId()) + .setAlertMethodCd(fnUser.getAlertMethodCd()) + .setHrid(fnUser.getHrid()) + .setOrgUserId(fnUser.getOrgUserId()) + .setOrg_code(fnUser.getOrg_code()) + .setLoginId(fnUser.getLoginId()) + .setLoginPwd(fnUser.getLoginPwd()) + .setLastLoginDate(fnUser.getLastLoginDate()) + .setActiveYn(fnUser.getActiveYn()) + .setCreatedId(fnUser.getCreatedId()) + .setCreatedDate(fnUser.getCreatedDate()) + .setModifiedId(fnUser.getModifiedId()) + .setModifiedDate(fnUser.getModifiedDate()) + .setIsInternalYn(fnUser.getIsInternalYn()) + .setAddressLine1(fnUser.getAddressLine1()) + .setAddressLine2(fnUser.getAddressLine2()) + .setCity(fnUser.getCity()) + .setStateCd(fnUser.getStateCd()) + .setZipCode(fnUser.getZipCode()) + .setCountryCd(fnUser.getCountryCd()) + .setLocationClli(fnUser.getLocationClli()) + .setOrgManagerUserId(fnUser.getOrgManagerUserId()) + .setCompany(fnUser.getCompany()) + .setDepartmentName(fnUser.getDepartmentName()) + .setJobTitle(fnUser.getJobTitle()) + .setTimezone(fnUser.getTimezone()) + .setDepartment(fnUser.getDepartment()) + .setBusinessUnit(fnUser.getBusinessUnit()) + .setBusinessUnitName(fnUser.getBusinessUnitName()) + .setCost_center(fnUser.getCost_center()) + .setFinLocCode(fnUser.getFinLocCode()) + .setSiloStatus(fnUser.getSiloStatus()) + .setLanguageId(fnUser.getLanguageId()) + .setGuest(fnUser.isGuest()).createFnUser(); + } +} diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnLuTimezoneService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnLuTimezoneService.java index ea3dd386..ebb5d332 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnLuTimezoneService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/fn/FnLuTimezoneService.java @@ -57,7 +57,7 @@ public class FnLuTimezoneService { this.fnLuTimezoneDao = fnLuTimezoneDao; } - public Optional<FnLuTimezone> getById(Integer id){ + public Optional<FnLuTimezone> getById(Long id){ return fnLuTimezoneDao.findById(id); } } diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java index b06abfb5..eb40a521 100644 --- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java +++ b/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java @@ -108,4 +108,8 @@ public class FnUserService implements UserDetailsService { public void deleteUser(FnUser fnUser){ fnUserDao.delete(fnUser); } + + public boolean existById(Long userId) { + return fnUserDao.existsById(userId); + } } |