1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.bo.ui; |
17 | |
|
18 | |
import javax.persistence.Column; |
19 | |
import javax.persistence.Entity; |
20 | |
import javax.persistence.GeneratedValue; |
21 | |
import javax.persistence.Id; |
22 | |
import javax.persistence.IdClass; |
23 | |
import javax.persistence.Table; |
24 | |
import javax.persistence.Transient; |
25 | |
|
26 | |
import org.apache.commons.lang.StringUtils; |
27 | |
import org.hibernate.annotations.GenericGenerator; |
28 | |
import org.hibernate.annotations.Parameter; |
29 | |
import org.kuali.rice.kim.api.permission.Permission; |
30 | |
import org.kuali.rice.kim.api.services.KimApiServiceLocator; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
@IdClass(KimDocumentRolePermissionId.class) |
36 | |
@Entity |
37 | |
@Table(name="KRIM_PND_ROLE_PERM_T") |
38 | 0 | public class KimDocumentRolePermission extends KimDocumentBoActivatableBase { |
39 | |
|
40 | |
private static final long serialVersionUID = 1L; |
41 | |
@Id |
42 | |
@GeneratedValue(generator="KRIM_ROLE_PERM_ID_S") |
43 | |
@GenericGenerator(name="KRIM_ROLE_PERM_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={ |
44 | |
@Parameter(name="sequence_name",value="KRIM_ROLE_PERM_ID_S"), |
45 | |
@Parameter(name="value_column",value="id") |
46 | |
}) |
47 | |
@Column(name="ROLE_PERM_ID") |
48 | |
protected String rolePermissionId; |
49 | |
@Column(name="ROLE_ID") |
50 | |
protected String roleId; |
51 | |
@Column(name="PERM_ID") |
52 | |
protected String permissionId; |
53 | |
@Transient |
54 | |
protected Permission permission; |
55 | |
|
56 | |
public String getPermissionId() { |
57 | 0 | return permissionId; |
58 | |
} |
59 | |
|
60 | |
public String getRoleId() { |
61 | 0 | return roleId; |
62 | |
} |
63 | |
|
64 | |
public String getRolePermissionId() { |
65 | 0 | return rolePermissionId; |
66 | |
} |
67 | |
|
68 | |
public void setPermissionId(String permissionId) { |
69 | 0 | this.permissionId = permissionId; |
70 | 0 | } |
71 | |
|
72 | |
public void setRoleId(String roleId) { |
73 | 0 | this.roleId = roleId; |
74 | 0 | } |
75 | |
|
76 | |
public void setRolePermissionId(String rolePermissionId) { |
77 | 0 | this.rolePermissionId = rolePermissionId; |
78 | 0 | } |
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
public Permission getPermission() { |
84 | 0 | if ( permission == null || !StringUtils.equals( permission.getId(), permissionId ) ) { |
85 | 0 | permission = KimApiServiceLocator.getPermissionService().getPermission(permissionId); |
86 | |
} |
87 | 0 | return permission; |
88 | |
} |
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
public void setPermission(Permission permission) { |
94 | 0 | this.permission = permission; |
95 | 0 | } |
96 | |
|
97 | |
} |