Project

General

Profile

1
package eu.dnetlib.goldoa.domain;
2

    
3
import com.fasterxml.jackson.annotation.JsonBackReference;
4
import com.google.gwt.user.client.rpc.IsSerializable;
5

    
6
import javax.persistence.*;
7
import java.util.ArrayList;
8
import java.util.List;
9

    
10

    
11
@Entity
12
//@Cache(usage= CacheConcurrencyStrategy.READ_WRITE,region = "role")
13
public class Role implements IsSerializable{
14
	private static final long serialVersionUID = 1L;
15
	@Id
16
	@Column(columnDefinition = "text",unique = true, nullable = false)
17
	private String id;
18
	@Column(columnDefinition = "text")
19
	private String role;
20
	
21

    
22
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.role")
23
	@JsonBackReference
24
	private List<UserRole> userRoles = new ArrayList<>();
25

    
26
	public Role(){}
27

    
28
	public Role(String id, String role){
29
		this.setId(id);
30
		this.setRole(role);
31
	}
32

    
33
	public Role(String id) {
34
		this.id = id;
35
	}
36

    
37

    
38
	public List<UserRole> getUserRoles() {
39
		return userRoles;
40
	}
41

    
42
	public void setUserRoles(List<UserRole> userRoles) {
43
		this.userRoles = userRoles;
44
	}
45

    
46
	public String getId() {
47
		return id;
48
	}
49

    
50
	public void setId(String id) {
51
		this.id = id;
52
	}
53

    
54
	public String getRole() {
55
		return role;
56
	}
57

    
58
	public void setRole(String role) {
59
		this.role = role;
60
	}
61

    
62
	public void addUserRole(UserRole ur) {
63
		this.userRoles.add(ur);
64
	}
65
	
66
	public void removeUserRole(UserRole ur) {
67
		this.userRoles.remove(ur);
68
	}
69

    
70

    
71
	
72

    
73
}
(48-48/52)