RoleRight.java
3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
*
* @author jkj
*/
@Entity
@Table(name = "role_rights")
@NamedQueries({
@NamedQuery(name = "RoleRight.findAll", query = "SELECT r FROM RoleRight r"),
@NamedQuery(name = "RoleRight.findByRoleRights", query = "SELECT r FROM RoleRight r WHERE r.roleRights = :roleRights"),
@NamedQuery(name = "RoleRight.findByRead", query = "SELECT r FROM RoleRight r WHERE r.read = :read"),
@NamedQuery(name = "RoleRight.findByWrite", query = "SELECT r FROM RoleRight r WHERE r.write = :write")})
public class RoleRight implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "role_rights", nullable = false)
private Integer roleRights;
@Basic(optional = false)
@Column(name = "read", nullable = false)
private boolean read;
@Basic(optional = false)
@Column(name = "write", nullable = false)
private boolean write;
@JoinColumn(name = "access_rights_id", referencedColumnName = "access_rights_id")
@ManyToOne
private AccessRight accessRightsId;
@JoinColumn(name = "roles_id", referencedColumnName = "roles_id", nullable = false)
@ManyToOne(optional = false)
private Role rolesId;
public RoleRight() {
}
public RoleRight(Integer roleRights) {
this.roleRights = roleRights;
}
public RoleRight(Integer roleRights, boolean read, boolean write) {
this.roleRights = roleRights;
this.read = read;
this.write = write;
}
public Integer getRoleRights() {
return roleRights;
}
public void setRoleRights(Integer roleRights) {
this.roleRights = roleRights;
}
public boolean getRead() {
return read;
}
public void setRead(boolean read) {
this.read = read;
}
public boolean getWrite() {
return write;
}
public void setWrite(boolean write) {
this.write = write;
}
public AccessRight getAccessRightsId() {
return accessRightsId;
}
public void setAccessRightsId(AccessRight accessRightsId) {
this.accessRightsId = accessRightsId;
}
public Role getRolesId() {
return rolesId;
}
public void setRolesId(Role rolesId) {
this.rolesId = rolesId;
}
@Override
public int hashCode() {
int hash = 0;
hash += (roleRights != null ? roleRights.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof RoleRight)) {
return false;
}
RoleRight other = (RoleRight) object;
if ((this.roleRights == null && other.roleRights != null) || (this.roleRights != null && !this.roleRights.equals(other.roleRights))) {
return false;
}
return true;
}
@Override
public String toString() {
return "fi.insomnia.bortal.model.RoleRight[roleRights=" + roleRights + "]";
}
}