2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ===================================================================
10 * Unless otherwise specified, all software contained herein is licensed
11 * under the Apache License, Version 2.0 (the "License");
12 * you may not use this software except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
23 * Unless otherwise specified, all documentation contained herein is licensed
24 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
25 * you may not use this documentation except in compliance with the License.
26 * You may obtain a copy of the License at
28 * https://creativecommons.org/licenses/by/4.0/
30 * Unless required by applicable law or agreed to in writing, documentation
31 * distributed under the License is distributed on an "AS IS" BASIS,
32 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 * See the License for the specific language governing permissions and
34 * limitations under the License.
36 * ============LICENSE_END============================================
41 package org.onap.portal.domain.builder;
43 import java.time.LocalDateTime;
45 import javax.validation.Valid;
46 import javax.validation.constraints.Digits;
47 import javax.validation.constraints.Email;
48 import javax.validation.constraints.NotNull;
49 import javax.validation.constraints.PastOrPresent;
50 import javax.validation.constraints.Size;
51 import org.hibernate.validator.constraints.SafeHtml;
52 import org.onap.portal.domain.db.cr.CrReportFileHistory;
53 import org.onap.portal.domain.db.ep.EpPersUserWidgetPlacement;
54 import org.onap.portal.domain.db.ep.EpPersUserWidgetSel;
55 import org.onap.portal.domain.db.ep.EpUserNotification;
56 import org.onap.portal.domain.db.ep.EpUserRolesRequest;
57 import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter;
58 import org.onap.portal.domain.db.fn.FnAuditLog;
59 import org.onap.portal.domain.db.fn.FnLanguage;
60 import org.onap.portal.domain.db.fn.FnLuAlertMethod;
61 import org.onap.portal.domain.db.fn.FnLuTimezone;
62 import org.onap.portal.domain.db.fn.FnMenuFunctional;
63 import org.onap.portal.domain.db.fn.FnOrg;
64 import org.onap.portal.domain.db.fn.FnPersUserAppSel;
65 import org.onap.portal.domain.db.fn.FnRole;
66 import org.onap.portal.domain.db.fn.FnUser;
67 import org.onap.portal.domain.db.fn.FnUserRole;
68 import org.springframework.stereotype.Component;
71 public class FnUserBuilder {
73 private @Digits(integer = 11, fraction = 0) Long userId;
74 private @Valid FnOrg orgId;
75 private @Valid FnUser managerId;
76 private @Size(max = 50)
77 @SafeHtml String firstName;
78 private @Size(max = 50)
79 @SafeHtml String middleName;
80 private @Size(max = 50)
81 @SafeHtml String lastName;
82 private @Size(max = 25)
83 @SafeHtml String phone;
84 private @Size(max = 25)
86 private @Size(max = 25)
87 @SafeHtml String cellular;
88 private @Size(max = 50) @Email
89 @SafeHtml String email;
90 private @Digits(integer = 11, fraction = 0) Long addressId;
91 private FnLuAlertMethod alertMethodCd;
92 private @Size(max = 20)
93 @SafeHtml String hrid;
94 private @Size(max = 20)
95 @SafeHtml String orgUserId;
96 private @Size(max = 30)
97 @SafeHtml String org_code;
98 private @Size(max = 25)
99 @SafeHtml String loginId;
100 private @Size(max = 100)
101 @SafeHtml String loginPwd;
102 private @PastOrPresent LocalDateTime lastLoginDate;
103 private @Size(max = 1)
105 @NotNull(message = "activeYn must not be null") String activeYn;
106 private @Valid FnUser createdId;
107 private @PastOrPresent LocalDateTime createdDate;
108 private @Valid FnUser modifiedId;
109 private @PastOrPresent LocalDateTime modifiedDate;
110 private @Size(max = 1)
112 @NotNull(message = "isInternalYn must not be null") String isInternalYn;
113 private @Size(max = 100)
114 @SafeHtml String addressLine1;
115 private @Size(max = 100)
116 @SafeHtml String addressLine2;
117 private @Size(max = 50)
118 @SafeHtml String city;
119 private @Size(max = 3)
120 @SafeHtml String stateCd;
121 private @Size(max = 11)
122 @SafeHtml String zipCode;
123 private @Size(max = 3)
124 @SafeHtml String countryCd;
125 private @Size(max = 8)
126 @SafeHtml String locationClli;
127 private @Size(max = 20)
128 @SafeHtml String orgManagerUserId;
129 private @Size(max = 100)
130 @SafeHtml String company;
131 private @Size(max = 200)
132 @SafeHtml String departmentName;
133 private @Size(max = 100)
134 @SafeHtml String jobTitle;
135 private @Valid FnLuTimezone timezone;
136 private @Size(max = 25)
137 @SafeHtml String department;
138 private @Size(max = 25)
139 @SafeHtml String businessUnit;
140 private @Size(max = 100)
141 @SafeHtml String businessUnitName;
142 private @Size(max = 25)
143 @SafeHtml String cost_center;
144 private @Size(max = 10)
145 @SafeHtml String finLocCode;
146 private @Size(max = 10)
147 @SafeHtml String siloStatus;
148 private @Valid @NotNull(message = "languageId must not be null") FnLanguage languageId;
149 private @NotNull(message = "guest must not be null") boolean guest;
150 private Set<CrReportFileHistory> crReportFileHistorie;
151 private Set<FnRole> fnRoles;
152 private Set<FnMenuFunctional> fnRoleList;
153 private Set<FnAuditLog> fnAuditLogs;
154 private Set<FnUser> fnUsersCreatedId;
155 private Set<FnUser> fnUsersManagerId;
156 private Set<FnUser> fnUsersModifiedId;
157 private Set<EpUserRolesRequest> epUserRolesRequests;
158 private Set<FnPersUserAppSel> persUserAppSels;
159 private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters;
160 private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements;
161 private Set<EpPersUserWidgetSel> epPersUserWidgetSels;
162 private Set<FnUserRole> fnUserRoles;
163 private Set<EpUserNotification> epUserNotifications;
165 public FnUserBuilder setUserId(@Digits(integer = 11, fraction = 0) Long userId) {
166 this.userId = userId;
170 public FnUserBuilder setOrgId(@Valid FnOrg orgId) {
175 public FnUserBuilder setManagerId(@Valid FnUser managerId) {
176 this.managerId = managerId;
180 public FnUserBuilder setFirstName(@Size(max = 50) @SafeHtml String firstName) {
181 this.firstName = firstName;
185 public FnUserBuilder setMiddleName(@Size(max = 50) @SafeHtml String middleName) {
186 this.middleName = middleName;
190 public FnUserBuilder setLastName(@Size(max = 50) @SafeHtml String lastName) {
191 this.lastName = lastName;
195 public FnUserBuilder setPhone(@Size(max = 25) @SafeHtml String phone) {
200 public FnUserBuilder setFax(@Size(max = 25) @SafeHtml String fax) {
205 public FnUserBuilder setCellular(@Size(max = 25) @SafeHtml String cellular) {
206 this.cellular = cellular;
210 public FnUserBuilder setEmail(@Size(max = 50) @Email @SafeHtml String email) {
215 public FnUserBuilder setAddressId(@Digits(integer = 11, fraction = 0) Long addressId) {
216 this.addressId = addressId;
220 public FnUserBuilder setAlertMethodCd(FnLuAlertMethod alertMethodCd) {
221 this.alertMethodCd = alertMethodCd;
225 public FnUserBuilder setHrid(@Size(max = 20) @SafeHtml String hrid) {
230 public FnUserBuilder setOrgUserId(@Size(max = 20) @SafeHtml String orgUserId) {
231 this.orgUserId = orgUserId;
235 public FnUserBuilder setOrg_code(@Size(max = 30) @SafeHtml String org_code) {
236 this.org_code = org_code;
240 public FnUserBuilder setLoginId(@Size(max = 25) @SafeHtml String loginId) {
241 this.loginId = loginId;
245 public FnUserBuilder setLoginPwd(@Size(max = 100) @SafeHtml String loginPwd) {
246 this.loginPwd = loginPwd;
250 public FnUserBuilder setLastLoginDate(@PastOrPresent LocalDateTime lastLoginDate) {
251 this.lastLoginDate = lastLoginDate;
255 public FnUserBuilder setActiveYn(
256 @Size(max = 1) @SafeHtml @NotNull(message = "activeYn must not be null") String activeYn) {
257 this.activeYn = activeYn;
261 public FnUserBuilder setCreatedId(@Valid FnUser createdId) {
262 this.createdId = createdId;
266 public FnUserBuilder setCreatedDate(@PastOrPresent LocalDateTime createdDate) {
267 this.createdDate = createdDate;
271 public FnUserBuilder setModifiedId(@Digits(integer = 11, fraction = 0) FnUser modifiedId) {
272 this.modifiedId = modifiedId;
276 public FnUserBuilder setModifiedDate(@PastOrPresent LocalDateTime modifiedDate) {
277 this.modifiedDate = modifiedDate;
281 public FnUserBuilder setIsInternalYn(
282 @Size(max = 1) @SafeHtml @NotNull(message = "isInternalYn must not be null") String isInternalYn) {
283 this.isInternalYn = isInternalYn;
287 public FnUserBuilder setAddressLine1(@Size(max = 100) @SafeHtml String addressLine1) {
288 this.addressLine1 = addressLine1;
292 public FnUserBuilder setAddressLine2(@Size(max = 100) @SafeHtml String addressLine2) {
293 this.addressLine2 = addressLine2;
297 public FnUserBuilder setCity(@Size(max = 50) @SafeHtml String city) {
302 public FnUserBuilder setStateCd(@Size(max = 3) @SafeHtml String stateCd) {
303 this.stateCd = stateCd;
307 public FnUserBuilder setZipCode(@Size(max = 11) @SafeHtml String zipCode) {
308 this.zipCode = zipCode;
312 public FnUserBuilder setCountryCd(@Size(max = 3) @SafeHtml String countryCd) {
313 this.countryCd = countryCd;
317 public FnUserBuilder setLocationClli(@Size(max = 8) @SafeHtml String locationClli) {
318 this.locationClli = locationClli;
322 public FnUserBuilder setOrgManagerUserId(@Size(max = 20) @SafeHtml String orgManagerUserId) {
323 this.orgManagerUserId = orgManagerUserId;
327 public FnUserBuilder setCompany(@Size(max = 100) @SafeHtml String company) {
328 this.company = company;
332 public FnUserBuilder setDepartmentName(@Size(max = 200) @SafeHtml String departmentName) {
333 this.departmentName = departmentName;
337 public FnUserBuilder setJobTitle(@Size(max = 100) @SafeHtml String jobTitle) {
338 this.jobTitle = jobTitle;
342 public FnUserBuilder setTimezone(@Valid FnLuTimezone timezone) {
343 this.timezone = timezone;
347 public FnUserBuilder setDepartment(@Size(max = 25) @SafeHtml String department) {
348 this.department = department;
352 public FnUserBuilder setBusinessUnit(@Size(max = 25) @SafeHtml String businessUnit) {
353 this.businessUnit = businessUnit;
357 public FnUserBuilder setBusinessUnitName(@Size(max = 100) @SafeHtml String businessUnitName) {
358 this.businessUnitName = businessUnitName;
362 public FnUserBuilder setCost_center(@Size(max = 25) @SafeHtml String cost_center) {
363 this.cost_center = cost_center;
367 public FnUserBuilder setFinLocCode(@Size(max = 10) @SafeHtml String finLocCode) {
368 this.finLocCode = finLocCode;
372 public FnUserBuilder setSiloStatus(@Size(max = 10) @SafeHtml String siloStatus) {
373 this.siloStatus = siloStatus;
377 public FnUserBuilder setLanguageId(
378 @Valid @NotNull(message = "languageId must not be null") FnLanguage languageId) {
379 this.languageId = languageId;
383 public FnUserBuilder setGuest(@NotNull(message = "guest must not be null") boolean guest) {
388 public FnUserBuilder setCrReportFileHistorie(Set<CrReportFileHistory> crReportFileHistorie) {
389 this.crReportFileHistorie = crReportFileHistorie;
393 public FnUserBuilder setFnRoles(Set<FnRole> fnRoles) {
394 this.fnRoles = fnRoles;
398 public FnUserBuilder setFnRoleList(Set<FnMenuFunctional> fnRoleList) {
399 this.fnRoleList = fnRoleList;
403 public FnUserBuilder setFnAuditLogs(Set<FnAuditLog> fnAuditLogs) {
404 this.fnAuditLogs = fnAuditLogs;
408 public FnUserBuilder setFnUsersCreatedId(Set<FnUser> fnUsersCreatedId) {
409 this.fnUsersCreatedId = fnUsersCreatedId;
413 public FnUserBuilder setFnUsersManagerId(Set<FnUser> fnUsersManagerId) {
414 this.fnUsersManagerId = fnUsersManagerId;
418 public FnUserBuilder setFnUsersModifiedId(Set<FnUser> fnUsersModifiedId) {
419 this.fnUsersModifiedId = fnUsersModifiedId;
423 public FnUserBuilder setEpUserRolesRequests(Set<EpUserRolesRequest> epUserRolesRequests) {
424 this.epUserRolesRequests = epUserRolesRequests;
428 public FnUserBuilder setPersUserAppSels(Set<FnPersUserAppSel> persUserAppSels) {
429 this.persUserAppSels = persUserAppSels;
433 public FnUserBuilder setEpWidgetCatalogParameters(Set<EpWidgetCatalogParameter> epWidgetCatalogParameters) {
434 this.epWidgetCatalogParameters = epWidgetCatalogParameters;
438 public FnUserBuilder setEpPersUserWidgetPlacements(Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements) {
439 this.epPersUserWidgetPlacements = epPersUserWidgetPlacements;
443 public FnUserBuilder setEpPersUserWidgetSels(Set<EpPersUserWidgetSel> epPersUserWidgetSels) {
444 this.epPersUserWidgetSels = epPersUserWidgetSels;
448 public FnUserBuilder setFnUserRoles(Set<FnUserRole> fnUserRoles) {
449 this.fnUserRoles = fnUserRoles;
453 public FnUserBuilder setEpUserNotifications(Set<EpUserNotification> epUserNotifications) {
454 this.epUserNotifications = epUserNotifications;
458 public FnUser createFnUser() {
459 return new FnUser(userId, orgId, managerId, firstName, middleName, lastName, phone, fax, cellular, email,
460 addressId, alertMethodCd, hrid, orgUserId, org_code, loginId, loginPwd, lastLoginDate, activeYn,
461 createdId, createdDate, modifiedId, modifiedDate, isInternalYn, addressLine1, addressLine2, city,
462 stateCd, zipCode, countryCd, locationClli, orgManagerUserId, company, departmentName, jobTitle,
463 timezone, department, businessUnit, businessUnitName, cost_center, finLocCode, siloStatus,
464 languageId, guest, crReportFileHistorie, fnRoles, fnRoleList, fnAuditLogs, fnUsersCreatedId,
465 fnUsersManagerId, fnUsersModifiedId, epUserRolesRequests, persUserAppSels,
466 epWidgetCatalogParameters, epPersUserWidgetPlacements, epPersUserWidgetSels, fnUserRoles,
467 epUserNotifications);