summaryrefslogtreecommitdiffstats
path: root/portal-BE/src/main/java
diff options
context:
space:
mode:
authorDominik Mizyn <d.mizyn@samsung.com>2019-09-11 14:54:06 +0200
committerDominik Mizyn <d.mizyn@samsung.com>2019-09-11 14:54:12 +0200
commitbfb078b48e3558777b60a91775ea3c239a1f3a05 (patch)
tree5b85c03f4ccdc17a51421c975cb5923ade46ed60 /portal-BE/src/main/java
parent25ca3671cea82311d6832963fc189c8bbfab0d23 (diff)
WidgetsControllerTest up
WidgetsControllerTest up Issue-ID: PORTAL-710 Change-Id: Ia1e5c40599bd9f89a8d1b5a856571332bc6ebfe1 Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com>
Diffstat (limited to 'portal-BE/src/main/java')
-rw-r--r--portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java3
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserBuilder.java469
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserDtoBuilder.java331
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java3
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnUser.java20
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/dto/fn/FnUserDto.java7
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/mapper/FnUserMapper.java197
7 files changed, 109 insertions, 921 deletions
diff --git a/portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java b/portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java
index 6248a358..c2915275 100644
--- a/portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java
+++ b/portal-BE/src/main/java/org/onap/portal/controller/WidgetsController.java
@@ -43,6 +43,7 @@ package org.onap.portal.controller;
import java.io.IOException;
import java.security.Principal;
import java.util.List;
+import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.onap.portal.domain.db.fn.FnUser;
@@ -99,7 +100,7 @@ public class WidgetsController {
FnUser user = fnUserService.loadUserByUsername(principal.getName());
List<OnboardingWidget> onboardingWidgets = null;
- if (user == null || user.isGuest()) {
+ if (user.getGuest()) {
EcompPortalUtils.setBadPermissions(user, response, "getOnboardingWidgets");
} else {
String getType = request.getHeader("X-Widgets-Type");
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
deleted file mode 100644
index ccf20aa3..00000000
--- a/portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserBuilder.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal
- * ===================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END============================================
- *
- *
- */
-
-package org.onap.portal.domain.builder;
-
-import java.time.LocalDateTime;
-import java.util.Set;
-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
deleted file mode 100644
index c6075dd6..00000000
--- a/portal-BE/src/main/java/org/onap/portal/domain/builder/FnUserDtoBuilder.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal
- * ===================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ===================================================================
- *
- * Unless otherwise specified, all software contained herein is licensed
- * under the Apache License, Version 2.0 (the "License");
- * you may not use this software except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END============================================
- *
- *
- */
-
-package org.onap.portal.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/fn/FnLanguage.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java
index 2a81ea01..4b9186eb 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
@@ -57,6 +57,7 @@ import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.AllArgsConstructor;
+import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -73,7 +74,7 @@ CREATE TABLE `fn_language` (
@Table(name = "fn_language")
@NoArgsConstructor
@AllArgsConstructor
-
+@Builder
@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 afd70b03..ce28d0fd 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
@@ -68,6 +68,7 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.PastOrPresent;
import javax.validation.constraints.Size;
import lombok.AllArgsConstructor;
+import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -178,6 +179,7 @@ CREATE TABLE `fn_user` (
@Getter
@Setter
@Entity
+@Builder
@NoArgsConstructor
@AllArgsConstructor
@DynamicUpdate
@@ -253,11 +255,8 @@ public class FnUser extends DomainVo implements UserDetails, Serializable {
@Column(name = "last_login_date", nullable = false, columnDefinition = "datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()")
@PastOrPresent
protected LocalDateTime lastLoginDate;
- @Column(name = "active_yn", length = 1, nullable = false)
- @Size(max = 1)
- @SafeHtml
- @NotNull(message = "activeYn must not be null")
- private String activeYn;
+ @Column(name = "active_yn", nullable = false)
+ private Boolean activeYn;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "created_id")
private FnUser createdId;
@@ -270,11 +269,8 @@ public class FnUser extends DomainVo implements UserDetails, Serializable {
@Column(name = "modified_date", nullable = false, columnDefinition = "datetime default now()")
@PastOrPresent
protected LocalDateTime modifiedDate;
- @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")
- private String isInternalYn;
+ @Column(name = "is_internal_yn", nullable = false, columnDefinition = "bit DEFAULT 0")
+ private Boolean isInternalYn;
@Column(name = "address_line_1", length = 100)
@Size(max = 100)
@SafeHtml
@@ -350,9 +346,9 @@ public class FnUser extends DomainVo implements UserDetails, Serializable {
@JoinColumn(name = "language_id", nullable = false, columnDefinition = "int(11) DEFAULT 1")
@NotNull(message = "languageId must not be null")
private FnLanguage languageId;
- @Column(name = "is_guest", columnDefinition = "boolean default 0", nullable = false)
+ @Column(name = "is_guest", nullable = false, columnDefinition = "bit DEFAULT 0")
@NotNull(message = "guest must not be null")
- private boolean guest;
+ private Boolean guest;
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "fnUserList")
private Set<CrReportFileHistory> crReportFileHistorie;
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
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
index f8ae95d2..c107d192 100644
--- 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
@@ -42,13 +42,14 @@ package org.onap.portal.domain.dto.fn;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
+import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Setter
@Getter
-
+@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FnUserDto {
@@ -70,12 +71,12 @@ public class FnUserDto {
private String loginId;
private String loginPwd;
protected LocalDateTime lastLoginDate;
- private String activeYn;
+ private Boolean activeYn;
private Long createdId;
protected LocalDateTime createdDate;
private Long modifiedId;
protected LocalDateTime modifiedDate;
- private String isInternalYn = "n";
+ private Boolean isInternalYn = false;
private String addressLine1;
private String addressLine2;
private String city;
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
index 757eff51..869ba81d 100644
--- 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
@@ -41,120 +41,109 @@
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 {
+ public FnUserDto fnUserToFnUserDto(final FnUser fnUser){
+ return FnUserDto.builder()
+ .userId(fnUser.getUserId())
+ .orgId(fnUser.getOrgId().getOrgId())
+ .managerId(fnUser.getManagerId().getUserId())
+ .firstName(fnUser.getFirstName())
+ .middleName(fnUser.getMiddleName())
+ .lastName(fnUser.getLastName())
+ .phone(fnUser.getPhone())
+ .fax(fnUser.getFax())
+ .cellular(fnUser.getCellular())
+ .email(fnUser.getEmail())
+ .addressId(fnUser.getAddressId())
+ .alertMethodCd(fnUser.getAlertMethodCd().getAlertMethodCd())
+ .hrid(fnUser.getHrid())
+ .orgUserId(fnUser.getOrgUserId())
+ .org_code(fnUser.getOrg_code())
+ .loginId(fnUser.getLoginId())
+ .loginPwd(fnUser.getLoginPwd())
+ .lastLoginDate(fnUser.getLastLoginDate())
+ .activeYn(fnUser.getActiveYn())
+ .createdId(fnUser.getCreatedId().getUserId())
+ .createdDate(fnUser.getCreatedDate())
+ .modifiedId(fnUser.getModifiedId().getUserId())
+ .modifiedDate(fnUser.getModifiedDate())
+ .isInternalYn(fnUser.getIsInternalYn())
+ .addressLine1(fnUser.getAddressLine1())
+ .addressLine2(fnUser.getAddressLine2())
+ .city(fnUser.getCity())
+ .stateCd(fnUser.getStateCd())
+ .zipCode(fnUser.getZipCode())
+ .countryCd(fnUser.getCountryCd())
+ .locationClli(fnUser.getLocationClli())
+ .orgManagerUserId(fnUser.getOrgManagerUserId())
+ .company(fnUser.getCompany())
+ .departmentName(fnUser.getDepartmentName())
+ .jobTitle(fnUser.getJobTitle())
+ .timezone(fnUser.getTimezone().getTimezoneId())
+ .department(fnUser.getDepartment())
+ .businessUnit(fnUser.getBusinessUnit())
+ .businessUnitName(fnUser.getBusinessUnitName())
+ .cost_center(fnUser.getCost_center())
+ .finLocCode(fnUser.getFinLocCode())
+ .siloStatus(fnUser.getSiloStatus())
+ .languageId(fnUser.getLanguageId().getLanguageId())
+ .guest(fnUser.getGuest())
+ .build();
- 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();
+ return FnUser.builder()
+ .userId(fnUser.getUserId())
+ .orgId(fnUser.getOrgId())
+ .managerId(fnUser.getManagerId())
+ .firstName(fnUser.getFirstName())
+ .middleName(fnUser.getMiddleName())
+ .lastName(fnUser.getLastName())
+ .phone(fnUser.getPhone())
+ .fax(fnUser.getFax())
+ .cellular(fnUser.getCellular())
+ .email(fnUser.getEmail())
+ .addressId(fnUser.getAddressId())
+ .alertMethodCd(fnUser.getAlertMethodCd())
+ .hrid(fnUser.getHrid())
+ .orgUserId(fnUser.getOrgUserId())
+ .org_code(fnUser.getOrg_code())
+ .loginId(fnUser.getLoginId())
+ .loginPwd(fnUser.getLoginPwd())
+ .lastLoginDate(fnUser.getLastLoginDate())
+ .activeYn(fnUser.getActiveYn())
+ .createdId(fnUser.getCreatedId())
+ .createdDate(fnUser.getCreatedDate())
+ .modifiedId(fnUser.getModifiedId())
+ .modifiedDate(fnUser.getModifiedDate())
+ .isInternalYn(fnUser.getIsInternalYn())
+ .addressLine1(fnUser.getAddressLine1())
+ .addressLine2(fnUser.getAddressLine2())
+ .city(fnUser.getCity())
+ .stateCd(fnUser.getStateCd())
+ .zipCode(fnUser.getZipCode())
+ .countryCd(fnUser.getCountryCd())
+ .locationClli(fnUser.getLocationClli())
+ .orgManagerUserId(fnUser.getOrgManagerUserId())
+ .company(fnUser.getCompany())
+ .departmentName(fnUser.getDepartmentName())
+ .jobTitle(fnUser.getJobTitle())
+ .timezone(fnUser.getTimezone())
+ .department(fnUser.getDepartment())
+ .businessUnit(fnUser.getBusinessUnit())
+ .businessUnitName(fnUser.getBusinessUnitName())
+ .cost_center(fnUser.getCost_center())
+ .finLocCode(fnUser.getFinLocCode())
+ .siloStatus(fnUser.getSiloStatus())
+ .languageId(fnUser.getLanguageId())
+ .guest(fnUser.getGuest())
+ .build();
}
}