2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 package org.openecomp.portalapp.portal.domain;
22 import java.util.Date;
23 import java.util.Iterator;
24 import java.util.SortedSet;
25 import java.util.TreeSet;
27 import org.openecomp.portalsdk.core.domain.support.DomainVo;
29 public class EPUser extends DomainVo {
32 private Long managerId;
33 private String firstName;
34 private String middleInitial;
35 private String lastName;
38 private String cellular;
40 private Long addressId;
41 private String alertMethodCd;
43 private String orgUserId;
44 private String orgCode;
45 private String address1;
46 private String address2;
49 private String zipCode;
50 private String country;
51 private String orgManagerUserId;
52 private String locationClli;
53 private String businessCountryCode;
54 private String businessCountryName;
55 private String businessUnit;
56 private String businessUnitName;
57 private String department;
58 private String departmentName;
59 private String companyCode;
60 private String company;
61 private String zipCodeSuffix;
62 private String jobTitle;
63 private String commandChain;
64 private String siloStatus;
65 private String costCenter;
66 private String financialLocCode;
70 private String loginId;
71 private String loginPwd;
72 private Date lastLoginDate;
73 private boolean active;
74 private boolean internal;
75 private Long selectedProfileId;
76 private Long timeZoneId;
77 private boolean online;
78 private String chatId;
80 private static final long serialVersionUID = 1L;
82 private static final long ECOMP_PORTAL_ID = 1L;
83 private static final String ECOMP_PORTAL_NAME = "ECOMP";
84 private boolean isGuest = false;
86 private SortedSet<EPUserApp> userApps = new TreeSet<EPUserApp>();
87 private SortedSet<EPRole> pseudoRoles = new TreeSet<EPRole>();
91 public Long getAddressId() {
95 public String getAlertMethodCd() {
99 public String getCellular() {
103 public String getEmail() {
107 public String getFax() {
111 public String getFirstName() {
115 public String getHrid() {
119 public Date getLastLoginDate() {
120 return lastLoginDate;
123 public String getLastName() {
127 public String getFullName() {
128 return getFirstName() + " " + getLastName();
131 public String getLoginId() {
135 public String getLoginPwd() {
139 public Long getManagerId() {
143 public String getMiddleInitial() {
144 return middleInitial;
147 public String getOrgCode() {
151 public Long getOrgId() {
155 public String getPhone() {
159 public String getOrgUserId() {
163 public boolean getActive() {
167 public boolean getInternal() {
171 public String getAddress1() {
175 public String getAddress2() {
179 public String getCity() {
183 public String getCountry() {
187 public String getState() {
191 public String getZipCode() {
195 public String getBusinessCountryCode() {
196 return businessCountryCode;
199 public String getCommandChain() {
203 public String getCompany() {
207 public String getCompanyCode() {
211 public String getDepartment() {
215 public String getJobTitle() {
219 public String getLocationClli() {
223 public String getOrgManagerUserId() {
224 return orgManagerUserId;
227 public String getZipCodeSuffix() {
228 return zipCodeSuffix;
231 public String getBusinessCountryName() {
232 return businessCountryName;
235 public Long getSelectedProfileId() {
236 return selectedProfileId;
239 public void setAddressId(Long addressId) {
240 this.addressId = addressId;
243 public void setAlertMethodCd(String alertMethodCd) {
244 this.alertMethodCd = alertMethodCd;
247 public void setCellular(String cellular) {
248 this.cellular = cellular;
251 public void setEmail(String email) {
255 public void setFax(String fax) {
259 public void setFirstName(String firstName) {
260 this.firstName = firstName;
263 public void setHrid(String hrid) {
267 public void setLastLoginDate(Date lastLoginDate) {
268 this.lastLoginDate = lastLoginDate;
271 public void setLastName(String lastName) {
272 this.lastName = lastName;
275 public void setLoginId(String loginId) {
276 this.loginId = loginId;
279 public void setLoginPwd(String loginPwd) {
280 this.loginPwd = loginPwd;
283 public void setManagerId(Long managerId) {
284 this.managerId = managerId;
287 public void setMiddleInitial(String middleInitial) {
288 this.middleInitial = middleInitial;
291 public void setOrgCode(String orgCode) {
292 this.orgCode = orgCode;
295 public void setOrgId(Long orgId) {
299 public void setPhone(String phone) {
303 public void setOrgUserId(String orgUserId) {
304 this.orgUserId = orgUserId;
307 public void setActive(boolean active) {
308 this.active = active;
311 public void setInternal(boolean internal) {
312 this.internal = internal;
315 public void setAddress1(String address1) {
316 this.address1 = address1;
319 public void setAddress2(String address2) {
320 this.address2 = address2;
323 public void setCity(String city) {
327 public void setCountry(String country) {
328 this.country = country;
331 public void setState(String state) {
335 public void setZipCode(String zipCode) {
336 this.zipCode = zipCode;
339 public void setBusinessCountryCode(String businessCountryCode) {
340 this.businessCountryCode = businessCountryCode;
343 public void setCommandChain(String commandChain) {
344 this.commandChain = commandChain;
347 public void setCompany(String company) {
348 this.company = company;
351 public void setCompanyCode(String companyCode) {
352 this.companyCode = companyCode;
355 public void setDepartment(String department) {
356 this.department = department;
359 public void setJobTitle(String jobTitle) {
360 this.jobTitle = jobTitle;
363 public void setLocationClli(String locationClli) {
364 this.locationClli = locationClli;
367 public void setOrgManagerUserId(String orgManagerUserId) {
368 this.orgManagerUserId = orgManagerUserId;
371 public void setZipCodeSuffix(String zipCodeSuffix) {
372 this.zipCodeSuffix = zipCodeSuffix;
375 public void setBusinessCountryName(String businessCountryName) {
376 this.businessCountryName = businessCountryName;
379 public SortedSet<EPRole> getPseudoRoles() {
383 public void setPseudoRoles(SortedSet<EPRole> pseudoRoles) {
384 this.pseudoRoles = pseudoRoles;
387 public void setSelectedProfileId(Long selectedProfileId) {
388 this.selectedProfileId = selectedProfileId;
391 public Long getTimeZoneId() {
395 public void setTimeZoneId(Long timeZoneId) {
396 this.timeZoneId = timeZoneId;
399 public String getBusinessUnit() {
403 public void setBusinessUnit(String businessUnit) {
404 this.businessUnit = businessUnit;
407 public String getSiloStatus() {
411 public void setSiloStatus(String siloStatus) {
412 this.siloStatus = siloStatus;
415 public String getCostCenter() {
419 public void setCostCenter(String costCenter) {
420 this.costCenter = costCenter;
423 public String getFinancialLocCode() {
424 return financialLocCode;
427 public void setFinancialLocCode(String financialLocCode) {
428 this.financialLocCode = financialLocCode;
431 public String getBusinessUnitName() {
432 return businessUnitName;
435 public void setBusinessUnitName(String businessUnitName) {
436 this.businessUnitName = businessUnitName;
439 public String getDepartmentName() {
440 return departmentName;
443 public void setDepartmentName(String departmentName) {
444 this.departmentName = departmentName;
447 public int compareTo(Object obj){
448 EPUser user = (EPUser)obj;
450 String c1 = getLastName() + getFirstName() + getMiddleInitial();
451 String c2 = user.getLastName() + user.getFirstName() + user.getMiddleInitial();
453 return c1.compareTo(c2);
456 public boolean isOnline() {
460 public void setOnline(boolean online) {
461 this.online = online;
464 public String getChatId() {
468 public void setChatId(String chatId) {
469 this.chatId = chatId;
473 public void setPseudoEPRoles(SortedSet<EPRole> pseudoRoles) {
474 this.pseudoRoles = pseudoRoles;
477 public SortedSet<EPUserApp> getEPUserApps() {
481 public void setEPUserApps(SortedSet<EPUserApp> userApps) {
482 this.userApps = userApps;
485 public void addUserApp(EPUserApp userApp) {
486 userApps.add(userApp);
489 public void addAppRoles(EPApp app, SortedSet<EPRole> roles) {
492 SortedSet<EPUserApp> userApps = new TreeSet<EPUserApp>();
493 // this.userApps.removeAll(this.userApps);
494 Iterator<EPRole> itr = roles.iterator();
495 while (itr.hasNext()) {
496 EPRole role = (EPRole) itr.next();
497 EPUserApp userApp = new EPUserApp();
498 userApp.setUserId(this.id);
500 userApp.setRole(role);
501 userApps.add(userApp);
503 setEPUserApps(userApps);
511 public SortedSet<EPRole> getAppEPRoles(EPApp app) {
512 SortedSet<EPRole> roles = new TreeSet<EPRole>();
513 SortedSet<EPUserApp> apps = getEPUserApps();
514 Iterator<EPUserApp> appsItr = apps.iterator();
515 EPUserApp userApp = null;
516 // getting default app
517 while (appsItr.hasNext()) {
518 EPUserApp tempUserApp = (EPUserApp) appsItr.next();
519 if (tempUserApp.getApp().getId().equals(app)) {
520 userApp = tempUserApp;
521 roles.add((EPRole) userApp.getRole());
528 * Attention! Not for use in ECOMP
530 public SortedSet<EPRole> getAppRoles(EPApp app) {
531 SortedSet<EPRole> roles = new TreeSet<EPRole>();
532 SortedSet<EPUserApp> apps = getEPUserApps();
533 Iterator<EPUserApp> appsItr = apps.iterator();
534 EPUserApp userApp = null;
535 // getting default app
536 while (appsItr.hasNext()) {
537 EPUserApp tempUserApp = (EPUserApp) appsItr.next();
538 if (tempUserApp.getApp().getId().equals(app.getId())) {
539 userApp = tempUserApp;
540 roles.add((EPRole) userApp.getRole());
547 * Attention! Not for use in ECOMP
549 public SortedSet<EPRole> getEPRoles() {
550 EPApp app = new EPApp();
551 app.setId(new Long(ECOMP_PORTAL_ID));
552 app.setName(ECOMP_PORTAL_NAME);
553 return getAppEPRoles(app);
557 * Attention! Not for use in ECOMP
559 public void setEPRoles(SortedSet<EPRole> roles) {
560 EPApp app = new EPApp();
561 app.setId(new Long(ECOMP_PORTAL_ID));
562 app.setName(ECOMP_PORTAL_NAME);
563 addAppRoles(app, roles);
567 * Attention! Not for use in ECOMP
569 public void removeEPRole(Long roleId) {
570 SortedSet<EPUserApp> apps = getEPUserApps();
571 Iterator<EPUserApp> appsItr = apps.iterator();
572 // getting default app
573 while (appsItr.hasNext()) {
574 EPUserApp tempUserApp = (EPUserApp) appsItr.next();
575 if (tempUserApp.equals(new Long(ECOMP_PORTAL_ID)) && tempUserApp.getRole().getId().equals(roleId)) {
582 * Attention! Not for use in ECOMP
584 public void addEPRole(EPRole role) {
586 SortedSet<EPRole> roles = getEPRoles();
588 roles = new TreeSet<EPRole>();
595 public boolean isGuest() {
599 public void setGuest(boolean isGuest) {
600 this.isGuest = isGuest;