01: package com.technoetic.xplanner.security.auth;
02:
03: public class PermissionSetKey {
04: int principalId;
05: String resourceType;
06: int resourceId;
07: String permission;
08:
09: public PermissionSetKey(int principalId, String resourceType,
10: int resourceId, String permission) {
11: this .principalId = principalId;
12: this .resourceType = resourceType;
13: this .resourceId = resourceId;
14: this .permission = permission;
15: }
16:
17: public int getPrincipalId() {
18: return principalId;
19: }
20:
21: public String getResourceType() {
22: return resourceType;
23: }
24:
25: public int getResourceId() {
26: return resourceId;
27: }
28:
29: public String getPermission() {
30: return permission;
31: }
32:
33: public boolean equals(Object o) {
34: if (this == o)
35: return true;
36: if (!(o instanceof PermissionSetKey))
37: return false;
38:
39: final PermissionSetKey permissionSetKey = (PermissionSetKey) o;
40:
41: if (principalId != permissionSetKey.principalId)
42: return false;
43: if (resourceId != permissionSetKey.resourceId)
44: return false;
45: if (permission != null ? !permission
46: .equals(permissionSetKey.permission)
47: : permissionSetKey.permission != null)
48: return false;
49: if (resourceType != null ? !resourceType
50: .equals(permissionSetKey.resourceType)
51: : permissionSetKey.resourceType != null)
52: return false;
53:
54: return true;
55: }
56:
57: public int hashCode() {
58: int result;
59: result = principalId;
60: result = 29 * result
61: + (resourceType != null ? resourceType.hashCode() : 0);
62: result = 29 * result + resourceId;
63: result = 29 * result
64: + (permission != null ? permission.hashCode() : 0);
65: return result;
66: }
67:
68: public String toString() {
69: return getClass().getName().substring(
70: getClass().getName().lastIndexOf(".") + 1)
71: + "("
72: + principalId
73: + ","
74: + resourceType
75: + ","
76: + resourceId + "," + permission + ")";
77: }
78: }
|