Merge "Fix sql injection vulnerability"
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / domain / EPUser.java
index e743520..a3c9c48 100644 (file)
@@ -33,7 +33,7 @@
  *
  * ============LICENSE_END============================================
  *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * 
  */
 package org.onap.portalapp.portal.domain;
 
@@ -42,6 +42,8 @@ import java.util.Iterator;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
+import javax.validation.Valid;
+import org.hibernate.validator.constraints.SafeHtml;
 import org.onap.portalapp.portal.utils.PortalConstants;
 import org.onap.portalsdk.core.domain.User;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
@@ -52,44 +54,78 @@ 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;
@@ -97,15 +133,19 @@ public class EPUser extends User {
            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() {}
@@ -491,8 +531,16 @@ public class EPUser extends User {
                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;
        }
@@ -538,9 +586,10 @@ public class EPUser extends User {
                SortedSet<EPRole> roles = new TreeSet<EPRole>();
                SortedSet<EPUserApp> userAppRoles = getEPUserApps();
                
-               logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - userApps = ", userAppRoles.size());
+               logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - userApps = {} ", userAppRoles.size());
 
                Iterator<EPUserApp> userAppRolesIterator = userAppRoles.iterator();
+
                EPUserApp userAppRole = null;
                // getting default app
                while (userAppRolesIterator.hasNext()) {
@@ -561,14 +610,14 @@ public class EPUser extends User {
                                }                               
                        }
                }
-               logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - roles = ", roles.size());
+               logger.debug(EELFLoggerDelegate.debugLogger, "In EPUser.getAppEPRoles() - roles = {}" , roles.size());
 
                return roles;
        }
 
        
        /**
-        * Attention! Not for use in ECOMP
+        * Attention! Not for use in ONAP
         */
        public SortedSet<EPRole> getAppRoles(EPApp app) {
                SortedSet<EPRole> roles = new TreeSet<EPRole>();
@@ -589,7 +638,7 @@ public class EPUser extends User {
        
 
        /**
-        * Attention! Not for use in ECOMP
+        * Attention! Not for use in ONAP
         */
        public SortedSet<EPRole> getEPRoles() {
                EPApp app = new EPApp();
@@ -599,7 +648,7 @@ public class EPUser extends User {
        }
 
        /**
-        * Attention! Not for use in ECOMP
+        * Attention! Not for use in ONAP
         */
        public void setEPRoles(SortedSet<EPRole> roles) {
                EPApp app = new EPApp();
@@ -609,7 +658,7 @@ public class EPUser extends User {
        }
 
        /**
-        * Attention! Not for use in ECOMP
+        * Attention! Not for use in ONAP
         */
        public void removeEPRole(Long roleId) {
                SortedSet<EPUserApp> apps = getEPUserApps();
@@ -624,7 +673,7 @@ public class EPUser extends User {
        }
 
        /**
-        * Attention! Not for use in ECOMP
+        * Attention! Not for use in ONAP
         */
        public void addEPRole(EPRole role) {
                if (role != null) {
@@ -644,6 +693,14 @@ public class EPUser extends User {
        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() {