Subversion Repositories SmartDukaan

Rev

Rev 23850 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.common.model;

import java.util.Set;

public class UserInfo {
        private final String email;
        private final int userId;
        private final int retailerId;
        private final Set<Integer> roleIds;
        private final boolean readOnly = false;
        public UserInfo(int userId, int retailerId, Set<Integer> roleIds, String email){
                this.userId = userId;
                this.retailerId = retailerId;
                this.roleIds = roleIds;
                this.email = email;
        }
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((email == null) ? 0 : email.hashCode());
                result = prime * result + (readOnly ? 1231 : 1237);
                result = prime * result + retailerId;
                result = prime * result + ((roleIds == null) ? 0 : roleIds.hashCode());
                result = prime * result + userId;
                return result;
        }
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                UserInfo other = (UserInfo) obj;
                if (email == null) {
                        if (other.email != null)
                                return false;
                } else if (!email.equals(other.email))
                        return false;
                if (readOnly != other.readOnly)
                        return false;
                if (retailerId != other.retailerId)
                        return false;
                if (roleIds == null) {
                        if (other.roleIds != null)
                                return false;
                } else if (!roleIds.equals(other.roleIds))
                        return false;
                if (userId != other.userId)
                        return false;
                return true;
        }
        public boolean isReadOnly() {
                return readOnly;
        }
        public int getUserId() {
                return userId;
        }
        public int getRetailerId() {
                return retailerId;
        }
        public void addRoleId(int roleId){
                roleIds.add(roleId);
        }
        public Set<Integer> getRoleIds() {
                return roleIds;
        }
        public String getEmail() {
                return email;
        }
        
        @Override
        public String toString() {
                return "UserInfo [email=" + email + ", userId=" + userId + ", retailerId=" + retailerId + ", roleIds=" + roleIds
                                + ", readOnly=" + readOnly + "]";
        }
        
        
}