summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManoop Talasila <talasila@research.att.com>2019-10-23 17:59:37 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-23 17:59:37 +0000
commit7c2e7e2dc9a82dda22929a586c5b10d089163b73 (patch)
treefdec438d2d9a3f2897af1763e2869d75e3c24fa1
parent10d37e31a640a7b4f778d71b3a44e7e9da360aac (diff)
parent8de6460a41a02f73295d76b031c985472d233c5c (diff)
Merge "Fix NPE & other sonar issues"
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java281
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUser.java1432
2 files changed, 906 insertions, 807 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java
index b718d56a..404784fe 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsController.java
@@ -33,7 +33,7 @@
*
* ============LICENSE_END============================================
*
- *
+ *
*/
package org.onap.portalapp.portal.controller;
@@ -71,152 +71,159 @@ import org.springframework.web.bind.annotation.RestController;
@EnableAspectJAutoProxy
@EPAuditLog
public class WidgetsController extends EPRestrictedBaseController {
- private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsController.class);
- private static final DataValidator dataValidator = new DataValidator();
-
- private AdminRolesService adminRolesService;
- private WidgetService widgetService;
- private PersUserWidgetService persUserWidgetService;
-
- @Autowired
- public WidgetsController(AdminRolesService adminRolesService,
- WidgetService widgetService, PersUserWidgetService persUserWidgetService) {
- this.adminRolesService = adminRolesService;
- this.widgetService = widgetService;
- this.persUserWidgetService = persUserWidgetService;
- }
-
- @RequestMapping(value = { "/portalApi/widgets" }, method = RequestMethod.GET, produces = "application/json")
- public List<OnboardingWidget> getOnboardingWidgets(HttpServletRequest request, HttpServletResponse response) {
- EPUser user = EPUserUtils.getUserSession(request);
- List<OnboardingWidget> onboardingWidgets = null;
-
- if (user == null || user.isGuest()) {
- EcompPortalUtils.setBadPermissions(user, response, "getOnboardingWidgets");
- } else {
- String getType = request.getHeader("X-Widgets-Type");
- if (!StringUtils.isEmpty(getType) && ("managed".equals(getType) || "all".equals(getType))) {
- onboardingWidgets = widgetService.getOnboardingWidgets(user, "managed".equals(getType));
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger, "WidgetsController.getOnboardingApps - request must contain header 'X-Widgets-Type' with 'all' or 'managed'");
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- }
- }
-
- EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets", "GET result =", response.getStatus());
- return onboardingWidgets;
- }
-
- private boolean userHasPermissions(EPUser user, HttpServletResponse response, String invocator) {
- if (!adminRolesService.isSuperAdmin(user) && !adminRolesService.isAccountAdmin(user)) {
- EcompPortalUtils.setBadPermissions(user, response, invocator);
- return false;
- }
- return true;
- }
-
- // Attention: real json has all OnboardingWidget fields except "id", we use OnboardingWidget for not to create new class for parsing
- @RequestMapping(value = { "/portalApi/widgets/{widgetId}" }, method = { RequestMethod.PUT }, produces = "application/json")
- public FieldsValidator putOnboardingWidget(HttpServletRequest request, @PathVariable("widgetId") Long widgetId,
- @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) {
- EPUser user = EPUserUtils.getUserSession(request);
- FieldsValidator fieldsValidator = null;
- if (onboardingWidget!=null && !dataValidator.isValid(onboardingWidget)){
- fieldsValidator = new FieldsValidator();
- fieldsValidator.setHttpStatusCode((long)HttpServletResponse.SC_NOT_ACCEPTABLE);
- return fieldsValidator;
- }
-
- if (userHasPermissions(user, response, "putOnboardingWidget")) {
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsController.class);
+ private static final DataValidator dataValidator = new DataValidator();
+
+ private AdminRolesService adminRolesService;
+ private WidgetService widgetService;
+ private PersUserWidgetService persUserWidgetService;
+
+ @Autowired
+ public WidgetsController(AdminRolesService adminRolesService,
+ WidgetService widgetService, PersUserWidgetService persUserWidgetService) {
+ this.adminRolesService = adminRolesService;
+ this.widgetService = widgetService;
+ this.persUserWidgetService = persUserWidgetService;
+ }
+
+ @RequestMapping(value = { "/portalApi/widgets" }, method = RequestMethod.GET, produces = "application/json")
+ public List<OnboardingWidget> getOnboardingWidgets(HttpServletRequest request, HttpServletResponse response) {
+ EPUser user = EPUserUtils.getUserSession(request);
+ List<OnboardingWidget> onboardingWidgets = null;
+
+ if (user == null || user.isGuest()) {
+ EcompPortalUtils.setBadPermissions(user, response, "getOnboardingWidgets");
+ } else {
+ String getType = request.getHeader("X-Widgets-Type");
+ if (!StringUtils.isEmpty(getType) && ("managed".equals(getType) || "all".equals(getType))) {
+ onboardingWidgets = widgetService.getOnboardingWidgets(user, "managed".equals(getType));
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "WidgetsController.getOnboardingApps - request must contain header 'X-Widgets-Type' with 'all' or 'managed'");
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ }
+ }
+
+ EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets", "GET result =", response.getStatus());
+ return onboardingWidgets;
+ }
+
+ private boolean userHasPermissions(EPUser user, HttpServletResponse response, String invocator) {
+ if (!adminRolesService.isSuperAdmin(user) && !adminRolesService.isAccountAdmin(user)) {
+ EcompPortalUtils.setBadPermissions(user, response, invocator);
+ return false;
+ }
+ return true;
+ }
+
+ // Attention: real json has all OnboardingWidget fields except "id", we use OnboardingWidget for not
+ // to create new class for parsing
+ @RequestMapping(value = { "/portalApi/widgets/{widgetId}" }, method = { RequestMethod.PUT },
+ produces = "application/json")
+ public FieldsValidator putOnboardingWidget(HttpServletRequest request, @PathVariable("widgetId") Long widgetId,
+ @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) {
+ EPUser user = EPUserUtils.getUserSession(request);
+ FieldsValidator fieldsValidator = null;
+ if (onboardingWidget != null && !dataValidator.isValid(onboardingWidget)) {
+ fieldsValidator = new FieldsValidator();
+ fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_NOT_ACCEPTABLE);
+ return fieldsValidator;
+ }
+
+ if (userHasPermissions(user, response, "putOnboardingWidget")) {
if (onboardingWidget != null) {
onboardingWidget.id = widgetId; // !
onboardingWidget.normalize();
}
- fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget);
- response.setStatus(fieldsValidator.httpStatusCode.intValue());
- }
- EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets/" + widgetId, "GET result =", response.getStatus());
+ fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget);
+ response.setStatus(fieldsValidator.httpStatusCode.intValue());
+ }
+ EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets/" + widgetId, "GET result =",
+ response.getStatus());
+
+ return fieldsValidator;
+ }
- return fieldsValidator;
- }
+ // Attention: real json has all OnboardingWidget fields except "id", we use OnboardingWidget for not
+ // to create new class for parsing
+ @RequestMapping(value = { "/portalApi/widgets" }, method = { RequestMethod.POST }, produces = "application/json")
+ public FieldsValidator postOnboardingWidget(HttpServletRequest request,
+ @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) {
+ EPUser user = EPUserUtils.getUserSession(request);
+ FieldsValidator fieldsValidator = null;
- // Attention: real json has all OnboardingWidget fields except "id", we use OnboardingWidget for not to create new class for parsing
- @RequestMapping(value = { "/portalApi/widgets" }, method = { RequestMethod.POST }, produces = "application/json")
- public FieldsValidator postOnboardingWidget(HttpServletRequest request, @RequestBody OnboardingWidget onboardingWidget, HttpServletResponse response) {
- EPUser user = EPUserUtils.getUserSession(request);
- FieldsValidator fieldsValidator = null;
+ if (onboardingWidget != null && !dataValidator.isValid(onboardingWidget)) {
+ fieldsValidator = new FieldsValidator();
+ fieldsValidator.setHttpStatusCode((long) HttpServletResponse.SC_NOT_ACCEPTABLE);
+ return fieldsValidator;
+ }
- if (onboardingWidget!=null && !dataValidator.isValid(onboardingWidget)){
- fieldsValidator = new FieldsValidator();
- fieldsValidator.setHttpStatusCode((long)HttpServletResponse.SC_NOT_ACCEPTABLE);
- return fieldsValidator;
- }
+ if (userHasPermissions(user, response, "postOnboardingWidget")) {
- if (userHasPermissions(user, response, "postOnboardingWidget")) {
-
if (onboardingWidget != null) {
onboardingWidget.id = null; // !
onboardingWidget.normalize();
}
- fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget);
- response.setStatus(fieldsValidator.httpStatusCode.intValue());
- }
-
- EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets", "POST result =", response.getStatus());
- return fieldsValidator;
- }
-
- @RequestMapping(value = { "/portalApi/widgets/{widgetId}" }, method = { RequestMethod.DELETE }, produces = "application/json")
- public FieldsValidator deleteOnboardingWidget(HttpServletRequest request, @PathVariable("widgetId") Long widgetId, HttpServletResponse response) {
- EPUser user = EPUserUtils.getUserSession(request);
- FieldsValidator fieldsValidator = null;
-
- if (userHasPermissions(user, response, "deleteOnboardingWidget")) {
- fieldsValidator = widgetService.deleteOnboardingWidget(user, widgetId);
- response.setStatus(fieldsValidator.httpStatusCode.intValue());
- }
-
- EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets/" + widgetId, "DELETE result =", response.getStatus());
- return fieldsValidator;
- }
-
- /**
- * service to accept a user's action made on the application
- * catalog.
- *
- * @param request
- * @param selectRequest
- * JSON with data including application ID
- * @param response
- * @return FieldsValidator
- * @throws IOException
- */
- @RequestMapping(value = { "portalApi/widgetCatalogSelection" }, method = RequestMethod.PUT, produces = "application/json")
- public FieldsValidator putWidgetCatalogSelection(HttpServletRequest request,
- @RequestBody WidgetCatalogPersonalization persRequest, HttpServletResponse response) throws IOException {
- FieldsValidator result = new FieldsValidator();
- EPUser user = EPUserUtils.getUserSession(request);
-
- if (persRequest!=null){
- if(!dataValidator.isValid(persRequest)){
- result.httpStatusCode = (long)HttpServletResponse.SC_NOT_ACCEPTABLE;
- return result;
- }
- }
-
-
- try {
- if (persRequest.getWidgetId() == null || user == null) {
- EcompPortalUtils.setBadPermissions(user, response, "putWidgetCatalogSelection");
- } else {
- persUserWidgetService.setPersUserAppValue(user, persRequest.getWidgetId(), persRequest.getSelect());
- }
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Failed in putAppCatalogSelection", e);
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
- }
- result.httpStatusCode = (long) HttpServletResponse.SC_OK;
- return result;
- }
-} \ No newline at end of file
+ fieldsValidator = widgetService.setOnboardingWidget(user, onboardingWidget);
+ response.setStatus(fieldsValidator.httpStatusCode.intValue());
+ }
+
+ EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets", "POST result =", response.getStatus());
+ return fieldsValidator;
+ }
+
+ @RequestMapping(value = { "/portalApi/widgets/{widgetId}" }, method = { RequestMethod.DELETE },
+ produces = "application/json")
+ public FieldsValidator deleteOnboardingWidget(HttpServletRequest request, @PathVariable("widgetId") Long widgetId,
+ HttpServletResponse response) {
+ EPUser user = EPUserUtils.getUserSession(request);
+ FieldsValidator fieldsValidator = null;
+
+ if (userHasPermissions(user, response, "deleteOnboardingWidget")) {
+ fieldsValidator = widgetService.deleteOnboardingWidget(user, widgetId);
+ response.setStatus(fieldsValidator.httpStatusCode.intValue());
+ }
+
+ EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/widgets/" + widgetId, "DELETE result =",
+ response.getStatus());
+ return fieldsValidator;
+ }
+
+ /**
+ * service to accept a user's action made on the application catalog.
+ *
+ * @param request
+ * @param selectRequest JSON with data including application ID
+ * @param response
+ * @return FieldsValidator
+ * @throws IOException
+ */
+ @RequestMapping(value = { "portalApi/widgetCatalogSelection" }, method = RequestMethod.PUT,
+ produces = "application/json")
+ public FieldsValidator putWidgetCatalogSelection(HttpServletRequest request,
+ @RequestBody WidgetCatalogPersonalization persRequest, HttpServletResponse response) throws IOException {
+ FieldsValidator result = new FieldsValidator();
+ EPUser user = EPUserUtils.getUserSession(request);
+
+ if (persRequest != null) {
+ if (!dataValidator.isValid(persRequest)) {
+ result.httpStatusCode = (long) HttpServletResponse.SC_NOT_ACCEPTABLE;
+ return result;
+ }
+ }
+
+ try {
+ if (persRequest == null || persRequest.getWidgetId() == null || user == null) {
+ EcompPortalUtils.setBadPermissions(user, response, "putWidgetCatalogSelection");
+ } else {
+ persUserWidgetService.setPersUserAppValue(user, persRequest.getWidgetId(), persRequest.getSelect());
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed in putAppCatalogSelection", e);
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
+ }
+ result.httpStatusCode = (long) HttpServletResponse.SC_OK;
+ return result;
+ }
+}
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUser.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUser.java
index a3c9c481..62bd65e2 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUser.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/EPUser.java
@@ -33,7 +33,7 @@
*
* ============LICENSE_END============================================
*
- *
+ *
*/
package org.onap.portalapp.portal.domain;
@@ -51,675 +51,767 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class EPUser extends User {
-
- private Long orgId;
- private Long managerId;
- @SafeHtml
- private String firstName;
- @SafeHtml
- private String middleInitial;
- @SafeHtml
- private String lastName;
- @SafeHtml
- private String phone;
- @SafeHtml
- private String fax;
- @SafeHtml
- private String cellular;
- @SafeHtml
- private String email;
- private Long addressId;
- @SafeHtml
- private String alertMethodCd;
- @SafeHtml
- private String hrid;
- @SafeHtml
- private String orgUserId;
- @SafeHtml
- private String orgCode;
- @SafeHtml
- private String address1;
- @SafeHtml
- private String address2;
- @SafeHtml
- private String city;
- @SafeHtml
- private String state;
- @SafeHtml
- private String zipCode;
- @SafeHtml
- private String country;
- @SafeHtml
- private String orgManagerUserId;
- @SafeHtml
- private String locationClli;
- @SafeHtml
- private String businessCountryCode;
- @SafeHtml
- private String businessCountryName;
- @SafeHtml
- private String businessUnit;
- @SafeHtml
- private String businessUnitName;
- @SafeHtml
- private String department;
- @SafeHtml
- private String departmentName;
- @SafeHtml
- private String companyCode;
- @SafeHtml
- private String company;
- @SafeHtml
- private String zipCodeSuffix;
- @SafeHtml
- private String jobTitle;
- @SafeHtml
- private String commandChain;
- @SafeHtml
- private String siloStatus;
- @SafeHtml
- private String costCenter;
- @SafeHtml
- private String financialLocCode;
-
-
- @SafeHtml
- private String loginId;
- @SafeHtml
- private String loginPwd;
- private Date lastLoginDate;
- private boolean active;
- private boolean internal;
- private Long selectedProfileId;
- private Long timeZoneId;
- private boolean online;
- @SafeHtml
- private String chatId;
- private boolean systemUser;
- private Integer languageId;
- private static final long serialVersionUID = 1L;
-
-
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPUser.class);
- private static final String ECOMP_PORTAL_NAME = "ECOMP";
- private boolean isGuest = false;
- @Valid
- private SortedSet<EPUserApp> userApps = new TreeSet<EPUserApp>();
- @Valid
- private SortedSet<EPRole> pseudoRoles = new TreeSet<EPRole>();
-
- public EPUser() {}
-
- 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;
- }
-
- @JsonIgnore
- 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;
- }
-
- 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 getOrgManagerUserId() {
- return orgManagerUserId;
- }
-
- public String getZipCodeSuffix() {
- return zipCodeSuffix;
- }
-
- public String getBusinessCountryName() {
- return businessCountryName;
- }
-
- public Long getSelectedProfileId() {
- return selectedProfileId;
- }
-
- public void setAddressId(Long addressId) {
- this.addressId = addressId;
- }
-
- public void setAlertMethodCd(String alertMethodCd) {
- this.alertMethodCd = alertMethodCd;
- }
-
- public void setCellular(String cellular) {
- this.cellular = cellular;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public void setFax(String fax) {
- this.fax = fax;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public void setHrid(String hrid) {
- this.hrid = hrid;
- }
-
- public void setLastLoginDate(Date lastLoginDate) {
- this.lastLoginDate = lastLoginDate;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public void setLoginId(String loginId) {
- this.loginId = loginId;
- }
-
- public void setLoginPwd(String loginPwd) {
- this.loginPwd = loginPwd;
- }
- public void setManagerId(Long managerId) {
- this.managerId = managerId;
- }
+ private Long orgId;
+ private Long managerId;
+ @SafeHtml
+ private String firstName;
+ @SafeHtml
+ private String middleInitial;
+ @SafeHtml
+ private String lastName;
+ @SafeHtml
+ private String phone;
+ @SafeHtml
+ private String fax;
+ @SafeHtml
+ private String cellular;
+ @SafeHtml
+ private String email;
+ private Long addressId;
+ @SafeHtml
+ private String alertMethodCd;
+ @SafeHtml
+ private String hrid;
+ @SafeHtml
+ private String orgUserId;
+ @SafeHtml
+ private String orgCode;
+ @SafeHtml
+ private String address1;
+ @SafeHtml
+ private String address2;
+ @SafeHtml
+ private String city;
+ @SafeHtml
+ private String state;
+ @SafeHtml
+ private String zipCode;
+ @SafeHtml
+ private String country;
+ @SafeHtml
+ private String orgManagerUserId;
+ @SafeHtml
+ private String locationClli;
+ @SafeHtml
+ private String businessCountryCode;
+ @SafeHtml
+ private String businessCountryName;
+ @SafeHtml
+ private String businessUnit;
+ @SafeHtml
+ private String businessUnitName;
+ @SafeHtml
+ private String department;
+ @SafeHtml
+ private String departmentName;
+ @SafeHtml
+ private String companyCode;
+ @SafeHtml
+ private String company;
+ @SafeHtml
+ private String zipCodeSuffix;
+ @SafeHtml
+ private String jobTitle;
+ @SafeHtml
+ private String commandChain;
+ @SafeHtml
+ private String siloStatus;
+ @SafeHtml
+ private String costCenter;
+ @SafeHtml
+ private String financialLocCode;
+
+ @SafeHtml
+ private String loginId;
+ @SafeHtml
+ private String loginPwd;
+ private Date lastLoginDate;
+ private boolean active;
+ private boolean internal;
+ private Long selectedProfileId;
+ private Long timeZoneId;
+ private boolean online;
+ @SafeHtml
+ private String chatId;
+ private boolean systemUser;
+ private Integer languageId;
+ private static final long serialVersionUID = 1L;
+
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPUser.class);
+ private static final String ECOMP_PORTAL_NAME = "ECOMP";
+ private boolean isGuest = false;
+ @Valid
+ private SortedSet<EPUserApp> userApps = new TreeSet<>();
+ @Valid
+ private SortedSet<EPRole> pseudoRoles = new TreeSet<>();
+
+ public EPUser() {}
+
+ @Override
+ public Long getAddressId() {
+ return addressId;
+ }
+
+ @Override
+ public String getAlertMethodCd() {
+ return alertMethodCd;
+ }
+
+ @Override
+ public String getCellular() {
+ return cellular;
+ }
+
+ @Override
+ public String getEmail() {
+ return email;
+ }
+
+ @Override
+ public String getFax() {
+ return fax;
+ }
+
+ @Override
+ public String getFirstName() {
+ return firstName;
+ }
+
+ @Override
+ public String getHrid() {
+ return hrid;
+ }
+
+ @Override
+ public Date getLastLoginDate() {
+ return lastLoginDate;
+ }
+
+ @Override
+ public String getLastName() {
+ return lastName;
+ }
+
+ @JsonIgnore
+ @Override
+ public String getFullName() {
+ return getFirstName() + " " + getLastName();
+ }
+
+ @Override
+ public String getLoginId() {
+ return loginId;
+ }
+
+ @Override
+ public String getLoginPwd() {
+ return loginPwd;
+ }
+
+ @Override
+ public Long getManagerId() {
+ return managerId;
+ }
+
+ @Override
+ public String getMiddleInitial() {
+ return middleInitial;
+ }
+
+ @Override
+ public String getOrgCode() {
+ return orgCode;
+ }
+
+ @Override
+ public Long getOrgId() {
+ return orgId;
+ }
+
+ @Override
+ public String getPhone() {
+ return phone;
+ }
+
+ @Override
+ public String getOrgUserId() {
+ return orgUserId;
+ }
+
+ @Override
+ public boolean getActive() {
+ return active;
+ }
+
+ @Override
+ public boolean getInternal() {
+ return internal;
+ }
+
+ @Override
+ public String getAddress1() {
+ return address1;
+ }
+
+ @Override
+ public String getAddress2() {
+ return address2;
+ }
+
+ @Override
+ public String getCity() {
+ return city;
+ }
+
+ @Override
+ public String getCountry() {
+ return country;
+ }
+
+ @Override
+ public String getState() {
+ return state;
+ }
+
+ @Override
+ public String getZipCode() {
+ return zipCode;
+ }
+
+ @Override
+ public String getBusinessCountryCode() {
+ return businessCountryCode;
+ }
+
+ @Override
+ public String getCommandChain() {
+ return commandChain;
+ }
+
+ @Override
+ public String getCompany() {
+ return company;
+ }
+
+ @Override
+ public String getCompanyCode() {
+ return companyCode;
+ }
+
+ @Override
+ public String getDepartment() {
+ return department;
+ }
+
+ @Override
+ public String getJobTitle() {
+ return jobTitle;
+ }
+
+ @Override
+ public String getLocationClli() {
+ return locationClli;
+ }
+
+ @Override
+ public String getOrgManagerUserId() {
+ return orgManagerUserId;
+ }
+
+ @Override
+ public String getZipCodeSuffix() {
+ return zipCodeSuffix;
+ }
+
+ @Override
+ public String getBusinessCountryName() {
+ return businessCountryName;
+ }
+
+ @Override
+ public Long getSelectedProfileId() {
+ return selectedProfileId;
+ }
+
+ @Override
+ public void setAddressId(Long addressId) {
+ this.addressId = addressId;
+ }
+
+ @Override
+ public void setAlertMethodCd(String alertMethodCd) {
+ this.alertMethodCd = alertMethodCd;
+ }
+
+ @Override
+ public void setCellular(String cellular) {
+ this.cellular = cellular;
+ }
+
+ @Override
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ @Override
+ public void setFax(String fax) {
+ this.fax = fax;
+ }
+
+ @Override
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ @Override
+ public void setHrid(String hrid) {
+ this.hrid = hrid;
+ }
+
+ @Override
+ public void setLastLoginDate(Date lastLoginDate) {
+ this.lastLoginDate = lastLoginDate;
+ }
+
+ @Override
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ @Override
+ public void setLoginId(String loginId) {
+ this.loginId = loginId;
+ }
+
+ @Override
+ public void setLoginPwd(String loginPwd) {
+ this.loginPwd = loginPwd;
+ }
+
+ @Override
+ public void setManagerId(Long managerId) {
+ this.managerId = managerId;
+ }
+
+ @Override
+ public void setMiddleInitial(String middleInitial) {
+ this.middleInitial = middleInitial;
+ }
+
+ @Override
+ public void setOrgCode(String orgCode) {
+ this.orgCode = orgCode;
+ }
+
+ @Override
+ public void setOrgId(Long orgId) {
+ this.orgId = orgId;
+ }
+
+ @Override
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ @Override
+ public void setOrgUserId(String orgUserId) {
+ this.orgUserId = orgUserId;
+ }
+
+ @Override
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ @Override
+ public void setInternal(boolean internal) {
+ this.internal = internal;
+ }
+
+ @Override
+ public void setAddress1(String address1) {
+ this.address1 = address1;
+ }
+
+ @Override
+ public void setAddress2(String address2) {
+ this.address2 = address2;
+ }
+
+ @Override
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ @Override
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ @Override
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ @Override
+ public void setZipCode(String zipCode) {
+ this.zipCode = zipCode;
+ }
+
+ @Override
+ public void setBusinessCountryCode(String businessCountryCode) {
+ this.businessCountryCode = businessCountryCode;
+ }
+
+ @Override
+ public void setCommandChain(String commandChain) {
+ this.commandChain = commandChain;
+ }
+
+ @Override
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ @Override
+ public void setCompanyCode(String companyCode) {
+ this.companyCode = companyCode;
+ }
+
+ @Override
+ public void setDepartment(String department) {
+ this.department = department;
+ }
+
+ @Override
+ public void setJobTitle(String jobTitle) {
+ this.jobTitle = jobTitle;
+ }
+
+ @Override
+ public void setLocationClli(String locationClli) {
+ this.locationClli = locationClli;
+ }
+
+ @Override
+ public void setOrgManagerUserId(String orgManagerUserId) {
+ this.orgManagerUserId = orgManagerUserId;
+ }
+
+ @Override
+ public void setZipCodeSuffix(String zipCodeSuffix) {
+ this.zipCodeSuffix = zipCodeSuffix;
+ }
+
+ @Override
+ public void setBusinessCountryName(String businessCountryName) {
+ this.businessCountryName = businessCountryName;
+ }
+
+ @Override
+ public SortedSet<EPRole> getPseudoRoles() {
+ return pseudoRoles;
+ }
+
+ public void setPseudoRoles(SortedSet<EPRole> pseudoRoles) {
+ this.pseudoRoles = pseudoRoles;
+ }
+
+ @Override
+ public void setSelectedProfileId(Long selectedProfileId) {
+ this.selectedProfileId = selectedProfileId;
+ }
+
+ @Override
+ public Long getTimeZoneId() {
+ return timeZoneId;
+ }
+
+ @Override
+ public void setTimeZoneId(Long timeZoneId) {
+ this.timeZoneId = timeZoneId;
+ }
+
+ @Override
+ public String getBusinessUnit() {
+ return businessUnit;
+ }
+
+ @Override
+ public void setBusinessUnit(String businessUnit) {
+ this.businessUnit = businessUnit;
+ }
+
+ @Override
+ public String getSiloStatus() {
+ return siloStatus;
+ }
+
+ @Override
+ public void setSiloStatus(String siloStatus) {
+ this.siloStatus = siloStatus;
+ }
+
+ @Override
+ public String getCostCenter() {
+ return costCenter;
+ }
+
+ @Override
+ public void setCostCenter(String costCenter) {
+ this.costCenter = costCenter;
+ }
+
+ @Override
+ public String getFinancialLocCode() {
+ return financialLocCode;
+ }
+
+ @Override
+ public void setFinancialLocCode(String financialLocCode) {
+ this.financialLocCode = financialLocCode;
+ }
+
+ @Override
+ public String getBusinessUnitName() {
+ return businessUnitName;
+ }
+
+ @Override
+ public void setBusinessUnitName(String businessUnitName) {
+ this.businessUnitName = businessUnitName;
+ }
+
+ @Override
+ public String getDepartmentName() {
+ return departmentName;
+ }
+
+ @Override
+ public void setDepartmentName(String departmentName) {
+ this.departmentName = departmentName;
+ }
+
+ @Override
+ public int compareTo(Object obj) {
+ EPUser user = (EPUser) obj;
+
+ String c1 = getLastName() + getFirstName() + getMiddleInitial();
+ String c2 = user.getLastName() + user.getFirstName() + user.getMiddleInitial();
+
+ return c1.compareTo(c2);
+ }
+
+ @Override
+ public boolean isOnline() {
+ return online;
+ }
+
+ @Override
+ public void setOnline(boolean online) {
+ this.online = online;
+ }
+
+ @Override
+ public String getChatId() {
+ return chatId;
+ }
+
+ @Override
+ public void setChatId(String chatId) {
+ this.chatId = chatId;
+ }
+
+ public Integer getLanguageId() {
+ return languageId;
+ }
+
+ public void setLanguageId(Integer languageId) {
+ this.languageId = languageId;
+ }
+
+ public void setPseudoEPRoles(SortedSet<EPRole> pseudoRoles) {
+ this.pseudoRoles = pseudoRoles;
+ }
+
+ public SortedSet<EPUserApp> getEPUserApps() {
+ return userApps;
+ }
+
+ public void setEPUserApps(SortedSet<EPUserApp> userApps) {
+ this.userApps = userApps;
+ }
+
+ public void addUserApp(EPUserApp userApp) {
+ userApps.add(userApp);
+ }
+
+ public void addAppRoles(EPApp app, SortedSet<EPRole> roles) {
+ if (roles != null) {
+ // add all
+ SortedSet<EPUserApp> userApplications = new TreeSet<>();
+ // this.userApps.removeAll(this.userApps);
+ Iterator<EPRole> itr = roles.iterator();
+ while (itr.hasNext()) {
+ EPRole role = itr.next();
+ EPUserApp userApp = new EPUserApp();
+ userApp.setUserId(this.id);
+ userApp.setApp(app);
+ userApp.setRole(role);
+ userApplications.add(userApp);
+ }
+ setEPUserApps(userApplications);
+ } else {
+ // remove all
+ setEPUserApps(null);
+ }
+
+ }
+
+ public SortedSet<EPRole> getAppEPRoles(EPApp app) {
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - app = {}", app.getName());
+
+ SortedSet<EPRole> roles = new TreeSet<>();
+ SortedSet<EPUserApp> userAppRoles = getEPUserApps();
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - userApps = {} ", userAppRoles.size());
+
+ Iterator<EPUserApp> userAppRolesIterator = userAppRoles.iterator();
+
+ EPUserApp userAppRole = null;
+ // getting default app
+ while (userAppRolesIterator.hasNext()) {
+ EPUserApp tempUserApp = userAppRolesIterator.next();
+ if (tempUserApp.getApp().getId().equals(app.getId())) {
+
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "In EPUser.getAppEPRoles() - for user {}, found application {}", this.getFullName(),
+ app.getName());
+
+ userAppRole = tempUserApp;
+
+ EPRole role = userAppRole.getRole();
+ if (role.getActive()) {
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "In EPUser.getAppEPRoles() - Role {} is active - adding for user {} and app {}",
+ role.getName(), this.getFullName(), app.getName());
+ roles.add((EPRole) role);
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "In EPUser.getAppEPRoles() - Role {} is NOT active - NOT adding for user {} and app {}",
+ role.getName(), this.getFullName(), app.getName());
+ }
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - roles = {}", roles.size());
+
+ return roles;
+ }
+
+ /**
+ * Attention! Not for use in ONAP
+ */
+ public SortedSet<EPRole> getAppRoles(EPApp app) {
+ SortedSet<EPRole> roles = new TreeSet<>();
+ SortedSet<EPUserApp> apps = getEPUserApps();
+ Iterator<EPUserApp> appsItr = apps.iterator();
+ EPUserApp userApp = null;
+ // getting default app
+ while (appsItr.hasNext()) {
+ EPUserApp tempUserApp = appsItr.next();
+ if (tempUserApp.getApp().getId().equals(app.getId())) {
+ userApp = tempUserApp;
+ roles.add((EPRole) userApp.getRole());
+ }
+ }
+ return roles;
+ }
+
+ /**
+ * Attention! Not for use in ONAP
+ */
+ public SortedSet<EPRole> getEPRoles() {
+ EPApp app = new EPApp();
+ app.setId(PortalConstants.PORTAL_APP_ID);
+ app.setName(ECOMP_PORTAL_NAME);
+ return getAppEPRoles(app);
+ }
+
+ /**
+ * Attention! Not for use in ONAP
+ */
+ public void setEPRoles(SortedSet<EPRole> roles) {
+ EPApp app = new EPApp();
+ app.setId(PortalConstants.PORTAL_APP_ID);
+ app.setName(ECOMP_PORTAL_NAME);
+ addAppRoles(app, roles);
+ }
+
+ /**
+ * Attention! Not for use in ONAP
+ */
+ public void removeEPRole(Long roleId) {
+ SortedSet<EPUserApp> apps = getEPUserApps();
+ Iterator<EPUserApp> appsItr = apps.iterator();
+ // getting default app
+ while (appsItr.hasNext()) {
+ EPUserApp tempUserApp = appsItr.next();
+ if (tempUserApp.getAppId().equals(PortalConstants.PORTAL_APP_ID)
+ && tempUserApp.getRole().getId().equals(roleId)) {
+ appsItr.remove();
+ }
+ }
+ }
+
+ /**
+ * Attention! Not for use in ONAP
+ */
+ public void addEPRole(EPRole role) {
+ if (role != null) {
+ SortedSet<EPRole> roles = getEPRoles();
+ if (roles == null) {
+ roles = new TreeSet<>();
+ }
+ roles.add(role);
+ setEPRoles(roles);
+ }
+ }
+
+ public boolean isGuest() {
+ return isGuest;
+ }
+
+ public void setGuest(boolean isGuest) {
+ this.isGuest = isGuest;
+ }
+
+ public boolean isSystemUser() {
+ return systemUser;
+ }
+
+ public void setSystemUser(boolean systemUser) {
+ this.systemUser = systemUser;
+ }
+
+ @Override
+ public String toString() {
+ return "EPUser [orgId=" + orgId + ", managerId=" + managerId + ", firstName=" + firstName + ", middleInitial="
+ + middleInitial + ", lastName=" + lastName + ", phone=" + phone + ", fax=" + fax + ", cellular="
+ + cellular + ", email=" + email + ", addressId=" + addressId + ", alertMethodCd=" + alertMethodCd
+ + ", hrid=" + hrid + ", orgUserId=" + orgUserId + ", orgCode=" + orgCode + ", address1=" + address1
+ + ", address2=" + address2 + ", city=" + city + ", state=" + state + ", zipCode=" + zipCode
+ + ", country=" + country + ", orgManagerUserId=" + orgManagerUserId + ", locationClli=" + locationClli
+ + ", businessCountryCode=" + businessCountryCode + ", businessCountryName=" + businessCountryName
+ + ", businessUnit=" + businessUnit + ", businessUnitName=" + businessUnitName + ", department="
+ + department + ", departmentName=" + departmentName + ", companyCode=" + companyCode + ", company="
+ + company + ", zipCodeSuffix=" + zipCodeSuffix + ", jobTitle=" + jobTitle + ", commandChain="
+ + commandChain + ", siloStatus=" + siloStatus + ", costCenter=" + costCenter + ", financialLocCode="
+ + financialLocCode + ", loginId=" + loginId + ", loginPwd=" + loginPwd + ", lastLoginDate="
+ + lastLoginDate + ", active=" + active + ", internal=" + internal + ", selectedProfileId="
+ + selectedProfileId + ", timeZoneId=" + timeZoneId + ", online=" + online + ", chatId=" + chatId
+ + ", isGuest=" + isGuest + ", userApps=" + userApps + ", pseudoRoles=" + pseudoRoles + "]";
+ }
- public void setMiddleInitial(String middleInitial) {
- this.middleInitial = middleInitial;
- }
-
- public void setOrgCode(String orgCode) {
- this.orgCode = orgCode;
- }
-
- public void setOrgId(Long orgId) {
- this.orgId = orgId;
- }
-
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
- public void setOrgUserId(String orgUserId) {
- this.orgUserId = orgUserId;
- }
-
- public void setActive(boolean active) {
- this.active = active;
- }
-
- public void setInternal(boolean internal) {
- this.internal = internal;
- }
-
- public void setAddress1(String address1) {
- this.address1 = address1;
- }
-
- public void setAddress2(String address2) {
- this.address2 = address2;
- }
-
- public void setCity(String city) {
- this.city = city;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public void setZipCode(String zipCode) {
- this.zipCode = zipCode;
- }
-
- public void setBusinessCountryCode(String businessCountryCode) {
- this.businessCountryCode = businessCountryCode;
- }
-
- public void setCommandChain(String commandChain) {
- this.commandChain = commandChain;
- }
-
- public void setCompany(String company) {
- this.company = company;
- }
-
- public void setCompanyCode(String companyCode) {
- this.companyCode = companyCode;
- }
-
- public void setDepartment(String department) {
- this.department = department;
- }
-
- public void setJobTitle(String jobTitle) {
- this.jobTitle = jobTitle;
- }
-
- public void setLocationClli(String locationClli) {
- this.locationClli = locationClli;
- }
-
- public void setOrgManagerUserId(String orgManagerUserId) {
- this.orgManagerUserId = orgManagerUserId;
- }
-
- public void setZipCodeSuffix(String zipCodeSuffix) {
- this.zipCodeSuffix = zipCodeSuffix;
- }
-
- public void setBusinessCountryName(String businessCountryName) {
- this.businessCountryName = businessCountryName;
- }
-
- public SortedSet<EPRole> getPseudoRoles() {
- return pseudoRoles;
- }
-
- public void setPseudoRoles(SortedSet<EPRole> pseudoRoles) {
- this.pseudoRoles = pseudoRoles;
- }
-
- public void setSelectedProfileId(Long selectedProfileId) {
- this.selectedProfileId = selectedProfileId;
- }
-
- public Long getTimeZoneId() {
- return timeZoneId;
- }
-
- public void setTimeZoneId(Long timeZoneId) {
- this.timeZoneId = timeZoneId;
- }
-
- public String getBusinessUnit() {
- return businessUnit;
- }
-
- public void setBusinessUnit(String businessUnit) {
- this.businessUnit = businessUnit;
- }
-
- public String getSiloStatus() {
- return siloStatus;
- }
-
- public void setSiloStatus(String siloStatus) {
- this.siloStatus = siloStatus;
- }
-
- public String getCostCenter() {
- return costCenter;
- }
-
- public void setCostCenter(String costCenter) {
- this.costCenter = costCenter;
- }
-
- public String getFinancialLocCode() {
- return financialLocCode;
- }
-
- public void setFinancialLocCode(String financialLocCode) {
- this.financialLocCode = financialLocCode;
- }
-
- public String getBusinessUnitName() {
- return businessUnitName;
- }
-
- public void setBusinessUnitName(String businessUnitName) {
- this.businessUnitName = businessUnitName;
- }
-
- public String getDepartmentName() {
- return departmentName;
- }
-
- public void setDepartmentName(String departmentName) {
- this.departmentName = departmentName;
- }
-
- public int compareTo(Object obj){
- EPUser user = (EPUser)obj;
-
- String c1 = getLastName() + getFirstName() + getMiddleInitial();
- String c2 = user.getLastName() + user.getFirstName() + user.getMiddleInitial();
-
- return c1.compareTo(c2);
- }
-
- public boolean isOnline() {
- return online;
- }
-
- public void setOnline(boolean online) {
- this.online = online;
- }
-
- public String getChatId() {
- return chatId;
- }
-
- public void setChatId(String chatId) {
- this.chatId = chatId;
- }
-
-
- public Integer getLanguageId() {
- return languageId;
- }
-
- public void setLanguageId(Integer languageId) {
- this.languageId = languageId;
- }
-
- public void setPseudoEPRoles(SortedSet<EPRole> pseudoRoles) {
- this.pseudoRoles = pseudoRoles;
- }
-
- public SortedSet<EPUserApp> getEPUserApps() {
- return userApps;
- }
-
- public void setEPUserApps(SortedSet<EPUserApp> userApps) {
- this.userApps = userApps;
- }
-
- public void addUserApp(EPUserApp userApp) {
- userApps.add(userApp);
- }
-
- public void addAppRoles(EPApp app, SortedSet<EPRole> roles) {
- if (roles != null) {
- // add all
- SortedSet<EPUserApp> userApps = new TreeSet<EPUserApp>();
- // this.userApps.removeAll(this.userApps);
- Iterator<EPRole> itr = roles.iterator();
- while (itr.hasNext()) {
- EPRole role = (EPRole) itr.next();
- EPUserApp userApp = new EPUserApp();
- userApp.setUserId(this.id);
- userApp.setApp(app);
- userApp.setRole(role);
- userApps.add(userApp);
- }
- setEPUserApps(userApps);
- } else {
- // remove all
- setEPUserApps(null);
- }
-
- }
-
- public SortedSet<EPRole> getAppEPRoles(EPApp app) {
-
- logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - app = {}", app.getName());
-
- SortedSet<EPRole> roles = new TreeSet<EPRole>();
- SortedSet<EPUserApp> userAppRoles = getEPUserApps();
-
- logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - userApps = {} ", userAppRoles.size());
-
- Iterator<EPUserApp> userAppRolesIterator = userAppRoles.iterator();
-
- EPUserApp userAppRole = null;
- // getting default app
- while (userAppRolesIterator.hasNext()) {
- EPUserApp tempUserApp = (EPUserApp) userAppRolesIterator.next();
- if (tempUserApp.getApp().getId().equals(app.getId())) {
-
- logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - for user {}, found application {}", this.getFullName(), app.getName());
-
- userAppRole = tempUserApp;
-
- EPRole role = userAppRole.getRole();
- if(role.getActive()){
- logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - Role {} is active - adding for user {} and app {}", role.getName(), this.getFullName(), app.getName());
- roles.add((EPRole) role);
- }
- else{
- logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - Role {} is NOT active - NOT adding for user {} and app {}", role.getName(), this.getFullName(), app.getName());
- }
- }
- }
- logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - roles = {}" , roles.size());
-
- return roles;
- }
-
-
- /**
- * Attention! Not for use in ONAP
- */
- public SortedSet<EPRole> getAppRoles(EPApp app) {
- SortedSet<EPRole> roles = new TreeSet<EPRole>();
- SortedSet<EPUserApp> apps = getEPUserApps();
- Iterator<EPUserApp> appsItr = apps.iterator();
- EPUserApp userApp = null;
- // getting default app
- while (appsItr.hasNext()) {
- EPUserApp tempUserApp = (EPUserApp) appsItr.next();
- if (tempUserApp.getApp().getId().equals(app.getId())) {
- userApp = tempUserApp;
- roles.add((EPRole) userApp.getRole());
- }
- }
- return roles;
- }
-
-
-
- /**
- * Attention! Not for use in ONAP
- */
- public SortedSet<EPRole> getEPRoles() {
- EPApp app = new EPApp();
- app.setId(new Long(PortalConstants.PORTAL_APP_ID));
- app.setName(ECOMP_PORTAL_NAME);
- return getAppEPRoles(app);
- }
-
- /**
- * Attention! Not for use in ONAP
- */
- public void setEPRoles(SortedSet<EPRole> roles) {
- EPApp app = new EPApp();
- app.setId(new Long(PortalConstants.PORTAL_APP_ID));
- app.setName(ECOMP_PORTAL_NAME);
- addAppRoles(app, roles);
- }
-
- /**
- * Attention! Not for use in ONAP
- */
- public void removeEPRole(Long roleId) {
- SortedSet<EPUserApp> apps = getEPUserApps();
- Iterator<EPUserApp> appsItr = apps.iterator();
- // getting default app
- while (appsItr.hasNext()) {
- EPUserApp tempUserApp = (EPUserApp) appsItr.next();
- if (tempUserApp.equals(new Long(PortalConstants.PORTAL_APP_ID)) && tempUserApp.getRole().getId().equals(roleId)) {
- appsItr.remove();
- }
- }
- }
-
- /**
- * Attention! Not for use in ONAP
- */
- public void addEPRole(EPRole role) {
- if (role != null) {
- SortedSet<EPRole> roles = getEPRoles();
- if (roles == null) {
- roles = new TreeSet<EPRole>();
- }
- roles.add(role);
- setEPRoles(roles);
- }
- }
-
- public boolean isGuest() {
- return isGuest;
- }
-
- public void setGuest(boolean isGuest) {
- this.isGuest = isGuest;
- }
-
- public boolean isSystemUser() {
- return systemUser;
- }
-
- public void setSystemUser(boolean systemUser) {
- this.systemUser = systemUser;
- }
-
- @Override
- public String toString() {
- return "EPUser [orgId=" + orgId + ", managerId=" + managerId + ", firstName=" + firstName + ", middleInitial="
- + middleInitial + ", lastName=" + lastName + ", phone=" + phone + ", fax=" + fax + ", cellular="
- + cellular + ", email=" + email + ", addressId=" + addressId + ", alertMethodCd=" + alertMethodCd
- + ", hrid=" + hrid + ", orgUserId=" + orgUserId + ", orgCode=" + orgCode + ", address1=" + address1
- + ", address2=" + address2 + ", city=" + city + ", state=" + state + ", zipCode=" + zipCode
- + ", country=" + country + ", orgManagerUserId=" + orgManagerUserId + ", locationClli=" + locationClli
- + ", businessCountryCode=" + businessCountryCode + ", businessCountryName=" + businessCountryName
- + ", businessUnit=" + businessUnit + ", businessUnitName=" + businessUnitName + ", department="
- + department + ", departmentName=" + departmentName + ", companyCode=" + companyCode + ", company="
- + company + ", zipCodeSuffix=" + zipCodeSuffix + ", jobTitle=" + jobTitle + ", commandChain="
- + commandChain + ", siloStatus=" + siloStatus + ", costCenter=" + costCenter + ", financialLocCode="
- + financialLocCode + ", loginId=" + loginId + ", loginPwd=" + loginPwd + ", lastLoginDate="
- + lastLoginDate + ", active=" + active + ", internal=" + internal + ", selectedProfileId="
- + selectedProfileId + ", timeZoneId=" + timeZoneId + ", online=" + online + ", chatId=" + chatId
- + ", isGuest=" + isGuest + ", userApps=" + userApps + ", pseudoRoles=" + pseudoRoles + "]";
- }
-
-
}