1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.api.role;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.apache.commons.lang.builder.EqualsBuilder;
20 import org.apache.commons.lang.builder.HashCodeBuilder;
21 import org.apache.commons.lang.builder.ToStringBuilder;
22 import org.kuali.rice.core.api.CoreConstants;
23 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
24 import org.kuali.rice.core.api.mo.ModelBuilder;
25 import org.kuali.rice.core.api.mo.ModelObjectComplete;
26 import org.kuali.rice.kim.api.KimConstants;
27 import org.w3c.dom.Element;
28
29 import javax.xml.bind.annotation.XmlAccessType;
30 import javax.xml.bind.annotation.XmlAccessorType;
31 import javax.xml.bind.annotation.XmlAnyElement;
32 import javax.xml.bind.annotation.XmlElement;
33 import javax.xml.bind.annotation.XmlRootElement;
34 import javax.xml.bind.annotation.XmlType;
35 import java.util.Collection;
36
37
38
39
40 @XmlRootElement(name = RoleResponsibilityAction.Constants.ROOT_ELEMENT_NAME)
41 @XmlAccessorType(XmlAccessType.NONE)
42 @XmlType(name = RoleResponsibilityAction.Constants.TYPE_NAME, propOrder = {
43 RoleResponsibilityAction.Elements.ID,
44 RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY_ID,
45 RoleResponsibilityAction.Elements.ROLE_MEMBER_ID,
46 RoleResponsibilityAction.Elements.ACTION_TYPE_CODE,
47 RoleResponsibilityAction.Elements.ACTION_POLICY_CODE,
48 RoleResponsibilityAction.Elements.FORCE_ACTION,
49 RoleResponsibilityAction.Elements.PRIORITY_NUMBER,
50 RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY,
51 CoreConstants.CommonElements.VERSION_NUMBER,
52 CoreConstants.CommonElements.FUTURE_ELEMENTS
53 })
54 public class RoleResponsibilityAction extends AbstractDataTransferObject implements RoleResponsibilityActionContract {
55
56 @XmlElement(name = RoleResponsibilityAction.Elements.ID, required = true)
57 private final String id;
58
59 @XmlElement(name = RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY_ID)
60 private final String roleResponsibilityId;
61
62 @XmlElement(name = RoleResponsibilityAction.Elements.ROLE_MEMBER_ID)
63 private final String roleMemberId;
64
65 @XmlElement(name = RoleResponsibilityAction.Elements.ACTION_TYPE_CODE)
66 private final String actionTypeCode;
67
68 @XmlElement(name = RoleResponsibilityAction.Elements.ACTION_POLICY_CODE)
69 private final String actionPolicyCode;
70
71 @XmlElement(name = RoleResponsibilityAction.Elements.FORCE_ACTION)
72 private final boolean forceAction;
73
74 @XmlElement(name = RoleResponsibilityAction.Elements.PRIORITY_NUMBER)
75 private final Integer priorityNumber;
76
77 @XmlElement(name = RoleResponsibilityAction.Elements.ROLE_RESPONSIBILITY)
78 private final RoleResponsibility roleResponsibility;
79
80 @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER)
81 private final Long versionNumber;
82
83 @SuppressWarnings("unused")
84 @XmlAnyElement
85 private final Collection<Element> _futureElements = null;
86
87
88
89
90 @SuppressWarnings("unused")
91 private RoleResponsibilityAction() {
92 id = null;
93 roleResponsibilityId = null;
94 roleMemberId = null;
95 actionTypeCode = null;
96 actionPolicyCode = null;
97 forceAction = false;
98 priorityNumber = null;
99 roleResponsibility = null;
100 versionNumber = null;
101 }
102
103 private RoleResponsibilityAction(Builder b) {
104 id = b.getId();
105 roleResponsibilityId = b.getRoleResponsibilityId();
106 roleMemberId = b.getRoleMemberId();
107 actionTypeCode = b.getActionTypeCode();
108 actionPolicyCode = b.getActionPolicyCode();
109 forceAction = b.isForceAction();
110 priorityNumber = b.getPriorityNumber();
111 roleResponsibility = b.getRoleResponsibility();
112 versionNumber = b.getVersionNumber();
113 }
114
115 @Override
116 public String getId() {
117 return this.id;
118 }
119
120 @Override
121 public String getRoleResponsibilityId() {
122 return this.roleResponsibilityId;
123 }
124
125 @Override
126 public String getActionTypeCode() {
127 return this.actionTypeCode;
128 }
129
130 @Override
131 public Integer getPriorityNumber() {
132 return this.priorityNumber;
133 }
134
135 @Override
136 public String getActionPolicyCode() {
137 return this.actionPolicyCode;
138 }
139
140 @Override
141 public String getRoleMemberId() {
142 return this.roleMemberId;
143 }
144
145 @Override
146 public RoleResponsibility getRoleResponsibility() {
147 return this.roleResponsibility;
148 }
149
150 @Override
151 public boolean isForceAction() {
152 return this.forceAction;
153 }
154
155 @Override
156 public Long getVersionNumber() {
157 return this.versionNumber;
158 }
159
160 public static class Builder implements RoleResponsibilityActionContract, ModelBuilder, ModelObjectComplete {
161
162 private String Id;
163 private String roleResponsibilityId;
164 private String roleMemberId;
165 private String actionTypeCode;
166 private String actionPolicyCode;
167 private boolean forceAction;
168 private Integer priorityNumber;
169 private RoleResponsibility roleResponsibility;
170 private Long versionNumber;
171
172 private Builder() {
173 }
174
175 public static Builder create() {
176 return new Builder();
177 }
178
179 public static Builder create(RoleResponsibilityActionContract rra) {
180 Builder b = new Builder();
181 b.setForceAction(rra.isForceAction());
182 b.setActionPolicyCode(rra.getActionPolicyCode());
183 b.setActionTypeCode(rra.getActionTypeCode());
184 b.setPriorityNumber(rra.getPriorityNumber());
185 b.setRoleMemberId(rra.getRoleMemberId());
186 if (rra.getRoleResponsibility() != null) {
187 b.setRoleResponsibility(RoleResponsibility.Builder.create(rra.getRoleResponsibility()).build());
188 }
189 b.setId(rra.getId());
190 b.setRoleResponsibilityId(rra.getRoleResponsibilityId());
191 b.setVersionNumber(rra.getVersionNumber());
192 return b;
193 }
194
195 @Override
196 public RoleResponsibilityAction build() {
197 if (versionNumber == null || Id == null) {
198 throw new IllegalStateException("versionNumber and id must be non-null and " +
199 "not empty for RoleResponsibilityAction");
200 }
201 return new RoleResponsibilityAction(this);
202 }
203
204 @Override
205 public String getId() {
206 return Id;
207 }
208
209 public void setId(String id) {
210 if (StringUtils.isBlank(id)) {
211 throw new IllegalArgumentException("id must be non-null and not empty");
212 }
213 this.Id = id;
214 }
215
216 @Override
217 public String getRoleResponsibilityId() {
218 return roleResponsibilityId;
219 }
220
221 public void setRoleResponsibilityId(String roleResponsibilityId) {
222 this.roleResponsibilityId = roleResponsibilityId;
223 }
224
225 @Override
226 public String getActionTypeCode() {
227 return actionTypeCode;
228 }
229
230 public void setActionTypeCode(String actionTypeCode) {
231 this.actionTypeCode = actionTypeCode;
232 }
233
234 @Override
235 public Integer getPriorityNumber() {
236 return priorityNumber;
237 }
238
239 public void setPriorityNumber(Integer priorityNumber) {
240 this.priorityNumber = priorityNumber;
241 }
242
243 @Override
244 public String getActionPolicyCode() {
245 return actionPolicyCode;
246 }
247
248 public void setActionPolicyCode(String actionPolicyCode) {
249 this.actionPolicyCode = actionPolicyCode;
250 }
251
252 @Override
253 public String getRoleMemberId() {
254 return roleMemberId;
255 }
256
257 public void setRoleMemberId(String roleMemberId) {
258 this.roleMemberId = roleMemberId;
259 }
260
261 @Override
262 public RoleResponsibility getRoleResponsibility() {
263 return roleResponsibility;
264 }
265
266 public void setRoleResponsibility(RoleResponsibility roleResponsibility) {
267 this.roleResponsibility = roleResponsibility;
268 }
269
270 @Override
271 public boolean isForceAction() {
272 return forceAction;
273 }
274
275 public void setForceAction(boolean forceAction) {
276 this.forceAction = forceAction;
277 }
278
279 @Override
280 public Long getVersionNumber() {
281 return versionNumber;
282 }
283
284 public void setVersionNumber(Long versionNumber) {
285 if (versionNumber == null) {
286 throw new IllegalArgumentException("versionNumber must be non-null");
287 }
288 this.versionNumber = versionNumber;
289 }
290
291 @Override
292 public int hashCode() {
293 return HashCodeBuilder.reflectionHashCode(this);
294 }
295
296 @Override
297 public boolean equals(Object obj) {
298 return EqualsBuilder.reflectionEquals(obj, this);
299 }
300
301 @Override
302 public String toString() {
303 return ToStringBuilder.reflectionToString(this);
304 }
305 }
306
307
308
309
310
311
312 static class Elements {
313 final static String ID = "id";
314 final static String ROLE_RESPONSIBILITY_ID = "roleResponsibilityId";
315 final static String ROLE_MEMBER_ID = "roleMemberId";
316 final static String ACTION_TYPE_CODE = "actionTypeCode";
317 final static String ACTION_POLICY_CODE = "actionPolicyCode";
318 final static String FORCE_ACTION = "forceAction";
319 final static String PRIORITY_NUMBER = "priorityNumber";
320 final static String ROLE_RESPONSIBILITY = "roleResponsibility";
321 }
322
323
324
325
326 static class Constants {
327 final static String ROOT_ELEMENT_NAME = "roleResponsibilityAction";
328 final static String TYPE_NAME = "RoleResponsibilityActionType";
329 }
330
331 public static class Cache {
332 public static final String NAME = KimConstants.Namespaces.KIM_NAMESPACE_2_0 + "/" + RoleResponsibilityAction.Constants.TYPE_NAME;
333 }
334 }