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 java.util.UUID;
46 import javax.validation.Valid;
47 import javax.validation.constraints.Digits;
48 import javax.validation.constraints.Email;
49 import javax.validation.constraints.NotNull;
50 import javax.validation.constraints.PastOrPresent;
51 import javax.validation.constraints.Size;
52 import org.hibernate.validator.constraints.SafeHtml;
53 import org.onap.portal.domain.db.cr.CrReportFileHistory;
54 import org.onap.portal.domain.db.ep.EpPersUserWidgetPlacement;
55 import org.onap.portal.domain.db.ep.EpPersUserWidgetSel;
56 import org.onap.portal.domain.db.ep.EpUserNotification;
57 import org.onap.portal.domain.db.ep.EpUserRolesRequest;
58 import org.onap.portal.domain.db.ep.EpWidgetCatalogParameter;
59 import org.onap.portal.domain.db.fn.FnAuditLog;
60 import org.onap.portal.domain.db.fn.FnLanguage;
61 import org.onap.portal.domain.db.fn.FnLuAlertMethod;
62 import org.onap.portal.domain.db.fn.FnLuTimezone;
63 import org.onap.portal.domain.db.fn.FnMenuFunctional;
64 import org.onap.portal.domain.db.fn.FnOrg;
65 import org.onap.portal.domain.db.fn.FnPersUserAppSel;
66 import org.onap.portal.domain.db.fn.FnRole;
67 import org.onap.portal.domain.db.fn.FnUser;
68 import org.onap.portal.domain.db.fn.FnUserRole;
69 import org.springframework.stereotype.Component;
72 public class FnUserBuilder {
74 private @Digits(integer = 11, fraction = 0) Long userId;
75 private @Valid FnOrg orgId;
76 private @Valid FnUser managerId;
77 private @Size(max = 50)
78 @SafeHtml String firstName;
79 private @Size(max = 50)
80 @SafeHtml String middleName;
81 private @Size(max = 50)
82 @SafeHtml String lastName;
83 private @Size(max = 25)
84 @SafeHtml String phone;
85 private @Size(max = 25)
87 private @Size(max = 25)
88 @SafeHtml String cellular;
89 private @Size(max = 50) @Email
90 @SafeHtml String email;
91 private @Digits(integer = 11, fraction = 0) Long addressId;
92 private FnLuAlertMethod alertMethodCd;
93 private @Size(max = 20)
94 @SafeHtml String hrid;
95 private @Size(max = 20)
96 @SafeHtml String orgUserId;
97 private @Size(max = 30)
98 @SafeHtml String org_code;
99 private @Size(max = 25)
100 @SafeHtml String loginId;
101 private @Size(max = 100)
102 @SafeHtml String loginPwd;
103 private @PastOrPresent LocalDateTime lastLoginDate;
104 private @Size(max = 1)
106 @NotNull(message = "activeYn must not be null") String activeYn;
107 private @Valid FnUser createdId;
108 private @PastOrPresent LocalDateTime createdDate;
109 private @Valid FnUser modifiedId;
110 private @PastOrPresent LocalDateTime modifiedDate;
111 private @Size(max = 1)
113 @NotNull(message = "isInternalYn must not be null") String isInternalYn;
114 private @Size(max = 100)
115 @SafeHtml String addressLine1;
116 private @Size(max = 100)
117 @SafeHtml String addressLine2;
118 private @Size(max = 50)
119 @SafeHtml String city;
120 private @Size(max = 3)
121 @SafeHtml String stateCd;
122 private @Size(max = 11)
123 @SafeHtml String zipCode;
124 private @Size(max = 3)
125 @SafeHtml String countryCd;
126 private @Size(max = 8)
127 @SafeHtml String locationClli;
128 private @Size(max = 20)
129 @SafeHtml String orgManagerUserId;
130 private @Size(max = 100)
131 @SafeHtml String company;
132 private @Size(max = 200)
133 @SafeHtml String departmentName;
134 private @Size(max = 100)
135 @SafeHtml String jobTitle;
136 private @Valid FnLuTimezone timezone;
137 private @Size(max = 25)
138 @SafeHtml String department;
139 private @Size(max = 25)
140 @SafeHtml String businessUnit;
141 private @Size(max = 100)
142 @SafeHtml String businessUnitName;
143 private @Size(max = 25)
144 @SafeHtml String cost_center;
145 private @Size(max = 10)
146 @SafeHtml String finLocCode;
147 private @Size(max = 10)
148 @SafeHtml String siloStatus;
149 private @Valid @NotNull(message = "languageId must not be null") FnLanguage languageId;
150 private @NotNull(message = "guest must not be null") boolean guest;
151 private Set<CrReportFileHistory> crReportFileHistorie;
152 private Set<FnRole> fnRoles;
153 private Set<FnMenuFunctional> fnRoleList;
154 private Set<FnAuditLog> fnAuditLogs;
155 private Set<FnUser> fnUsersCreatedId;
156 private Set<FnUser> fnUsersManagerId;
157 private Set<FnUser> fnUsersModifiedId;
158 private Set<EpUserRolesRequest> epUserRolesRequests;
159 private Set<FnPersUserAppSel> persUserAppSels;
160 private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters;
161 private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements;
162 private Set<EpPersUserWidgetSel> epPersUserWidgetSels;
163 private Set<FnUserRole> fnUserRoles;
164 private Set<EpUserNotification> epUserNotifications;
166 public FnUserBuilder setUserId(@Digits(integer = 11, fraction = 0) Long userId) {
167 this.userId = userId;
171 public FnUserBuilder setOrgId(@Valid FnOrg orgId) {
176 public FnUserBuilder setManagerId(@Valid FnUser managerId) {
177 this.managerId = managerId;
181 public FnUserBuilder setFirstName(@Size(max = 50) @SafeHtml String firstName) {
182 this.firstName = firstName;
186 public FnUserBuilder setMiddleName(@Size(max = 50) @SafeHtml String middleName) {
187 this.middleName = middleName;
191 public FnUserBuilder setLastName(@Size(max = 50) @SafeHtml String lastName) {
192 this.lastName = lastName;
196 public FnUserBuilder setPhone(@Size(max = 25) @SafeHtml String phone) {
201 public FnUserBuilder setFax(@Size(max = 25) @SafeHtml String fax) {
206 public FnUserBuilder setCellular(@Size(max = 25) @SafeHtml String cellular) {
207 this.cellular = cellular;
211 public FnUserBuilder setEmail(@Size(max = 50) @Email @SafeHtml String email) {
216 public FnUserBuilder setAddressId(@Digits(integer = 11, fraction = 0) Long addressId) {
217 this.addressId = addressId;
221 public FnUserBuilder setAlertMethodCd(FnLuAlertMethod alertMethodCd) {
222 this.alertMethodCd = alertMethodCd;
226 public FnUserBuilder setHrid(@Size(max = 20) @SafeHtml String hrid) {
231 public FnUserBuilder setOrgUserId(@Size(max = 20) @SafeHtml String orgUserId) {
232 this.orgUserId = orgUserId;
236 public FnUserBuilder setOrg_code(@Size(max = 30) @SafeHtml String org_code) {
237 this.org_code = org_code;
241 public FnUserBuilder setLoginId(@Size(max = 25) @SafeHtml String loginId) {
242 this.loginId = loginId;
246 public FnUserBuilder setLoginPwd(@Size(max = 100) @SafeHtml String loginPwd) {
247 this.loginPwd = loginPwd;
251 public FnUserBuilder setLastLoginDate(@PastOrPresent LocalDateTime lastLoginDate) {
252 this.lastLoginDate = lastLoginDate;
256 public FnUserBuilder setActiveYn(
257 @Size(max = 1) @SafeHtml @NotNull(message = "activeYn must not be null") String activeYn) {
258 this.activeYn = activeYn;
262 public FnUserBuilder setCreatedId(@Valid FnUser createdId) {
263 this.createdId = createdId;
267 public FnUserBuilder setCreatedDate(@PastOrPresent LocalDateTime createdDate) {
268 this.createdDate = createdDate;
272 public FnUserBuilder setModifiedId(@Digits(integer = 11, fraction = 0) FnUser modifiedId) {
273 this.modifiedId = modifiedId;
277 public FnUserBuilder setModifiedDate(@PastOrPresent LocalDateTime modifiedDate) {
278 this.modifiedDate = modifiedDate;
282 public FnUserBuilder setIsInternalYn(
283 @Size(max = 1) @SafeHtml @NotNull(message = "isInternalYn must not be null") String isInternalYn) {
284 this.isInternalYn = isInternalYn;
288 public FnUserBuilder setAddressLine1(@Size(max = 100) @SafeHtml String addressLine1) {
289 this.addressLine1 = addressLine1;
293 public FnUserBuilder setAddressLine2(@Size(max = 100) @SafeHtml String addressLine2) {
294 this.addressLine2 = addressLine2;
298 public FnUserBuilder setCity(@Size(max = 50) @SafeHtml String city) {
303 public FnUserBuilder setStateCd(@Size(max = 3) @SafeHtml String stateCd) {
304 this.stateCd = stateCd;
308 public FnUserBuilder setZipCode(@Size(max = 11) @SafeHtml String zipCode) {
309 this.zipCode = zipCode;
313 public FnUserBuilder setCountryCd(@Size(max = 3) @SafeHtml String countryCd) {
314 this.countryCd = countryCd;
318 public FnUserBuilder setLocationClli(@Size(max = 8) @SafeHtml String locationClli) {
319 this.locationClli = locationClli;
323 public FnUserBuilder setOrgManagerUserId(@Size(max = 20) @SafeHtml String orgManagerUserId) {
324 this.orgManagerUserId = orgManagerUserId;
328 public FnUserBuilder setCompany(@Size(max = 100) @SafeHtml String company) {
329 this.company = company;
333 public FnUserBuilder setDepartmentName(@Size(max = 200) @SafeHtml String departmentName) {
334 this.departmentName = departmentName;
338 public FnUserBuilder setJobTitle(@Size(max = 100) @SafeHtml String jobTitle) {
339 this.jobTitle = jobTitle;
343 public FnUserBuilder setTimezone(@Valid FnLuTimezone timezone) {
344 this.timezone = timezone;
348 public FnUserBuilder setDepartment(@Size(max = 25) @SafeHtml String department) {
349 this.department = department;
353 public FnUserBuilder setBusinessUnit(@Size(max = 25) @SafeHtml String businessUnit) {
354 this.businessUnit = businessUnit;
358 public FnUserBuilder setBusinessUnitName(@Size(max = 100) @SafeHtml String businessUnitName) {
359 this.businessUnitName = businessUnitName;
363 public FnUserBuilder setCost_center(@Size(max = 25) @SafeHtml String cost_center) {
364 this.cost_center = cost_center;
368 public FnUserBuilder setFinLocCode(@Size(max = 10) @SafeHtml String finLocCode) {
369 this.finLocCode = finLocCode;
373 public FnUserBuilder setSiloStatus(@Size(max = 10) @SafeHtml String siloStatus) {
374 this.siloStatus = siloStatus;
378 public FnUserBuilder setLanguageId(
379 @Valid @NotNull(message = "languageId must not be null") FnLanguage languageId) {
380 this.languageId = languageId;
384 public FnUserBuilder setGuest(@NotNull(message = "guest must not be null") boolean guest) {
389 public FnUserBuilder setCrReportFileHistorie(Set<CrReportFileHistory> crReportFileHistorie) {
390 this.crReportFileHistorie = crReportFileHistorie;
394 public FnUserBuilder setFnRoles(Set<FnRole> fnRoles) {
395 this.fnRoles = fnRoles;
399 public FnUserBuilder setFnRoleList(Set<FnMenuFunctional> fnRoleList) {
400 this.fnRoleList = fnRoleList;
404 public FnUserBuilder setFnAuditLogs(Set<FnAuditLog> fnAuditLogs) {
405 this.fnAuditLogs = fnAuditLogs;
409 public FnUserBuilder setFnUsersCreatedId(Set<FnUser> fnUsersCreatedId) {
410 this.fnUsersCreatedId = fnUsersCreatedId;
414 public FnUserBuilder setFnUsersManagerId(Set<FnUser> fnUsersManagerId) {
415 this.fnUsersManagerId = fnUsersManagerId;
419 public FnUserBuilder setFnUsersModifiedId(Set<FnUser> fnUsersModifiedId) {
420 this.fnUsersModifiedId = fnUsersModifiedId;
424 public FnUserBuilder setEpUserRolesRequests(Set<EpUserRolesRequest> epUserRolesRequests) {
425 this.epUserRolesRequests = epUserRolesRequests;
429 public FnUserBuilder setPersUserAppSels(Set<FnPersUserAppSel> persUserAppSels) {
430 this.persUserAppSels = persUserAppSels;
434 public FnUserBuilder setEpWidgetCatalogParameters(Set<EpWidgetCatalogParameter> epWidgetCatalogParameters) {
435 this.epWidgetCatalogParameters = epWidgetCatalogParameters;
439 public FnUserBuilder setEpPersUserWidgetPlacements(Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements) {
440 this.epPersUserWidgetPlacements = epPersUserWidgetPlacements;
444 public FnUserBuilder setEpPersUserWidgetSels(Set<EpPersUserWidgetSel> epPersUserWidgetSels) {
445 this.epPersUserWidgetSels = epPersUserWidgetSels;
449 public FnUserBuilder setFnUserRoles(Set<FnUserRole> fnUserRoles) {
450 this.fnUserRoles = fnUserRoles;
454 public FnUserBuilder setEpUserNotifications(Set<EpUserNotification> epUserNotifications) {
455 this.epUserNotifications = epUserNotifications;
459 public FnUser createFnUser() {
460 return new FnUser(userId, orgId, managerId, firstName, middleName, lastName, phone, fax, cellular, email,
461 addressId, alertMethodCd, hrid, orgUserId, org_code, loginId, loginPwd, lastLoginDate, activeYn,
462 createdId, createdDate, modifiedId, modifiedDate, isInternalYn, addressLine1, addressLine2, city,
463 stateCd, zipCode, countryCd, locationClli, orgManagerUserId, company, departmentName, jobTitle,
464 timezone, department, businessUnit, businessUnitName, cost_center, finLocCode, siloStatus,
465 languageId, guest, crReportFileHistorie, fnRoles, fnRoleList, fnAuditLogs, fnUsersCreatedId,
466 fnUsersManagerId, fnUsersModifiedId, epUserRolesRequests, persUserAppSels,
467 epWidgetCatalogParameters, epPersUserWidgetPlacements, epPersUserWidgetSels, fnUserRoles,
468 epUserNotifications);