diff options
Diffstat (limited to 'ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/User.java')
-rw-r--r-- | ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/User.java | 714 |
1 files changed, 353 insertions, 361 deletions
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/User.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/User.java index a72f1d6a..6d823817 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/User.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/User.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,7 +37,6 @@ */ package org.onap.portalsdk.core.domain; - import java.util.Date; import java.util.Iterator; import java.util.Set; @@ -47,374 +46,370 @@ import java.util.TreeSet; import org.onap.portalsdk.core.domain.support.DomainVo; /** - * <p>User.java</p> + * <p> + * User.java + * </p> * - * <p>Represents a user data object.</p> + * <p> + * Represents a user data object. + * </p> * * @version 1.0 */ public class User extends DomainVo { - - /** - * - */ + private static final long serialVersionUID = 1L; - private Long orgId; - private Long managerId; - private String firstName; - private String middleInitial; - private String lastName; - private String phone; - private String fax; - private String cellular; - private String email; - private Long addressId; - private String alertMethodCd; - private String hrid; - private String orgUserId; - private String orgCode; - private String address1; - private String address2; - private String city; - private String state; - private String zipCode; - private String country; - private String orgManagerUserId; - private String locationClli; - private String businessCountryCode; - private String businessCountryName; - private String businessUnit; - private String businessUnitName; - private String department; - private String departmentName; - private String companyCode; - private String company; - private String zipCodeSuffix; - private String jobTitle; - private String commandChain; - private String siloStatus; - private String costCenter; - private String financialLocCode; - - - - private String loginId; - private String loginPwd; - private Date lastLoginDate; - private boolean active; - private boolean internal; - private Long selectedProfileId; - private Long timeZoneId; - private boolean online; - private String chatId; - - private Set userApps = new TreeSet(); - - private Set pseudoRoles = new TreeSet(); - - - public User() {} - - public Long getAddressId() { - return addressId; - } - - public String getAlertMethodCd() { - return alertMethodCd; - } - - public String getCellular() { - return cellular; - } - - public String getEmail() { - return email; - } - - public String getFax() { - return fax; - } - - public String getFirstName() { - return firstName; - } - - public String getHrid() { - return hrid; - } - - public Date getLastLoginDate() { - return lastLoginDate; - } - - public String getLastName() { - return lastName; - } - - public String getFullName() { - return getFirstName() + " " + getLastName(); - } - - public String getLoginId() { - return loginId; - } - - public String getLoginPwd() { - return loginPwd; - } - - public Long getManagerId() { - return managerId; - } - - public String getMiddleInitial() { - return middleInitial; - } - - public String getOrgCode() { - return orgCode; - } - - public Long getOrgId() { - return orgId; - } - - public String getPhone() { - return phone; - } - - public String getOrgUserId() { - return orgUserId; - } - - public boolean getActive() { - return active; - } - - public boolean getInternal() { - return internal; - } - - public String getAddress1() { - return address1; - } - - public String getAddress2() { - return address2; - } - - public String getCity() { - return city; - } + private Long orgId; + private Long managerId; + private String firstName; + private String middleInitial; + private String lastName; + private String phone; + private String fax; + private String cellular; + private String email; + private Long addressId; + private String alertMethodCd; + private String hrid; + private String orgUserId; + private String orgCode; + private String address1; + private String address2; + private String city; + private String state; + private String zipCode; + private String country; + private String orgManagerUserId; + private String locationClli; + private String businessCountryCode; + private String businessCountryName; + private String businessUnit; + private String businessUnitName; + private String department; + private String departmentName; + private String companyCode; + private String company; + private String zipCodeSuffix; + private String jobTitle; + private String commandChain; + private String siloStatus; + private String costCenter; + private String financialLocCode; + + private String loginId; + private String loginPwd; + private Date lastLoginDate; + private boolean active; + private boolean internal; + private Long selectedProfileId; + private Long timeZoneId; + private boolean online; + private String chatId; + + private Set userApps = new TreeSet(); + + private Set pseudoRoles = new TreeSet(); + + public Long getAddressId() { + return addressId; + } + + public String getAlertMethodCd() { + return alertMethodCd; + } + + public String getCellular() { + return cellular; + } + + public String getEmail() { + return email; + } + + public String getFax() { + return fax; + } + + public String getFirstName() { + return firstName; + } + + public String getHrid() { + return hrid; + } + + public Date getLastLoginDate() { + return lastLoginDate; + } + + public String getLastName() { + return lastName; + } + + public String getFullName() { + return getFirstName() + " " + getLastName(); + } + + public String getLoginId() { + return loginId; + } + + public String getLoginPwd() { + return loginPwd; + } + + public Long getManagerId() { + return managerId; + } + + public String getMiddleInitial() { + return middleInitial; + } - public String getCountry() { - return country; - } + public String getOrgCode() { + return orgCode; + } - public String getState() { - return state; - } + public Long getOrgId() { + return orgId; + } - public String getZipCode() { - return zipCode; - } + public String getPhone() { + return phone; + } - public String getBusinessCountryCode() { - return businessCountryCode; - } + public String getOrgUserId() { + return orgUserId; + } - public String getCommandChain() { - return commandChain; - } + public boolean getActive() { + return active; + } - public String getCompany() { - return company; - } + public boolean getInternal() { + return internal; + } - public String getCompanyCode() { - return companyCode; - } + public String getAddress1() { + return address1; + } - public String getDepartment() { - return department; - } + public String getAddress2() { + return address2; + } - public String getJobTitle() { - return jobTitle; - } + public String getCity() { + return city; + } + + public String getCountry() { + return country; + } + + public String getState() { + return state; + } + + public String getZipCode() { + return zipCode; + } + + public String getBusinessCountryCode() { + return businessCountryCode; + } + + public String getCommandChain() { + return commandChain; + } + + public String getCompany() { + return company; + } + + public String getCompanyCode() { + return companyCode; + } + + public String getDepartment() { + return department; + } + + public String getJobTitle() { + return jobTitle; + } + + public String getLocationClli() { + return locationClli; + } - public String getLocationClli() { - return locationClli; - } + public String getOrgManagerUserId() { + return orgManagerUserId; + } - public String getOrgManagerUserId() { - return orgManagerUserId; - } + public String getZipCodeSuffix() { + return zipCodeSuffix; + } - public String getZipCodeSuffix() { - return zipCodeSuffix; - } + public String getBusinessCountryName() { + return businessCountryName; + } - public String getBusinessCountryName() { - return businessCountryName; - } + public Set getPseudoRoles() { + return pseudoRoles; + } - public Set getPseudoRoles() { - return pseudoRoles; - } + public Long getSelectedProfileId() { + return selectedProfileId; + } - public Long getSelectedProfileId() { - return selectedProfileId; - } + public void setAddressId(Long addressId) { + this.addressId = addressId; + } - public void setAddressId(Long addressId) { - this.addressId = addressId; - } + public void setAlertMethodCd(String alertMethodCd) { + this.alertMethodCd = alertMethodCd; + } - public void setAlertMethodCd(String alertMethodCd) { - this.alertMethodCd = alertMethodCd; - } + public void setCellular(String cellular) { + this.cellular = cellular; + } - public void setCellular(String cellular) { - this.cellular = cellular; - } + public void setEmail(String email) { + this.email = email; + } - public void setEmail(String email) { - this.email = email; - } + public void setFax(String fax) { + this.fax = fax; + } - public void setFax(String fax) { - this.fax = fax; - } + public void setFirstName(String firstName) { + this.firstName = firstName; + } - public void setFirstName(String firstName) { - this.firstName = firstName; - } + public void setHrid(String hrid) { + this.hrid = hrid; + } - public void setHrid(String hrid) { - this.hrid = hrid; - } + public void setLastLoginDate(Date lastLoginDate) { + this.lastLoginDate = lastLoginDate; + } - public void setLastLoginDate(Date lastLoginDate) { - this.lastLoginDate = lastLoginDate; - } + public void setLastName(String lastName) { + this.lastName = lastName; + } - public void setLastName(String lastName) { - this.lastName = lastName; - } + public void setLoginId(String loginId) { + this.loginId = loginId; + } - public void setLoginId(String loginId) { - this.loginId = loginId; - } + public void setLoginPwd(String loginPwd) { + this.loginPwd = loginPwd; + } - public void setLoginPwd(String loginPwd) { - this.loginPwd = loginPwd; - } + public void setManagerId(Long managerId) { + this.managerId = managerId; + } - public void setManagerId(Long managerId) { - this.managerId = managerId; - } + public void setMiddleInitial(String middleInitial) { + this.middleInitial = middleInitial; + } - public void setMiddleInitial(String middleInitial) { - this.middleInitial = middleInitial; - } + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } - public void setOrgCode(String orgCode) { - this.orgCode = orgCode; - } + public void setOrgId(Long orgId) { + this.orgId = orgId; + } - public void setOrgId(Long orgId) { - this.orgId = orgId; - } + public void setPhone(String phone) { + this.phone = phone; + } - public void setPhone(String phone) { - this.phone = phone; - } + public void setOrgUserId(String orgUserId) { + this.orgUserId = orgUserId; + } - public void setOrgUserId(String orgUserId) { - this.orgUserId = orgUserId; - } + public void setActive(boolean active) { + this.active = active; + } - public void setActive(boolean active) { - this.active = active; - } + public void setInternal(boolean internal) { + this.internal = internal; + } - public void setInternal(boolean internal) { - this.internal = internal; - } + public void setAddress1(String address1) { + this.address1 = address1; + } - public void setAddress1(String address1) { - this.address1 = address1; - } + public void setAddress2(String address2) { + this.address2 = address2; + } - public void setAddress2(String address2) { - this.address2 = address2; - } + public void setCity(String city) { + this.city = city; + } - public void setCity(String city) { - this.city = city; - } + public void setCountry(String country) { + this.country = country; + } - public void setCountry(String country) { - this.country = country; - } + public void setState(String state) { + this.state = state; + } - public void setState(String state) { - this.state = state; - } + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } + public void setBusinessCountryCode(String businessCountryCode) { + this.businessCountryCode = businessCountryCode; + } - public void setBusinessCountryCode(String businessCountryCode) { - this.businessCountryCode = businessCountryCode; - } + public void setCommandChain(String commandChain) { + this.commandChain = commandChain; + } - public void setCommandChain(String commandChain) { - this.commandChain = commandChain; - } + public void setCompany(String company) { + this.company = company; + } - public void setCompany(String company) { - this.company = company; - } + public void setCompanyCode(String companyCode) { + this.companyCode = companyCode; + } - public void setCompanyCode(String companyCode) { - this.companyCode = companyCode; - } + public void setDepartment(String department) { + this.department = department; + } - public void setDepartment(String department) { - this.department = department; - } + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } - public void setJobTitle(String jobTitle) { - this.jobTitle = jobTitle; - } + public void setLocationClli(String locationClli) { + this.locationClli = locationClli; + } - public void setLocationClli(String locationClli) { - this.locationClli = locationClli; - } + public void setOrgManagerUserId(String orgManagerUserId) { + this.orgManagerUserId = orgManagerUserId; + } - public void setOrgManagerUserId(String orgManagerUserId) { - this.orgManagerUserId = orgManagerUserId; - } + public void setZipCodeSuffix(String zipCodeSuffix) { + this.zipCodeSuffix = zipCodeSuffix; + } - public void setZipCodeSuffix(String zipCodeSuffix) { - this.zipCodeSuffix = zipCodeSuffix; - } + public void setBusinessCountryName(String businessCountryName) { + this.businessCountryName = businessCountryName; + } - public void setBusinessCountryName(String businessCountryName) { - this.businessCountryName = businessCountryName; - } + public void setPseudoRoles(Set pseudoRoles) { + this.pseudoRoles = pseudoRoles; + } - public void setPseudoRoles(Set pseudoRoles) { - this.pseudoRoles = pseudoRoles; - } + public void setSelectedProfileId(Long selectedProfileId) { + this.selectedProfileId = selectedProfileId; + } - public void setSelectedProfileId(Long selectedProfileId) { - this.selectedProfileId = selectedProfileId; - } - public Long getTimeZoneId() { return timeZoneId; } @@ -454,7 +449,7 @@ public class User extends DomainVo { public void setFinancialLocCode(String financialLocCode) { this.financialLocCode = financialLocCode; } - + public String getBusinessUnitName() { return businessUnitName; } @@ -471,15 +466,6 @@ public class User extends DomainVo { this.departmentName = departmentName; } - public int compareTo(Object obj){ - User user = (User)obj; - - String c1 = getLastName() + getFirstName() + getMiddleInitial(); - String c2 = user.getLastName() + user.getFirstName() + user.getMiddleInitial(); - - return c1.compareTo(c2); - } - public boolean isOnline() { return online; } @@ -503,28 +489,27 @@ public class User extends DomainVo { public void setUserApps(Set userApps) { this.userApps = userApps; } - + @SuppressWarnings("unchecked") public void addAppRoles(App app, SortedSet<Role> roles) { - if(roles!=null){ - //add all - Set userApps = new TreeSet(); + if (roles != null) { + // add all + Set newUserApps = new TreeSet(); Iterator itr = roles.iterator(); - while(itr.hasNext()){ + while (itr.hasNext()) { Role role = (Role) itr.next(); UserApp userApp = new UserApp(); userApp.setUserId(this.id); userApp.setApp(app); userApp.setRole(role); - userApps.add(userApp); + newUserApps.add(userApp); } - setUserApps(userApps); + setUserApps(newUserApps); } else { - //remove all + // remove all this.userApps.clear(); } - } @SuppressWarnings("unchecked") @@ -532,13 +517,11 @@ public class User extends DomainVo { SortedSet<Role> roles = new TreeSet(); Set apps = getUserApps(); Iterator appsItr = apps.iterator(); - UserApp userApp = null; - //getting default app - while(appsItr.hasNext()){ - UserApp tempUserApp = (UserApp)appsItr.next(); - if(tempUserApp.getApp().getId().equals(app.getId())){ - userApp = tempUserApp; - roles.add(userApp.getRole()); + // getting default app + while (appsItr.hasNext()) { + UserApp tempUserApp = (UserApp) appsItr.next(); + if (tempUserApp.getApp().getId().equals(app.getId())) { + roles.add(tempUserApp.getRole()); } } return roles; @@ -550,53 +533,62 @@ public class User extends DomainVo { app.setName("Default"); return getAppRoles(app); } - - public UserApp getDefaultUserApp(){ + + public UserApp getDefaultUserApp() { Set apps = getUserApps(); Iterator appsItr = apps.iterator(); UserApp userApp = null; - //getting default app - while(appsItr.hasNext()){ - UserApp tempApp = (UserApp)appsItr.next(); - if(tempApp.equals(new Long(1))){ + // getting default app + while (appsItr.hasNext()) { + UserApp tempApp = (UserApp) appsItr.next(); + if (tempApp.getApp().getId().equals(new Long(1))) { userApp = tempApp; break; } } return userApp; } - + public void setRoles(SortedSet<Role> roles) { App app = new App(); app.setId(new Long(1)); app.setName("Default"); - addAppRoles(app,roles); + addAppRoles(app, roles); } - + public void removeRole(Long roleId) { Set apps = getUserApps(); Iterator appsItr = apps.iterator(); - //getting default app - while(appsItr.hasNext()){ - UserApp tempUserApp = (UserApp)appsItr.next(); - if(tempUserApp.getRole().getId().equals(roleId)){ - appsItr.remove(); - } + // getting default app + while (appsItr.hasNext()) { + UserApp tempUserApp = (UserApp) appsItr.next(); + if (tempUserApp.getRole().getId().equals(roleId)) { + appsItr.remove(); } - + } + } - + @SuppressWarnings("unchecked") - public void addRole(Role role){ - if(role!=null){ + public void addRole(Role role) { + if (role != null) { SortedSet<Role> roles = getRoles(); - if(roles==null){ + if (roles == null) { roles = new TreeSet(); - } + } roles.add(role); - setRoles(roles); + setRoles(roles); } + } + + @Override + public int compareTo(Object obj) { + User user = (User) obj; + + String c1 = getLastName() + getFirstName() + getMiddleInitial(); + String c2 = user.getLastName() + user.getFirstName() + user.getMiddleInitial(); + return c1.compareTo(c2); } } |