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