1
|
package eu.dnetlib.goldoa.domain;
|
2
|
|
3
|
import javax.persistence.GeneratedValue;
|
4
|
import javax.persistence.GenerationType;
|
5
|
import javax.persistence.Id;
|
6
|
import javax.persistence.ManyToOne;
|
7
|
import java.io.Serializable;
|
8
|
|
9
|
/**
|
10
|
* Created by panagiotis on 17/1/2017.
|
11
|
*/
|
12
|
public class AffiliationPK implements Serializable {
|
13
|
|
14
|
private static final long serialVersionUID = 1L;
|
15
|
|
16
|
@ManyToOne
|
17
|
private User user;
|
18
|
@ManyToOne
|
19
|
private Organization organization;
|
20
|
|
21
|
public User getUser() {
|
22
|
return user;
|
23
|
}
|
24
|
|
25
|
public void setUser(User user) {
|
26
|
this.user = user;
|
27
|
}
|
28
|
|
29
|
public Organization getOrganization() {
|
30
|
return organization;
|
31
|
}
|
32
|
|
33
|
public void setOrganization(Organization organization) {
|
34
|
this.organization = organization;
|
35
|
}
|
36
|
|
37
|
@Override
|
38
|
public boolean equals(Object o) {
|
39
|
if (this == o) return true;
|
40
|
if (o == null || getClass() != o.getClass()) return false;
|
41
|
|
42
|
AffiliationPK that = (AffiliationPK) o;
|
43
|
|
44
|
if (!user.equals(that.user)) return false;
|
45
|
return organization.equals(that.organization);
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public int hashCode() {
|
50
|
int result = user.hashCode();
|
51
|
result = 31 * result + organization.hashCode();
|
52
|
return result;
|
53
|
}
|
54
|
}
|