0a718502a3243afd0317c8ba5318f28078f33f94
[portal.git] / portal-BE / src / main / java / org / onap / portal / domain / mapper / FnUserMapper.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.mapper;
42
43 import lombok.NoArgsConstructor;
44 import org.onap.portal.domain.db.fn.FnUser;
45 import org.onap.portal.domain.dto.fn.FnUserDto;
46 import org.springframework.stereotype.Component;
47
48 @Component
49 @NoArgsConstructor
50 public class FnUserMapper {
51               public FnUserDto fnUserToFnUserDto(final FnUser fnUser){
52               return FnUserDto.builder()
53                       .userId(fnUser.getId())
54                       .orgId(fnUser.getOrgId().getOrgId())
55                       .firstName(fnUser.getFirstName())
56                       .middleName(fnUser.getMiddleName())
57                       .lastName(fnUser.getLastName())
58                       .phone(fnUser.getPhone())
59                       .fax(fnUser.getFax())
60                       .cellular(fnUser.getCellular())
61                       .email(fnUser.getEmail())
62                       .addressId(fnUser.getAddressId())
63                       .alertMethodCd(fnUser.getAlertMethodCd().getAlertMethodCd())
64                       .hrid(fnUser.getHrid())
65                       .orgUserId(fnUser.getOrgUserId())
66                       .org_code(fnUser.getOrg_code())
67                       .loginId(fnUser.getLoginId())
68                       .loginPwd(fnUser.getLoginPwd())
69                       .lastLoginDate(fnUser.getLastLoginDate())
70                       .activeYn(fnUser.getActiveYn())
71                       .createdDate(fnUser.getCreatedDate())
72                       .modifiedDate(fnUser.getModifiedDate())
73                       .isInternalYn(fnUser.getIsInternalYn())
74                       .addressLine1(fnUser.getAddressLine1())
75                       .addressLine2(fnUser.getAddressLine2())
76                       .city(fnUser.getCity())
77                       .stateCd(fnUser.getStateCd())
78                       .zipCode(fnUser.getZipCode())
79                       .countryCd(fnUser.getCountryCd())
80                       .locationClli(fnUser.getLocationClli())
81                       .orgManagerUserId(fnUser.getOrgManagerUserId())
82                       .company(fnUser.getCompany())
83                       .departmentName(fnUser.getDepartmentName())
84                       .jobTitle(fnUser.getJobTitle())
85                       .timezone(fnUser.getTimezone().getTimezoneId())
86                       .department(fnUser.getDepartment())
87                       .businessUnit(fnUser.getBusinessUnit())
88                       .businessUnitName(fnUser.getBusinessUnitName())
89                       .cost_center(fnUser.getCost_center())
90                       .finLocCode(fnUser.getFinLocCode())
91                       .siloStatus(fnUser.getSiloStatus())
92                       .languageId(fnUser.getLanguageId().getLanguageId())
93                       .guest(fnUser.getGuest())
94                       .build();
95
96        }
97
98        public FnUser fnUserToFnUser(final FnUser fnUser){
99               return FnUser.builder()
100                       .id(fnUser.getId())
101                       .orgId(fnUser.getOrgId())
102                       .firstName(fnUser.getFirstName())
103                       .middleName(fnUser.getMiddleName())
104                       .lastName(fnUser.getLastName())
105                       .phone(fnUser.getPhone())
106                       .fax(fnUser.getFax())
107                       .cellular(fnUser.getCellular())
108                       .email(fnUser.getEmail())
109                       .addressId(fnUser.getAddressId())
110                       .alertMethodCd(fnUser.getAlertMethodCd())
111                       .hrid(fnUser.getHrid())
112                       .orgUserId(fnUser.getOrgUserId())
113                       .org_code(fnUser.getOrg_code())
114                       .loginId(fnUser.getLoginId())
115                       .loginPwd(fnUser.getLoginPwd())
116                       .lastLoginDate(fnUser.getLastLoginDate())
117                       .activeYn(fnUser.getActiveYn())
118                       .createdDate(fnUser.getCreatedDate())
119                       .modifiedDate(fnUser.getModifiedDate())
120                       .isInternalYn(fnUser.getIsInternalYn())
121                       .addressLine1(fnUser.getAddressLine1())
122                       .addressLine2(fnUser.getAddressLine2())
123                       .city(fnUser.getCity())
124                       .stateCd(fnUser.getStateCd())
125                       .zipCode(fnUser.getZipCode())
126                       .countryCd(fnUser.getCountryCd())
127                       .locationClli(fnUser.getLocationClli())
128                       .orgManagerUserId(fnUser.getOrgManagerUserId())
129                       .company(fnUser.getCompany())
130                       .departmentName(fnUser.getDepartmentName())
131                       .jobTitle(fnUser.getJobTitle())
132                       .timezone(fnUser.getTimezone())
133                       .department(fnUser.getDepartment())
134                       .businessUnit(fnUser.getBusinessUnit())
135                       .businessUnitName(fnUser.getBusinessUnitName())
136                       .cost_center(fnUser.getCost_center())
137                       .finLocCode(fnUser.getFinLocCode())
138                       .siloStatus(fnUser.getSiloStatus())
139                       .languageId(fnUser.getLanguageId())
140                       .guest(fnUser.getGuest())
141                       .build();
142        }
143 }