1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.impl.role |
17 | |
|
18 | |
import javax.persistence.Column |
19 | |
import javax.persistence.Entity |
20 | |
import javax.persistence.FetchType |
21 | |
import javax.persistence.Id |
22 | |
import javax.persistence.JoinColumn; |
23 | |
|
24 | |
|
25 | |
import javax.persistence.OneToOne; |
26 | |
import javax.persistence.Table |
27 | |
|
28 | |
import org.hibernate.annotations.Type |
29 | |
import org.kuali.rice.kim.api.role.RolePermission |
30 | |
import org.kuali.rice.kim.api.role.RolePermissionContract |
31 | |
import org.kuali.rice.kim.impl.permission.PermissionBo |
32 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase |
33 | |
|
34 | |
@Entity |
35 | |
@Table(name="KRIM_ROLE_PERM_T") |
36 | |
public class RolePermissionBo extends PersistableBusinessObjectBase implements RolePermissionContract { |
37 | |
private static final long serialVersionUID = 1L; |
38 | |
|
39 | |
@Id |
40 | |
@Column(name="ROLE_PERM_ID") |
41 | |
String id |
42 | |
|
43 | |
@Column(name="ROLE_ID") |
44 | |
String roleId; |
45 | |
|
46 | |
@Column(name="PERM_ID") |
47 | |
String permissionId |
48 | |
|
49 | |
@Column(name="ACTV_IND") |
50 | |
@Type(type="yes_no") |
51 | |
boolean active |
52 | |
|
53 | |
@OneToOne(targetEntity=PermissionBo.class,cascade=[],fetch=FetchType.EAGER) |
54 | |
@JoinColumn(name = "PERM_ID", insertable = false, updatable = false) |
55 | |
PermissionBo permission; |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
static RolePermission to(RolePermissionBo bo) { |
63 | 0 | if (bo == null) { |
64 | 0 | return null |
65 | |
} |
66 | |
|
67 | 0 | return RolePermission.Builder.create(bo).build(); |
68 | |
} |
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
static RolePermissionBo from(RolePermission im) { |
76 | 0 | if (im == null) { |
77 | 0 | return null |
78 | |
} |
79 | |
|
80 | 0 | RolePermissionBo bo = new RolePermissionBo() |
81 | 0 | bo.id = im.id |
82 | 0 | bo.roleId = im.roleId |
83 | 0 | bo.permissionId = im.permissionId |
84 | 0 | bo.active = im.active |
85 | 0 | bo.versionNumber = im.versionNumber |
86 | 0 | bo.objectId = im.objectId; |
87 | |
|
88 | 0 | return bo |
89 | |
} |
90 | |
|
91 | |
} |