Transport DTO up
[portal.git] / portal-BE / src / main / java / org / onap / portal / domain / builder / FnUserBuilder.java
1 /*
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  * Modifications Copyright (c) 2019 Samsung
8  * ===================================================================
9  *
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
14  *
15  *             http://www.apache.org/licenses/LICENSE-2.0
16  *
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.
22  *
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
27  *
28  *             https://creativecommons.org/licenses/by/4.0/
29  *
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.
35  *
36  * ============LICENSE_END============================================
37  *
38  *
39  */
40
41 package org.onap.portal.domain.builder;
42
43 import java.time.LocalDateTime;
44 import java.util.Set;
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;
69
70 @Component
71 public class FnUserBuilder {
72
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)
85        @SafeHtml String fax;
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)
104        @SafeHtml
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)
111        @SafeHtml
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;
164
165        public FnUserBuilder setUserId(@Digits(integer = 11, fraction = 0) Long userId) {
166               this.userId = userId;
167               return this;
168        }
169
170        public FnUserBuilder setOrgId(@Valid FnOrg orgId) {
171               this.orgId = orgId;
172               return this;
173        }
174
175        public FnUserBuilder setManagerId(@Valid FnUser managerId) {
176               this.managerId = managerId;
177               return this;
178        }
179
180        public FnUserBuilder setFirstName(@Size(max = 50) @SafeHtml String firstName) {
181               this.firstName = firstName;
182               return this;
183        }
184
185        public FnUserBuilder setMiddleName(@Size(max = 50) @SafeHtml String middleName) {
186               this.middleName = middleName;
187               return this;
188        }
189
190        public FnUserBuilder setLastName(@Size(max = 50) @SafeHtml String lastName) {
191               this.lastName = lastName;
192               return this;
193        }
194
195        public FnUserBuilder setPhone(@Size(max = 25) @SafeHtml String phone) {
196               this.phone = phone;
197               return this;
198        }
199
200        public FnUserBuilder setFax(@Size(max = 25) @SafeHtml String fax) {
201               this.fax = fax;
202               return this;
203        }
204
205        public FnUserBuilder setCellular(@Size(max = 25) @SafeHtml String cellular) {
206               this.cellular = cellular;
207               return this;
208        }
209
210        public FnUserBuilder setEmail(@Size(max = 50) @Email @SafeHtml String email) {
211               this.email = email;
212               return this;
213        }
214
215        public FnUserBuilder setAddressId(@Digits(integer = 11, fraction = 0) Long addressId) {
216               this.addressId = addressId;
217               return this;
218        }
219
220        public FnUserBuilder setAlertMethodCd(FnLuAlertMethod alertMethodCd) {
221               this.alertMethodCd = alertMethodCd;
222               return this;
223        }
224
225        public FnUserBuilder setHrid(@Size(max = 20) @SafeHtml String hrid) {
226               this.hrid = hrid;
227               return this;
228        }
229
230        public FnUserBuilder setOrgUserId(@Size(max = 20) @SafeHtml String orgUserId) {
231               this.orgUserId = orgUserId;
232               return this;
233        }
234
235        public FnUserBuilder setOrg_code(@Size(max = 30) @SafeHtml String org_code) {
236               this.org_code = org_code;
237               return this;
238        }
239
240        public FnUserBuilder setLoginId(@Size(max = 25) @SafeHtml String loginId) {
241               this.loginId = loginId;
242               return this;
243        }
244
245        public FnUserBuilder setLoginPwd(@Size(max = 100) @SafeHtml String loginPwd) {
246               this.loginPwd = loginPwd;
247               return this;
248        }
249
250        public FnUserBuilder setLastLoginDate(@PastOrPresent LocalDateTime lastLoginDate) {
251               this.lastLoginDate = lastLoginDate;
252               return this;
253        }
254
255        public FnUserBuilder setActiveYn(
256                @Size(max = 1) @SafeHtml @NotNull(message = "activeYn must not be null") String activeYn) {
257               this.activeYn = activeYn;
258               return this;
259        }
260
261        public FnUserBuilder setCreatedId(@Valid FnUser createdId) {
262               this.createdId = createdId;
263               return this;
264        }
265
266        public FnUserBuilder setCreatedDate(@PastOrPresent LocalDateTime createdDate) {
267               this.createdDate = createdDate;
268               return this;
269        }
270
271        public FnUserBuilder setModifiedId(@Digits(integer = 11, fraction = 0) FnUser modifiedId) {
272               this.modifiedId = modifiedId;
273               return this;
274        }
275
276        public FnUserBuilder setModifiedDate(@PastOrPresent LocalDateTime modifiedDate) {
277               this.modifiedDate = modifiedDate;
278               return this;
279        }
280
281        public FnUserBuilder setIsInternalYn(
282                @Size(max = 1) @SafeHtml @NotNull(message = "isInternalYn must not be null") String isInternalYn) {
283               this.isInternalYn = isInternalYn;
284               return this;
285        }
286
287        public FnUserBuilder setAddressLine1(@Size(max = 100) @SafeHtml String addressLine1) {
288               this.addressLine1 = addressLine1;
289               return this;
290        }
291
292        public FnUserBuilder setAddressLine2(@Size(max = 100) @SafeHtml String addressLine2) {
293               this.addressLine2 = addressLine2;
294               return this;
295        }
296
297        public FnUserBuilder setCity(@Size(max = 50) @SafeHtml String city) {
298               this.city = city;
299               return this;
300        }
301
302        public FnUserBuilder setStateCd(@Size(max = 3) @SafeHtml String stateCd) {
303               this.stateCd = stateCd;
304               return this;
305        }
306
307        public FnUserBuilder setZipCode(@Size(max = 11) @SafeHtml String zipCode) {
308               this.zipCode = zipCode;
309               return this;
310        }
311
312        public FnUserBuilder setCountryCd(@Size(max = 3) @SafeHtml String countryCd) {
313               this.countryCd = countryCd;
314               return this;
315        }
316
317        public FnUserBuilder setLocationClli(@Size(max = 8) @SafeHtml String locationClli) {
318               this.locationClli = locationClli;
319               return this;
320        }
321
322        public FnUserBuilder setOrgManagerUserId(@Size(max = 20) @SafeHtml String orgManagerUserId) {
323               this.orgManagerUserId = orgManagerUserId;
324               return this;
325        }
326
327        public FnUserBuilder setCompany(@Size(max = 100) @SafeHtml String company) {
328               this.company = company;
329               return this;
330        }
331
332        public FnUserBuilder setDepartmentName(@Size(max = 200) @SafeHtml String departmentName) {
333               this.departmentName = departmentName;
334               return this;
335        }
336
337        public FnUserBuilder setJobTitle(@Size(max = 100) @SafeHtml String jobTitle) {
338               this.jobTitle = jobTitle;
339               return this;
340        }
341
342        public FnUserBuilder setTimezone(@Valid FnLuTimezone timezone) {
343               this.timezone = timezone;
344               return this;
345        }
346
347        public FnUserBuilder setDepartment(@Size(max = 25) @SafeHtml String department) {
348               this.department = department;
349               return this;
350        }
351
352        public FnUserBuilder setBusinessUnit(@Size(max = 25) @SafeHtml String businessUnit) {
353               this.businessUnit = businessUnit;
354               return this;
355        }
356
357        public FnUserBuilder setBusinessUnitName(@Size(max = 100) @SafeHtml String businessUnitName) {
358               this.businessUnitName = businessUnitName;
359               return this;
360        }
361
362        public FnUserBuilder setCost_center(@Size(max = 25) @SafeHtml String cost_center) {
363               this.cost_center = cost_center;
364               return this;
365        }
366
367        public FnUserBuilder setFinLocCode(@Size(max = 10) @SafeHtml String finLocCode) {
368               this.finLocCode = finLocCode;
369               return this;
370        }
371
372        public FnUserBuilder setSiloStatus(@Size(max = 10) @SafeHtml String siloStatus) {
373               this.siloStatus = siloStatus;
374               return this;
375        }
376
377        public FnUserBuilder setLanguageId(
378                @Valid @NotNull(message = "languageId must not be null") FnLanguage languageId) {
379               this.languageId = languageId;
380               return this;
381        }
382
383        public FnUserBuilder setGuest(@NotNull(message = "guest must not be null") boolean guest) {
384               this.guest = guest;
385               return this;
386        }
387
388        public FnUserBuilder setCrReportFileHistorie(Set<CrReportFileHistory> crReportFileHistorie) {
389               this.crReportFileHistorie = crReportFileHistorie;
390               return this;
391        }
392
393        public FnUserBuilder setFnRoles(Set<FnRole> fnRoles) {
394               this.fnRoles = fnRoles;
395               return this;
396        }
397
398        public FnUserBuilder setFnRoleList(Set<FnMenuFunctional> fnRoleList) {
399               this.fnRoleList = fnRoleList;
400               return this;
401        }
402
403        public FnUserBuilder setFnAuditLogs(Set<FnAuditLog> fnAuditLogs) {
404               this.fnAuditLogs = fnAuditLogs;
405               return this;
406        }
407
408        public FnUserBuilder setFnUsersCreatedId(Set<FnUser> fnUsersCreatedId) {
409               this.fnUsersCreatedId = fnUsersCreatedId;
410               return this;
411        }
412
413        public FnUserBuilder setFnUsersManagerId(Set<FnUser> fnUsersManagerId) {
414               this.fnUsersManagerId = fnUsersManagerId;
415               return this;
416        }
417
418        public FnUserBuilder setFnUsersModifiedId(Set<FnUser> fnUsersModifiedId) {
419               this.fnUsersModifiedId = fnUsersModifiedId;
420               return this;
421        }
422
423        public FnUserBuilder setEpUserRolesRequests(Set<EpUserRolesRequest> epUserRolesRequests) {
424               this.epUserRolesRequests = epUserRolesRequests;
425               return this;
426        }
427
428        public FnUserBuilder setPersUserAppSels(Set<FnPersUserAppSel> persUserAppSels) {
429               this.persUserAppSels = persUserAppSels;
430               return this;
431        }
432
433        public FnUserBuilder setEpWidgetCatalogParameters(Set<EpWidgetCatalogParameter> epWidgetCatalogParameters) {
434               this.epWidgetCatalogParameters = epWidgetCatalogParameters;
435               return this;
436        }
437
438        public FnUserBuilder setEpPersUserWidgetPlacements(Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements) {
439               this.epPersUserWidgetPlacements = epPersUserWidgetPlacements;
440               return this;
441        }
442
443        public FnUserBuilder setEpPersUserWidgetSels(Set<EpPersUserWidgetSel> epPersUserWidgetSels) {
444               this.epPersUserWidgetSels = epPersUserWidgetSels;
445               return this;
446        }
447
448        public FnUserBuilder setFnUserRoles(Set<FnUserRole> fnUserRoles) {
449               this.fnUserRoles = fnUserRoles;
450               return this;
451        }
452
453        public FnUserBuilder setEpUserNotifications(Set<EpUserNotification> epUserNotifications) {
454               this.epUserNotifications = epUserNotifications;
455               return this;
456        }
457
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);
468        }
469 }