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.apache.commons.lang.ObjectUtils;
29 import org.apache.commons.lang.StringUtils;
30 import org.kuali.rice.kim.api.role.RoleResponsibilityAction;
31 import org.kuali.rice.kim.api.role.RoleResponsibilityActionContract;
32 import org.kuali.rice.krad.bo.DataObjectBase;
33 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
34 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
35
36
37
38
39
40
41 @Entity
42 @Table(name = "KRIM_ROLE_RSP_ACTN_T")
43 public class RoleResponsibilityActionBo extends DataObjectBase implements RoleResponsibilityActionContract {
44
45 private static final long serialVersionUID = 1L;
46
47 @PortableSequenceGenerator(name = "KRIM_ROLE_RSP_ACTN_ID_S")
48 @GeneratedValue(generator = "KRIM_ROLE_RSP_ACTN_ID_S")
49 @Id
50 @Column(name = "ROLE_RSP_ACTN_ID")
51 private String id;
52
53 @Column(name = "ROLE_RSP_ID")
54 private String roleResponsibilityId;
55
56 @Column(name = "ROLE_MBR_ID")
57 private String roleMemberId;
58
59 @Column(name = "ACTN_TYP_CD")
60 private String actionTypeCode;
61
62 @Column(name = "ACTN_PLCY_CD")
63 private String actionPolicyCode;
64
65 @Column(name = "FRC_ACTN")
66 @Convert(converter = BooleanYNConverter.class)
67 private boolean forceAction;
68
69 @Column(name = "PRIORITY_NBR")
70 private Integer priorityNumber;
71
72 @ManyToOne(targetEntity = RoleResponsibilityBo.class, cascade = { CascadeType.REFRESH })
73 @JoinColumn(name = "ROLE_RSP_ID", referencedColumnName = "ROLE_RSP_ID", insertable = false, updatable = false)
74 private RoleResponsibilityBo roleResponsibility;
75
76 @Override
77 public RoleResponsibilityBo getRoleResponsibility() {
78 return roleResponsibility;
79 }
80
81 public static RoleResponsibilityAction to(RoleResponsibilityActionBo bo) {
82 if (bo == null) {
83 return null;
84 }
85 return RoleResponsibilityAction.Builder.create(bo).build();
86 }
87
88 public static RoleResponsibilityActionBo from(RoleResponsibilityAction immutable) {
89 if (immutable == null) {
90 return null;
91 }
92 RoleResponsibilityActionBo bo = new RoleResponsibilityActionBo();
93 bo.id = immutable.getId();
94 bo.roleResponsibilityId = immutable.getRoleResponsibilityId();
95 bo.roleMemberId = immutable.getRoleMemberId();
96 bo.actionTypeCode = immutable.getActionTypeCode();
97 bo.actionPolicyCode = immutable.getActionPolicyCode();
98 bo.forceAction = immutable.isForceAction();
99 bo.priorityNumber = immutable.getPriorityNumber();
100 bo.roleResponsibility = RoleResponsibilityBo.from(immutable.getRoleResponsibility());
101 bo.setVersionNumber(immutable.getVersionNumber());
102 return bo;
103 }
104
105 public boolean equals(RoleResponsibilityActionBo roleRspActn) {
106 if (!StringUtils.equals(roleRspActn.getRoleMemberId(), getRoleMemberId())) {
107 return false;
108 }
109 if (!StringUtils.equals(roleRspActn.getRoleResponsibilityId(), getRoleResponsibilityId())) {
110 return false;
111 }
112 if (!StringUtils.equals(roleRspActn.getActionTypeCode(), getActionTypeCode())) {
113 return false;
114 }
115 if (!StringUtils.equals(roleRspActn.getActionPolicyCode(), getActionPolicyCode())) {
116 return false;
117 }
118 if (!ObjectUtils.equals(roleRspActn.getPriorityNumber(), getPriorityNumber())) {
119 return false;
120 }
121 return true;
122 }
123
124 @Override
125 public String getId() {
126 return id;
127 }
128
129 public void setId(String id) {
130 this.id = id;
131 }
132
133 @Override
134 public String getRoleResponsibilityId() {
135 return roleResponsibilityId;
136 }
137
138 public void setRoleResponsibilityId(String roleResponsibilityId) {
139 this.roleResponsibilityId = roleResponsibilityId;
140 }
141
142 @Override
143 public String getRoleMemberId() {
144 return roleMemberId;
145 }
146
147 public void setRoleMemberId(String roleMemberId) {
148 this.roleMemberId = roleMemberId;
149 }
150
151 @Override
152 public String getActionTypeCode() {
153 return actionTypeCode;
154 }
155
156 public void setActionTypeCode(String actionTypeCode) {
157 this.actionTypeCode = actionTypeCode;
158 }
159
160 @Override
161 public String getActionPolicyCode() {
162 return actionPolicyCode;
163 }
164
165 public void setActionPolicyCode(String actionPolicyCode) {
166 this.actionPolicyCode = actionPolicyCode;
167 }
168
169 public boolean getForceAction() {
170 return forceAction;
171 }
172
173 @Override
174 public boolean isForceAction() {
175 return forceAction;
176 }
177
178 public void setForceAction(boolean forceAction) {
179 this.forceAction = forceAction;
180 }
181
182 @Override
183 public Integer getPriorityNumber() {
184 return priorityNumber;
185 }
186
187 public void setPriorityNumber(Integer priorityNumber) {
188 this.priorityNumber = priorityNumber;
189 }
190
191 public void setRoleResponsibility(RoleResponsibilityBo roleResponsibility) {
192 this.roleResponsibility = roleResponsibility;
193 }
194 }