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