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.CascadeType;
19 import javax.persistence.Column;
20 import javax.persistence.Convert;
21 import javax.persistence.Entity;
22 import javax.persistence.GeneratedValue;
23 import javax.persistence.Id;
24 import javax.persistence.JoinColumn;
25 import javax.persistence.ManyToOne;
26 import javax.persistence.Table;
27
28 import org.kuali.rice.kim.api.role.RoleResponsibility;
29 import org.kuali.rice.kim.api.role.RoleResponsibilityContract;
30 import org.kuali.rice.kim.impl.responsibility.ResponsibilityBo;
31 import org.kuali.rice.krad.bo.DataObjectBase;
32 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
33 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
34
35
36
37
38 @Entity
39 @Table(name = "KRIM_ROLE_RSP_T")
40 public class RoleResponsibilityBo extends DataObjectBase implements RoleResponsibilityContract {
41
42 private static final long serialVersionUID = 1L;
43
44 @PortableSequenceGenerator(name = "KRIM_ROLE_RSP_ID_S")
45 @GeneratedValue(generator = "KRIM_ROLE_RSP_ID_S")
46 @Id
47 @Column(name = "ROLE_RSP_ID")
48 private String roleResponsibilityId;
49
50 @Column(name = "ROLE_ID")
51 private String roleId;
52
53 @Column(name = "RSP_ID")
54 private String responsibilityId;
55
56 @Column(name = "ACTV_IND")
57 @Convert(converter = BooleanYNConverter.class)
58 private boolean active;
59
60 @ManyToOne(targetEntity = ResponsibilityBo.class, cascade = { CascadeType.REFRESH })
61 @JoinColumn(name = "RSP_ID", referencedColumnName = "RSP_ID", insertable = false, updatable = false)
62 private ResponsibilityBo kimResponsibility;
63
64 public static RoleResponsibility to(RoleResponsibilityBo bo) {
65 if (bo == null) {
66 return null;
67 }
68 return RoleResponsibility.Builder.create(bo).build();
69 }
70
71 public static RoleResponsibilityBo from(RoleResponsibility immutable) {
72 if (immutable == null) {
73 return null;
74 }
75 RoleResponsibilityBo bo = new RoleResponsibilityBo();
76 bo.roleResponsibilityId = immutable.getRoleResponsibilityId();
77 bo.roleId = immutable.getRoleId();
78 bo.responsibilityId = immutable.getResponsibilityId();
79 bo.active = immutable.isActive();
80 bo.setVersionNumber(immutable.getVersionNumber());
81 return bo;
82 }
83
84 @Override
85 public String getRoleResponsibilityId() {
86 return roleResponsibilityId;
87 }
88
89 public void setRoleResponsibilityId(String roleResponsibilityId) {
90 this.roleResponsibilityId = roleResponsibilityId;
91 }
92
93 @Override
94 public String getRoleId() {
95 return roleId;
96 }
97
98 public void setRoleId(String roleId) {
99 this.roleId = roleId;
100 }
101
102 @Override
103 public String getResponsibilityId() {
104 return responsibilityId;
105 }
106
107 public void setResponsibilityId(String responsibilityId) {
108 this.responsibilityId = responsibilityId;
109 }
110
111 public boolean getActive() {
112 return active;
113 }
114
115 @Override
116 public boolean isActive() {
117 return active;
118 }
119
120 public void setActive(boolean active) {
121 this.active = active;
122 }
123
124 public ResponsibilityBo getKimResponsibility() {
125 return kimResponsibility;
126 }
127
128 public void setKimResponsibility(ResponsibilityBo kimResponsibility) {
129 this.kimResponsibility = kimResponsibility;
130 }
131 }