+/*
+ * ============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;
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;
@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");
}
}
}
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;
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;
}
@Repository
@Transactional
-public interface FnLuTimezoneDao extends JpaRepository<FnLuTimezone, Integer> {
+public interface FnLuTimezoneDao extends JpaRepository<FnLuTimezone, Long> {
}
--- /dev/null
+/*
+ * ============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
--- /dev/null
+/*
+ * ============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
@Table(name = "cr_favorite_reports")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@IdClass(CrFavoriteReportsId.class)
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<CrFolder> crFolders = new ArrayList<>();
+ private Set<CrFolder> crFolders;
}
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<CrReportFileHistory> crReportFileHistories = new ArrayList<>();
+ private Set<CrReportFileHistory> crReportFileHistories;
}
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;
})
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
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;
}
@Table(name = "cr_report_access")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
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;
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;
}
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<CrReportScheduleUsers> crReportScheduleUsers = new ArrayList<>();
+ private Set<CrReportScheduleUsers> crReportScheduleUsers;
}
@Table(name = "cr_report_schedule_users")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@Table(name = "cr_table_role")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
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;
}
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;
*/
@Table(name = "ep_app_function", indexes = {@Index(name = "fk_ep_app_function_app_id", columnList = "app_id")})
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<EpAppRoleFunction> epAppRoleFunctions = new ArrayList<>();
+ private Set<EpAppRoleFunction> epAppRoleFunctions;
@Getter
@Setter
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts = new ArrayList<>();
+ private Set<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts;
}
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts = new ArrayList<>();
+ private Set<EpEndpointsBasicAuthAccount> epEndpointsBasicAuthAccounts;
}
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;
})
@NoArgsConstructor
@AllArgsConstructor
-@ToString
+
@Getter
@Setter
@Entity
@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();
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;
})
@NoArgsConstructor
@AllArgsConstructor
-@ToString
+
@Getter
@Setter
@Entity
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<EpWidgetCatalogParameter> epWidgetCatalogParameters = new ArrayList<>();
+ private Set<EpWidgetCatalogParameter> epWidgetCatalogParameter;
}
@Table(name = "ep_ml_model")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@Table(name = "ep_ml_rec")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@Table(name = "ep_ml_user")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
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;
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;
}
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<EpUserRolesRequestDet> epUserRolesRequestDets = new ArrayList<>();
+ private Set<EpUserRolesRequestDet> epUserRolesRequestDets;
}
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;
@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;
}
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;
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;
}
@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
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;
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;
}
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;
@Table(name = "fn_language")
@NoArgsConstructor
@AllArgsConstructor
-@ToString
+
@Getter
@Setter
@Entity
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();
+ }
}
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<FnAuditLog> fnAuditLogs = new ArrayList<>();
+ private Set<FnAuditLog> fnAuditLogs;
}
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<FnUser> fnUsers = new ArrayList<>();
+ private Set<FnUser> fnUsers;
}
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<FnMenu> fnMenus = new ArrayList<>();
+ private Set<FnMenu> fnMenus;
}
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<FnTab> fnTabs = new ArrayList<>();
+ private Set<FnTab> fnTabs;
}
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;
@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
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<FnUser> fnUsers = new ArrayList<>();
+ private Set<FnUser> fnUsers;
}
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;
@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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<FnMenu> fnMenus = new ArrayList<>();
+ private Set<FnMenu> fnMenus;
}
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;
@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;
}
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;
})
@NoArgsConstructor
@AllArgsConstructor
-@ToString
+
@Getter
@Setter
@Entity
@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
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<FnUser> fnUsers = new ArrayList<>();
+ private Set<FnUser> fnUsers;
}
})
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@Table(name = "fn_qz_calendars")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@Table(name = "fn_qz_cron_triggers")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
})
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
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;
})
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<FnQzTriggers> selectedTabCd = new ArrayList<>();
+ private Set<FnQzTriggers> selectedTabCd;
@Getter
@Setter
@Table(name = "fn_qz_locks")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@Table(name = "fn_qz_paused_trigger_grps")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@Table(name = "fn_qz_scheduler_state")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@Table(name = "fn_qz_simple_triggers")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@Table(name = "fn_qz_simprop_triggers")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
})
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
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;
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",
@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",
@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;
}
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;
cascade = CascadeType.ALL,
fetch = FetchType.LAZY
)
- private List<FnTabSelected> selectedTabCd = new ArrayList<>();
+ private Set<FnTabSelected> selectedTabCd;
}
@Table(name = "fn_tab_selected")
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
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;
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;
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;
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
@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)
@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
@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)
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)
@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() {
})
@NoArgsConstructor
@AllArgsConstructor
-@EqualsAndHashCode
+
@Getter
@Setter
@Entity
@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;
+/*
+ * ============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;
@Getter
@Setter
-@EqualsAndHashCode
+
@NoArgsConstructor
@AllArgsConstructor
@Inheritance(strategy = InheritanceType.JOINED)
--- /dev/null
+/*
+ * ============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;
+}
--- /dev/null
+/*
+ * ============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;
+}
--- /dev/null
+/*
+ * ============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());
+ }
+}
--- /dev/null
+/*
+ * ============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();
+ }
+}
this.fnLuTimezoneDao = fnLuTimezoneDao;
}
- public Optional<FnLuTimezone> getById(Integer id){
+ public Optional<FnLuTimezone> getById(Long id){
return fnLuTimezoneDao.findById(id);
}
}
public void deleteUser(FnUser fnUser){
fnUserDao.delete(fnUser);
}
+
+ public boolean existById(Long userId) {
+ return fnUserDao.existsById(userId);
+ }
}
//When
PortalRestResponse<String> expected = new PortalRestResponse<>();
expected.setMessage("SUCCESS");
- expected.setResponse("FnLanguage(languageId=101001, languageName=Polish, languageAlias=PL, fnUsers=[])");
+ expected.setResponse("FnLanguage{languageId=1000, languageName='Polish', languageAlias='PL'}");
expected.setStatus(PortalRestStatusEnum.OK);
PortalRestResponse<String> actual = languageController.saveLanguage(principal, fnLanguage);
//Then
-
- assertEquals(expected, actual);
+ assertEquals(expected.getMessage(), actual.getMessage());
+ assertEquals(expected.getStatus(), actual.getStatus());
//Clean up
fnLanguageDao.delete(fnLanguage);
}
PortalRestResponse<String> actual = languageController.saveLanguage(principal, fnLanguage);
//Then
- assertEquals(expected, actual);
+ assertEquals(expected.getMessage(), actual.getMessage());
+ assertEquals(expected.getStatus(), actual.getStatus());
//Clean up
fnLanguageDao.delete(fnLanguage);
}
expected.setStatus(PortalRestStatusEnum.OK);
languageController.saveLanguage(principal, fnLanguage);
- FnUser fnUser = fnUserService.getUser(1L).get();
- PortalRestResponse<String> actual = languageController.setUpUserLanguage(principal, fnLanguage, fnUser.getUserId());
+ PortalRestResponse<String> actual = languageController.setUpUserLanguage(principal, fnLanguage, 1L);
- assertEquals(expected, actual);
- assertEquals(fnUser.getLanguageId(), fnLanguage);
+ FnUser user = fnUserService.getUser(1L).get();
+ assertEquals(expected.getMessage(), actual.getMessage());
+ assertEquals(expected.getStatus(), actual.getStatus());
+ assertEquals(user.getLanguageId().getLanguageId(), fnLanguage.getLanguageId());
//Clean up
import org.onap.portal.domain.db.fn.FnLanguage;
import org.onap.portal.domain.db.fn.FnLuTimezone;
import org.onap.portal.domain.db.fn.FnUser;
+import org.onap.portal.domain.builder.FnUserBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
void saveUser(){
FnUser actual = fnUserService.getUser(1L).get();
- FnUser expected = new FnUser();
+ FnUser expected = new FnUserBuilder().createFnUser();
expected.setUserId(123L);
expected.setFirstName("Demo");
expected.setLastName("User");
expected.setEmail("demo@openecomp.org");
expected.setOrgUserId("demo");
- expected.setTimezone(fnLuTimezoneService.getById(10).orElse(new FnLuTimezone()));
+ expected.setTimezone(fnLuTimezoneService.getById(10L).orElse(new FnLuTimezone()));
expected.setLoginId("demo");
expected.setLoginPwd("4Gl6WL1bmwviYm+XZa6pS1vC0qKXWtn9wcZWdLx61L0=");
expected.setLastLoginDate(LocalDateTime.parse("2019-08-08T12:18:17"));
FnUser actual = fnUserService.getUser(1L).get();
- FnUser expected = new FnUser();
+ FnUser expected = new FnUserBuilder().createFnUser();
expected.setUserId(1L);
expected.setFirstName("Demo");
expected.setLastName("User");
expected.setIsInternalYn("N");
expected.setStateCd("NJ");
expected.setCountryCd("US");
- expected.setTimezone(fnLuTimezoneService.getById(10).orElse(new FnLuTimezone()));
+ expected.setTimezone(fnLuTimezoneService.getById(10L).orElse(new FnLuTimezone()));
expected.setLanguageId(fnLanguageService.findById(1L).orElse(new FnLanguage()));