Subversion Repositories SmartDukaan

Rev

Rev 23850 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23850 Rev 24490
Line 5... Line 5...
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 int retailerId;
8
	private final int retailerId;
9
	private final Set<Integer> roleIds;
9
	private final Set<Integer> roleIds;
-
 
10
	private final boolean readOnly = false;
10
	public UserInfo(int userId, int retailerId, Set<Integer> roleIds, String email){
11
	public UserInfo(int userId, int retailerId, Set<Integer> roleIds, String email){
11
		this.userId = userId;
12
		this.userId = userId;
12
		this.retailerId = retailerId;
13
		this.retailerId = retailerId;
13
		this.roleIds = roleIds;
14
		this.roleIds = roleIds;
14
		this.email = email;
15
		this.email = email;
15
	}
16
	}
-
 
17
	@Override
-
 
18
	public int hashCode() {
-
 
19
		final int prime = 31;
-
 
20
		int result = 1;
-
 
21
		result = prime * result + ((email == null) ? 0 : email.hashCode());
-
 
22
		result = prime * result + (readOnly ? 1231 : 1237);
-
 
23
		result = prime * result + retailerId;
-
 
24
		result = prime * result + ((roleIds == null) ? 0 : roleIds.hashCode());
-
 
25
		result = prime * result + userId;
-
 
26
		return result;
-
 
27
	}
-
 
28
	@Override
-
 
29
	public boolean equals(Object obj) {
-
 
30
		if (this == obj)
-
 
31
			return true;
-
 
32
		if (obj == null)
-
 
33
			return false;
-
 
34
		if (getClass() != obj.getClass())
-
 
35
			return false;
-
 
36
		UserInfo other = (UserInfo) obj;
-
 
37
		if (email == null) {
-
 
38
			if (other.email != null)
-
 
39
				return false;
-
 
40
		} else if (!email.equals(other.email))
-
 
41
			return false;
-
 
42
		if (readOnly != other.readOnly)
-
 
43
			return false;
-
 
44
		if (retailerId != other.retailerId)
-
 
45
			return false;
-
 
46
		if (roleIds == null) {
-
 
47
			if (other.roleIds != null)
-
 
48
				return false;
-
 
49
		} else if (!roleIds.equals(other.roleIds))
-
 
50
			return false;
-
 
51
		if (userId != other.userId)
-
 
52
			return false;
-
 
53
		return true;
-
 
54
	}
-
 
55
	public boolean isReadOnly() {
-
 
56
		return readOnly;
-
 
57
	}
16
	public int getUserId() {
58
	public int getUserId() {
17
		return userId;
59
		return userId;
18
	}
60
	}
19
	public int getRetailerId() {
61
	public int getRetailerId() {
20
		return retailerId;
62
		return retailerId;
Line 30... Line 72...
30
	}
72
	}
31
	
73
	
32
	@Override
74
	@Override
33
	public String toString() {
75
	public String toString() {
34
		return "UserInfo [email=" + email + ", userId=" + userId + ", retailerId=" + retailerId + ", roleIds=" + roleIds
76
		return "UserInfo [email=" + email + ", userId=" + userId + ", retailerId=" + retailerId + ", roleIds=" + roleIds
35
				+ "]";
77
				+ ", readOnly=" + readOnly + "]";
36
	}
78
	}
37
	
79
	
38
	
80
	
39
}
81
}