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