1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.mobility.security.user.entity;
16
17 import javax.persistence.Column;
18 import javax.persistence.Embeddable;
19 import java.io.Serializable;
20
21
22
23
24 @Embeddable
25 public class GroupMembershipPK implements Serializable {
26
27 @Column(name="GROUP_ID",nullable = false)
28 public Long groupId;
29
30 @Column(name="USER_ID",nullable = false)
31 public Long userId;
32
33 public GroupMembershipPK(Long groupId,Long userId) {
34 this.userId = userId;
35 this.groupId = groupId;
36 }
37
38 public GroupMembershipPK() {}
39
40 public boolean equals(Object obj) {
41 boolean isEquals = false;
42 if( obj != null && obj instanceof GroupMembershipPK ) {
43 if( groupId != null
44 && 0 == groupId.compareTo(((GroupMembershipPK)obj).groupId)
45 && userId != null
46 && 0 == userId.compareTo(((GroupMembershipPK)obj).userId) ) {
47 isEquals = true;
48 }
49 }
50 return isEquals;
51 }
52
53 public int hashCode() {
54 int code = 42;
55 if( groupId != null ) code += groupId.intValue();
56 if( userId != null ) code += (-2*userId.intValue());
57 return code;
58 }
59 }