Merge "Use managed guava version"
[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  * Modifications Copyright (C) 2018 IBM.
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 package org.onap.portalapp.command;
41
42 import java.util.List;
43
44 import org.onap.portalapp.portal.domain.EPUser;
45 import org.onap.portalsdk.core.command.support.SearchBase;
46
47 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
48
49 @JsonSerialize
50 public class PostSearchBean extends SearchBase {
51
52     private EPUser     user     = null;
53     private EPUser     userOrig = null;
54     private String[] selected;
55     private String[] postHrid;
56     private String[] postOrgUserId;
57     private String[] postFirstName;
58     private String[] postLastName;
59     private String[] postOrgCode;
60     private String[] postPhone;
61     private String[] postEmail;
62     private String[] postAddress1;
63     private String[] postAddress2;
64     private String[] postCity;
65     private String[] postState;
66     private String[] postZipCode;
67     private String[] postLocationClli;
68     private String[] postBusinessCountryCode;
69     private String[] postBusinessCountryName;
70     private String[] postDepartment;
71     private String[] postDepartmentName;
72     private String[] postBusinessUnit;
73     private String[] postBusinessUnitName;
74     private String[] postJobTitle;
75     private String[] postOrgManagerUserId;
76     private String[] postCommandChain;
77     private String[] postCompanyCode;
78     private String[] postCompany;
79     private String[] postCostCenter;
80     private String[] postSiloStatus;
81     private String[] postFinancialLocCode;
82
83
84     public PostSearchBean() {
85       this(null);
86     } // PostSearchBean
87
88     public PostSearchBean(List<?> items) {
89       super(items);
90
91       user     = new EPUser();
92       userOrig = new EPUser();
93
94       setSortBy1("");
95       setSortBy1Orig("");
96      
97     }   // PostSearchBean
98
99
100     public String getFirstName()                      { return user.getFirstName(); }
101     public String getLastName()                       { return user.getLastName(); }
102     public String getHrid()                           { return user.getHrid(); }
103     public String getOrgUserId()                      { return user.getOrgUserId(); }
104     public String getOrgCode()                        { return user.getOrgCode(); }
105     public String getEmail()                          { return user.getEmail(); }
106     public String getOrgManagerUserId()                  { return user.getOrgManagerUserId(); }
107     
108     public String getFirstNameOrig()                  { return user.getFirstName(); }
109     public String getLastNameOrig()                   { return user.getLastName(); }
110     public String getHridOrig()                       { return user.getHrid(); }
111     public String getOrgUserIdOrig()                  { return user.getOrgUserId(); }
112     public String getOrgCodeOrig()                    { return user.getOrgCode(); }
113     public String getEmailOrig()                      { return user.getEmail(); }
114     public String getOrgManagerUserIdOrig()              { return user.getOrgManagerUserId(); }
115     
116     
117     public EPUser getUser()                             { return user; }
118
119     public String[] getPostEmail() {
120         return postEmail;
121     }
122
123     public String[] getPostFirstName() {
124         return postFirstName;
125     }
126
127     public String[] getPostHrid() {
128         return postHrid;
129     }
130
131     public String[] getPostLastName() {
132         return postLastName;
133     }
134
135     public String[] getPostOrgCode() {
136         return postOrgCode;
137     }
138
139     public String[] getPostPhone() {
140         return postPhone;
141     }
142
143     public String[] getPostOrgUserId() {
144         return postOrgUserId;
145     }
146
147     public String[] getSelected() {
148         return selected;
149     }
150
151     public String[] getPostAddress1() {
152         return postAddress1;
153     }
154
155     public String[] getPostBusinessCountryCode() {
156         return postBusinessCountryCode;
157     }
158
159     public String[] getPostCity() {
160         return postCity;
161     }
162
163     public String[] getPostCommandChain() {
164         return postCommandChain;
165     }
166
167     public String[] getPostCompany() {
168         return postCompany;
169     }
170
171     public String[] getPostCompanyCode() {
172         return postCompanyCode;
173     }
174
175     public String[] getPostDepartment() {
176         return postDepartment;
177     }
178
179     public String[] getPostDepartmentName() {
180         return postDepartmentName;
181     }
182
183     public String[] getPostBusinessCountryName() {
184         return postBusinessCountryName;
185     }
186
187     public String[] getPostJobTitle() {
188         return postJobTitle;
189     }
190
191     public String[] getPostLocationClli() {
192         return postLocationClli;
193     }
194
195     public String[] getPostManagerUserId() {
196         return postOrgManagerUserId;
197     }
198
199     public String[] getPostState() {
200         return postState;
201     }
202
203     public String[] getPostZipCode() {
204         return postZipCode;
205     }
206
207     public void setFirstName(String value)            { user.setFirstName(value); }
208     public void setLastName(String value)             { user.setLastName(value); }
209     public void setHrid(String value)                 { user.setHrid(value); }
210     public void setOrgUserId(String value)            { user.setOrgUserId(value); }
211     public void setOrgCode(String value)              { user.setOrgCode(value); }
212     public void setEmail(String value)                { user.setEmail(value); }
213     public void setOrgManagerUserId(String value)     { user.setOrgManagerUserId(value); }
214     
215     public void setFirstNameOrig(String value)        { userOrig.setFirstName(value); }
216     public void setLastNameOrig(String value)         { userOrig.setLastName(value); }
217     public void setHridOrig(String value)             { userOrig.setHrid(value); }
218     public void setOrgUserIdOrig(String value)        { userOrig.setOrgUserId(value); }
219     public void setOrgCodeOrig(String value)          { userOrig.setOrgCode(value); }
220     public void setEmailOrig(String value)            { userOrig.setEmail(value); }
221     public void setOrgManagerUserIdOrig(String value) { userOrig.setOrgManagerUserId(value); }
222     
223     public void setUser(EPUser value)                   { this.user = value; }
224
225     public void setPostEmail(String[] postEmail) {
226         this.postEmail = postEmail;
227     }
228
229     public void setPostFirstName(String[] postFirstName) {
230         this.postFirstName = postFirstName;
231     }
232
233     public void setPostHrid(String[] postHrid) {
234         this.postHrid = postHrid;
235     }
236
237     public void setPostLastName(String[] postLastName) {
238         this.postLastName = postLastName;
239     }
240
241     public void setPostOrgCode(String[] postOrgCode) {
242         this.postOrgCode = postOrgCode;
243     }
244
245     public void setPostPhone(String[] postPhone) {
246         this.postPhone = postPhone;
247     }
248
249     public void setPostUserId(String[] postOrgUserId) {
250         this.postOrgUserId = postOrgUserId;
251     }
252
253     public void setSelected(String[] selected) {
254         this.selected = selected;
255     }
256
257     public void setPostAddress1(String[] postAddress1) {
258         this.postAddress1 = postAddress1;
259     }
260
261     public void setPostBusinessCountryCode(String[] postBusinessCountryCode) {
262         this.postBusinessCountryCode = postBusinessCountryCode;
263     }
264
265     public void setPostCity(String[] postCity) {
266         this.postCity = postCity;
267     }
268
269     public void setPostCommandChain(String[] postCommandChain) {
270         this.postCommandChain = postCommandChain;
271     }
272
273     public void setPostCompany(String[] postCompany) {
274         this.postCompany = postCompany;
275     }
276
277     public void setPostCompanyCode(String[] postCompanyCode) {
278         this.postCompanyCode = postCompanyCode;
279     }
280
281     public void setPostDepartment(String[] postDepartment) {
282         this.postDepartment = postDepartment;
283     }
284
285     public void setPostDepartmentName(String[] postDepartmentName) {
286         this.postDepartmentName = postDepartmentName;
287     }
288
289     public void setPostBusinessCountryName(String[] postBusinessCountryName) {
290         this.postBusinessCountryName = postBusinessCountryName;
291     }
292
293     public void setPostJobTitle(String[] postJobTitle) {
294         this.postJobTitle = postJobTitle;
295     }
296
297     public void setPostLocationClli(String[] postLocationClli) {
298         this.postLocationClli = postLocationClli;
299     }
300
301     public void setPostManagerUserId(String[] postOrgManagerUserId) {
302         this.postOrgManagerUserId = postOrgManagerUserId;
303     }
304
305     public void setPostState(String[] postState) {
306         this.postState = postState;
307     }
308
309     public void setPostZipCode(String[] postZipCode) {
310         this.postZipCode = postZipCode;
311     }
312     
313     public String[] getPostAddress2() {
314                 return postAddress2;
315         }
316
317         public void setPostAddress2(String[] postAddress2) {
318                 this.postAddress2 = postAddress2;
319         }
320
321         public EPUser getUserOrig() {
322                 return userOrig;
323         }
324
325         public void setUserOrig(EPUser userOrig) {
326                 this.userOrig = userOrig;
327         }
328
329         public String[] getPostBusinessUnit() {
330                 return postBusinessUnit;
331         }
332
333         public void setPostBusinessUnit(String[] postBusinessUnit) {
334                 this.postBusinessUnit = postBusinessUnit;
335         }
336
337         public String[] getPostBusinessUnitName() {
338                 return postBusinessUnitName;
339         }
340
341         public void setPostBusinessUnitName(String[] postBusinessUnitName) {
342                 this.postBusinessUnitName = postBusinessUnitName;
343         }
344
345         public String[] getPostCostCenter() {
346                 return postCostCenter;
347         }
348
349         public void setPostCostCenter(String[] postCostCenter) {
350                 this.postCostCenter = postCostCenter;
351         }
352
353         public String[] getPostSiloStatus() {
354                 return postSiloStatus;
355         }
356
357         public void setPostSiloStatus(String[] postSiloStatus) {
358                 this.postSiloStatus = postSiloStatus;
359         }
360
361         public String[] getPostFinancialLocCode() {
362                 return postFinancialLocCode;
363         }
364
365         public void setPostFinancialLocCode(String[] postFinancialLocCode) {
366                 this.postFinancialLocCode = postFinancialLocCode;
367         }
368
369         @Override
370         public void resetSearch() {
371           super.resetSearch();
372           setUser(new EPUser());
373         } // resetSearch
374
375
376         public boolean isCriteriaUpdated() {
377           final boolean flag = true;
378           if(user==null&&userOrig==null)
379             return false;
380           else if(user==null||userOrig==null)
381             return true;
382           else {
383                       boolean value = Utilities.nvl(user.getFirstName()).equals(Utilities.nvl(userOrig.getFirstName()))&&
384                       Utilities.nvl(user.getLastName()).equals(Utilities.nvl(userOrig.getLastName()))&&
385                       //Utilities.nvl(user.getHrid()).equals(Utilities.nvl(userOrig.getHrid()))&&
386                       Utilities.nvl(user.getOrgUserId()).equals(Utilities.nvl(userOrig.getOrgUserId()))&&
387                       Utilities.nvl(user.getOrgCode()).equals(Utilities.nvl(userOrig.getOrgCode()))&&
388                       Utilities.nvl(user.getEmail()).equals(Utilities.nvl(userOrig.getEmail()))&&
389                       Utilities.nvl(user.getOrgManagerUserId()).equals(Utilities.nvl(userOrig.getOrgManagerUserId()));
390             return (!(value && flag));
391           }
392        } // isCriteriaUpdated
393
394 }       // PostSearchBean