1
|
package eu.dnetlib.goldoa.domain;
|
2
|
import java.io.Serializable;
|
3
|
import java.util.ArrayList;
|
4
|
import java.util.List;
|
5
|
|
6
|
import javax.persistence.*;
|
7
|
|
8
|
|
9
|
@Entity
|
10
|
public class Role implements Serializable{
|
11
|
private static final long serialVersionUID = 1L;
|
12
|
@Id
|
13
|
//@Column(columnDefinition = "text")
|
14
|
@Column(name = "id", unique = true, nullable = false)
|
15
|
private String id;
|
16
|
|
17
|
//@Column(columnDefinition = "text")
|
18
|
private String role;
|
19
|
|
20
|
|
21
|
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.role")
|
22
|
private List<UserRole> userRoles = new ArrayList<>();
|
23
|
|
24
|
public Role(String id, String role){
|
25
|
this.setId(id);
|
26
|
this.setRole(role);
|
27
|
}
|
28
|
|
29
|
|
30
|
public List<UserRole> getUserRoles() {
|
31
|
return userRoles;
|
32
|
}
|
33
|
|
34
|
public void setUserRoles(List<UserRole> userRoles) {
|
35
|
this.userRoles = userRoles;
|
36
|
}
|
37
|
|
38
|
public String getId() {
|
39
|
return id;
|
40
|
}
|
41
|
|
42
|
public void setId(String id) {
|
43
|
this.id = id;
|
44
|
}
|
45
|
|
46
|
public String getRole() {
|
47
|
return role;
|
48
|
}
|
49
|
|
50
|
public void setRole(String role) {
|
51
|
this.role = role;
|
52
|
}
|
53
|
|
54
|
public void addUserRole(UserRole ur) {
|
55
|
this.userRoles.add(ur);
|
56
|
}
|
57
|
|
58
|
public void removeUserRole(UserRole ur) {
|
59
|
this.userRoles.remove(ur);
|
60
|
}
|
61
|
|
62
|
|
63
|
}
|