Subversion Repositories SmartDukaan

Rev

Rev 21923 | Rev 23850 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21923 Rev 23780
Line 1... Line 1...
1
package com.spice.profitmandi.common.model;
1
package com.spice.profitmandi.common.model;
2
 
2
 
3
import java.util.List;
3
import java.util.Set;
4
 
4
 
5
public class UserInfo {
5
public class UserInfo {
6
	private final String email;
6
	private final String email;
7
	private final int userId;
7
	private final int userId;
8
	private final List<String> roleNames;
8
	private final Set<Integer> roleIds;
9
	public UserInfo(int userId, List<String> roleNames, String email){
9
	public UserInfo(int userId, Set<Integer> roleIds, String email){
10
		this.userId = userId;
10
		this.userId = userId;
11
		this.roleNames = roleNames;
11
		this.roleIds = roleIds;
12
		this.email = email;
12
		this.email = email;
13
	}
13
	}
14
	public int getUserId() {
14
	public int getUserId() {
15
		return userId;
15
		return userId;
16
	}
16
	}
17
	public void addRoleName(String roleName){
17
	public void addRoleId(int roleId){
18
		roleNames.add(roleName);
18
		roleIds.add(roleId);
19
	}
19
	}
20
	public List<String> getRoleNames() {
20
	public Set<Integer> getRoleIds() {
21
		return roleNames;
21
		return roleIds;
22
	}
22
	}
23
	public String getEmail() {
23
	public String getEmail() {
24
		return email;
24
		return email;
25
	}
25
	}
26
	
-
 
27
	
-
 
28
	@Override
-
 
29
	public int hashCode() {
-
 
30
		final int prime = 31;
-
 
31
		int result = 1;
-
 
32
		result = prime * result + ((email == null) ? 0 : email.hashCode());
-
 
33
		result = prime * result + ((roleNames == null) ? 0 : roleNames.hashCode());
-
 
34
		result = prime * result + userId;
-
 
35
		return result;
-
 
36
	}
-
 
37
	@Override
-
 
38
	public boolean equals(Object obj) {
-
 
39
		if (this == obj)
-
 
40
			return true;
-
 
41
		if (obj == null)
-
 
42
			return false;
-
 
43
		if (getClass() != obj.getClass())
-
 
44
			return false;
-
 
45
		UserInfo other = (UserInfo) obj;
-
 
46
		if (email == null) {
-
 
47
			if (other.email != null)
-
 
48
				return false;
-
 
49
		} else if (!email.equals(other.email))
-
 
50
			return false;
-
 
51
		if (roleNames == null) {
-
 
52
			if (other.roleNames != null)
-
 
53
				return false;
-
 
54
		} else if (!roleNames.equals(other.roleNames))
-
 
55
			return false;
-
 
56
		if (userId != other.userId)
-
 
57
			return false;
-
 
58
		return true;
-
 
59
	}
-
 
60
	@Override
26
	@Override
61
	public String toString() {
27
	public String toString() {
62
		return "UserInfo [email=" + email + ", userId=" + userId + ", roleNames=" + roleNames + "]";
28
		return "UserInfo [email=" + email + ", userId=" + userId + ", roleIds=" + roleIds + "]";
63
	}
29
	}
64
	
30
	
65
	
-
 
66
	
-
 
67
}
31
}