f376d6da674e0c447d08a9ce2b29e6aeb417ba53
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / command / PostSearchBean.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the "License");
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
37  */
38 package org.onap.portalapp.command;
39
40 import java.util.List;
41
42 import org.onap.portalapp.portal.domain.EPUser;
43 import org.onap.portalsdk.core.command.support.SearchBase;
44
45 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
46
47 @JsonSerialize
48 public class PostSearchBean extends SearchBase {
49
50     private EPUser     user     = null;
51     private EPUser     userOrig = null;
52     private String[] selected;
53     private String[] postHrid;
54     private String[] postOrgUserId;
55     private String[] postFirstName;
56     private String[] postLastName;
57     private String[] postOrgCode;
58     private String[] postPhone;
59     private String[] postEmail;
60     private String[] postAddress1;
61     private String[] postAddress2;
62     private String[] postCity;
63     private String[] postState;
64     private String[] postZipCode;
65     private String[] postLocationClli;
66     private String[] postBusinessCountryCode;
67     private String[] postBusinessCountryName;
68     private String[] postDepartment;
69     private String[] postDepartmentName;
70     private String[] postBusinessUnit;
71     private String[] postBusinessUnitName;
72     private String[] postJobTitle;
73     private String[] postOrgManagerUserId;
74     private String[] postCommandChain;
75     private String[] postCompanyCode;
76     private String[] postCompany;
77     private String[] postCostCenter;
78     private String[] postSiloStatus;
79     private String[] postFinancialLocCode;
80
81
82     public PostSearchBean() {
83       this(null);
84     } // PostSearchBean
85
86     public PostSearchBean(List<?> items) {
87       super(items);
88
89       user     = new EPUser();
90       userOrig = new EPUser();
91
92       setSortBy1("");
93       setSortBy1Orig("");
94      
95     }   // PostSearchBean
96
97
98     public String getFirstName()                      { return user.getFirstName(); }
99     public String getLastName()                       { return user.getLastName(); }
100     public String getHrid()                           { return user.getHrid(); }
101     public String getOrgUserId()                      { return user.getOrgUserId(); }
102     public String getOrgCode()                        { return user.getOrgCode(); }
103     public String getEmail()                          { return user.getEmail(); }
104     public String getOrgManagerUserId()                  { return user.getOrgManagerUserId(); }
105     
106     public String getFirstNameOrig()                  { return user.getFirstName(); }
107     public String getLastNameOrig()                   { return user.getLastName(); }
108     public String getHridOrig()                       { return user.getHrid(); }
109     public String getOrgUserIdOrig()                  { return user.getOrgUserId(); }
110     public String getOrgCodeOrig()                    { return user.getOrgCode(); }
111     public String getEmailOrig()                      { return user.getEmail(); }
112     public String getOrgManagerUserIdOrig()              { return user.getOrgManagerUserId(); }
113     
114     
115     public EPUser getUser()                             { return user; }
116
117     public String[] getPostEmail() {
118         return postEmail;
119     }
120
121     public String[] getPostFirstName() {
122         return postFirstName;
123     }
124
125     public String[] getPostHrid() {
126         return postHrid;
127     }
128
129     public String[] getPostLastName() {
130         return postLastName;
131     }
132
133     public String[] getPostOrgCode() {
134         return postOrgCode;
135     }
136
137     public String[] getPostPhone() {
138         return postPhone;
139     }
140
141     public String[] getPostOrgUserId() {
142         return postOrgUserId;
143     }
144
145     public String[] getSelected() {
146         return selected;
147     }
148
149     public String[] getPostAddress1() {
150         return postAddress1;
151     }
152
153     public String[] getPostBusinessCountryCode() {
154         return postBusinessCountryCode;
155     }
156
157     public String[] getPostCity() {
158         return postCity;
159     }
160
161     public String[] getPostCommandChain() {
162         return postCommandChain;
163     }
164
165     public String[] getPostCompany() {
166         return postCompany;
167     }
168
169     public String[] getPostCompanyCode() {
170         return postCompanyCode;
171     }
172
173     public String[] getPostDepartment() {
174         return postDepartment;
175     }
176
177     public String[] getPostDepartmentName() {
178         return postDepartmentName;
179     }
180
181     public String[] getPostBusinessCountryName() {
182         return postBusinessCountryName;
183     }
184
185     public String[] getPostJobTitle() {
186         return postJobTitle;
187     }
188
189     public String[] getPostLocationClli() {
190         return postLocationClli;
191     }
192
193     public String[] getPostManagerUserId() {
194         return postOrgManagerUserId;
195     }
196
197     public String[] getPostState() {
198         return postState;
199     }
200
201     public String[] getPostZipCode() {
202         return postZipCode;
203     }
204
205     public void setFirstName(String value)            { user.setFirstName(value); }
206     public void setLastName(String value)             { user.setLastName(value); }
207     public void setHrid(String value)                 { user.setHrid(value); }
208     public void setOrgUserId(String value)            { user.setOrgUserId(value); }
209     public void setOrgCode(String value)              { user.setOrgCode(value); }
210     public void setEmail(String value)                { user.setEmail(value); }
211     public void setOrgManagerUserId(String value)     { user.setOrgManagerUserId(value); }
212     
213     public void setFirstNameOrig(String value)        { userOrig.setFirstName(value); }
214     public void setLastNameOrig(String value)         { userOrig.setLastName(value); }
215     public void setHridOrig(String value)             { userOrig.setHrid(value); }
216     public void setOrgUserIdOrig(String value)        { userOrig.setOrgUserId(value); }
217     public void setOrgCodeOrig(String value)          { userOrig.setOrgCode(value); }
218     public void setEmailOrig(String value)            { userOrig.setEmail(value); }
219     public void setOrgManagerUserIdOrig(String value) { userOrig.setOrgManagerUserId(value); }
220     
221     public void setUser(EPUser value)                   { this.user = value; }
222
223     public void setPostEmail(String[] postEmail) {
224         this.postEmail = postEmail;
225     }
226
227     public void setPostFirstName(String[] postFirstName) {
228         this.postFirstName = postFirstName;
229     }
230
231     public void setPostHrid(String[] postHrid) {
232         this.postHrid = postHrid;
233     }
234
235     public void setPostLastName(String[] postLastName) {
236         this.postLastName = postLastName;
237     }
238
239     public void setPostOrgCode(String[] postOrgCode) {
240         this.postOrgCode = postOrgCode;
241     }
242
243     public void setPostPhone(String[] postPhone) {
244         this.postPhone = postPhone;
245     }
246
247     public void setPostUserId(String[] postOrgUserId) {
248         this.postOrgUserId = postOrgUserId;
249     }
250
251     public void setSelected(String[] selected) {
252         this.selected = selected;
253     }
254
255     public void setPostAddress1(String[] postAddress1) {
256         this.postAddress1 = postAddress1;
257     }
258
259     public void setPostBusinessCountryCode(String[] postBusinessCountryCode) {
260         this.postBusinessCountryCode = postBusinessCountryCode;
261     }
262
263     public void setPostCity(String[] postCity) {
264         this.postCity = postCity;
265     }
266
267     public void setPostCommandChain(String[] postCommandChain) {
268         this.postCommandChain = postCommandChain;
269     }
270
271     public void setPostCompany(String[] postCompany) {
272         this.postCompany = postCompany;
273     }
274
275     public void setPostCompanyCode(String[] postCompanyCode) {
276         this.postCompanyCode = postCompanyCode;
277     }
278
279     public void setPostDepartment(String[] postDepartment) {
280         this.postDepartment = postDepartment;
281     }
282
283     public void setPostDepartmentName(String[] postDepartmentName) {
284         this.postDepartmentName = postDepartmentName;
285     }
286
287     public void setPostBusinessCountryName(String[] postBusinessCountryName) {
288         this.postBusinessCountryName = postBusinessCountryName;
289     }
290
291     public void setPostJobTitle(String[] postJobTitle) {
292         this.postJobTitle = postJobTitle;
293     }
294
295     public void setPostLocationClli(String[] postLocationClli) {
296         this.postLocationClli = postLocationClli;
297     }
298
299     public void setPostManagerUserId(String[] postOrgManagerUserId) {
300         this.postOrgManagerUserId = postOrgManagerUserId;
301     }
302
303     public void setPostState(String[] postState) {
304         this.postState = postState;
305     }
306
307     public void setPostZipCode(String[] postZipCode) {
308         this.postZipCode = postZipCode;
309     }
310     
311     public String[] getPostAddress2() {
312                 return postAddress2;
313         }
314
315         public void setPostAddress2(String[] postAddress2) {
316                 this.postAddress2 = postAddress2;
317         }
318
319         public EPUser getUserOrig() {
320                 return userOrig;
321         }
322
323         public void setUserOrig(EPUser userOrig) {
324                 this.userOrig = userOrig;
325         }
326
327         public String[] getPostBusinessUnit() {
328                 return postBusinessUnit;
329         }
330
331         public void setPostBusinessUnit(String[] postBusinessUnit) {
332                 this.postBusinessUnit = postBusinessUnit;
333         }
334
335         public String[] getPostBusinessUnitName() {
336                 return postBusinessUnitName;
337         }
338
339         public void setPostBusinessUnitName(String[] postBusinessUnitName) {
340                 this.postBusinessUnitName = postBusinessUnitName;
341         }
342
343         public String[] getPostCostCenter() {
344                 return postCostCenter;
345         }
346
347         public void setPostCostCenter(String[] postCostCenter) {
348                 this.postCostCenter = postCostCenter;
349         }
350
351         public String[] getPostSiloStatus() {
352                 return postSiloStatus;
353         }
354
355         public void setPostSiloStatus(String[] postSiloStatus) {
356                 this.postSiloStatus = postSiloStatus;
357         }
358
359         public String[] getPostFinancialLocCode() {
360                 return postFinancialLocCode;
361         }
362
363         public void setPostFinancialLocCode(String[] postFinancialLocCode) {
364                 this.postFinancialLocCode = postFinancialLocCode;
365         }
366
367         @Override
368         public void resetSearch() {
369           super.resetSearch();
370           setUser(new EPUser());
371         } // resetSearch
372
373
374         public boolean isCriteriaUpdated() {
375           if(user==null&&userOrig==null)
376             return false;
377           else if(user==null||userOrig==null)
378             return true;
379           else
380             return (! (
381                 Utilities.nvl(user.getFirstName()).equals(Utilities.nvl(userOrig.getFirstName()))&&
382                 Utilities.nvl(user.getLastName()).equals(Utilities.nvl(userOrig.getLastName()))&&
383                 //Utilities.nvl(user.getHrid()).equals(Utilities.nvl(userOrig.getHrid()))&&
384                 Utilities.nvl(user.getOrgUserId()).equals(Utilities.nvl(userOrig.getOrgUserId()))&&
385                 Utilities.nvl(user.getOrgCode()).equals(Utilities.nvl(userOrig.getOrgCode()))&&
386                 Utilities.nvl(user.getEmail()).equals(Utilities.nvl(userOrig.getEmail()))&&
387                 Utilities.nvl(user.getOrgManagerUserId()).equals(Utilities.nvl(userOrig.getOrgManagerUserId()))&&
388                 true));
389        } // isCriteriaUpdated
390
391 }       // PostSearchBean