1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.api.action; |
17 | |
|
18 | |
import java.io.Serializable; |
19 | |
import java.util.ArrayList; |
20 | |
import java.util.Collection; |
21 | |
import java.util.Collections; |
22 | |
import java.util.List; |
23 | |
|
24 | |
import javax.xml.bind.annotation.XmlAccessType; |
25 | |
import javax.xml.bind.annotation.XmlAccessorType; |
26 | |
import javax.xml.bind.annotation.XmlAnyElement; |
27 | |
import javax.xml.bind.annotation.XmlElement; |
28 | |
import javax.xml.bind.annotation.XmlElementWrapper; |
29 | |
import javax.xml.bind.annotation.XmlRootElement; |
30 | |
import javax.xml.bind.annotation.XmlType; |
31 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
32 | |
|
33 | |
import org.apache.commons.lang.StringUtils; |
34 | |
import org.apache.commons.lang.builder.EqualsBuilder; |
35 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
36 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
37 | |
import org.joda.time.DateTime; |
38 | |
import org.kuali.rice.core.api.CoreConstants; |
39 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
40 | |
import org.kuali.rice.core.api.mo.ModelObjectComplete; |
41 | |
import org.kuali.rice.core.util.jaxb.DateTimeAdapter; |
42 | |
import org.kuali.rice.kew.api.KewApiConstants; |
43 | |
import org.w3c.dom.Element; |
44 | |
|
45 | 0 | @XmlRootElement(name = ActionRequest.Constants.ROOT_ELEMENT_NAME) |
46 | |
@XmlAccessorType(XmlAccessType.NONE) |
47 | |
@XmlType(name = ActionRequest.Constants.TYPE_NAME, propOrder = { |
48 | |
ActionRequest.Elements.ID, |
49 | |
ActionRequest.Elements.ACTION_REQUESTED_CODE, |
50 | |
ActionRequest.Elements.STATUS_CODE, |
51 | |
ActionRequest.Elements.CURRENT, |
52 | |
ActionRequest.Elements.DATE_CREATED, |
53 | |
ActionRequest.Elements.RESPONSIBILITY_ID, |
54 | |
ActionRequest.Elements.DOCUMENT_ID, |
55 | |
ActionRequest.Elements.PRIORITY, |
56 | |
ActionRequest.Elements.ANNOTATION, |
57 | |
ActionRequest.Elements.RECIPIENT_TYPE_CODE, |
58 | |
ActionRequest.Elements.PRINCIPAL_ID, |
59 | |
ActionRequest.Elements.GROUP_ID, |
60 | |
ActionRequest.Elements.REQUEST_POLICY_CODE, |
61 | |
ActionRequest.Elements.RESPONSIBILITY_DESCRIPTION, |
62 | |
ActionRequest.Elements.FORCE_ACTION, |
63 | |
ActionRequest.Elements.DELEGATION_TYPE_CODE, |
64 | |
ActionRequest.Elements.ROLE_NAME, |
65 | |
ActionRequest.Elements.QUALIFIED_ROLE_NAME, |
66 | |
ActionRequest.Elements.QUALIFIED_ROLE_NAME_LABEL, |
67 | |
ActionRequest.Elements.ROUTE_NODE_INSTANCE_ID, |
68 | |
ActionRequest.Elements.NODE_NAME, |
69 | |
ActionRequest.Elements.REQUEST_LABEL, |
70 | |
ActionRequest.Elements.PARENT_ACTION_REQUEST_ID, |
71 | |
ActionRequest.Elements.ACTION_TAKEN, |
72 | |
ActionRequest.Elements.CHILD_REQUESTS, |
73 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
74 | |
}) |
75 | 0 | public final class ActionRequest implements ModelObjectComplete, ActionRequestContract { |
76 | |
|
77 | |
private static final long serialVersionUID = -7581089059447119201L; |
78 | |
|
79 | |
@XmlElement(name = Elements.ID, required = true) |
80 | |
private final String id; |
81 | |
|
82 | |
@XmlElement(name = Elements.ACTION_REQUESTED_CODE, required = true) |
83 | |
private final String actionRequestedCode; |
84 | |
|
85 | |
@XmlElement(name = Elements.STATUS_CODE, required = true) |
86 | |
private final String statusCode; |
87 | |
|
88 | |
@XmlElement(name = Elements.CURRENT, required = true) |
89 | |
private final boolean current; |
90 | |
|
91 | |
@XmlElement(name = Elements.DATE_CREATED, required = true) |
92 | |
@XmlJavaTypeAdapter(DateTimeAdapter.class) |
93 | |
private final DateTime dateCreated; |
94 | |
|
95 | |
@XmlElement(name = Elements.RESPONSIBILITY_ID, required = true) |
96 | |
private final String responsibilityId; |
97 | |
|
98 | |
@XmlElement(name = Elements.DOCUMENT_ID, required = true) |
99 | |
private final String documentId; |
100 | |
|
101 | |
@XmlElement(name = Elements.PRIORITY, required = true) |
102 | |
private final int priority; |
103 | |
|
104 | |
@XmlElement(name = Elements.ANNOTATION, required = false) |
105 | |
private final String annotation; |
106 | |
|
107 | |
@XmlElement(name = Elements.RECIPIENT_TYPE_CODE, required = true) |
108 | |
private final String recipientTypeCode; |
109 | |
|
110 | |
@XmlElement(name = Elements.PRINCIPAL_ID, required = false) |
111 | |
private final String principalId; |
112 | |
|
113 | |
@XmlElement(name = Elements.GROUP_ID, required = false) |
114 | |
private final String groupId; |
115 | |
|
116 | |
@XmlElement(name = Elements.REQUEST_POLICY_CODE, required = false) |
117 | |
private final String requestPolicyCode; |
118 | |
|
119 | |
@XmlElement(name = Elements.RESPONSIBILITY_DESCRIPTION, required = false) |
120 | |
private final String responsibilityDescription; |
121 | |
|
122 | |
@XmlElement(name = Elements.FORCE_ACTION, required = true) |
123 | |
private final boolean forceAction; |
124 | |
|
125 | |
@XmlElement(name = Elements.DELEGATION_TYPE_CODE, required = false) |
126 | |
private final String delegationTypeCode; |
127 | |
|
128 | |
@XmlElement(name = Elements.ROLE_NAME, required = false) |
129 | |
private final String roleName; |
130 | |
|
131 | |
@XmlElement(name = Elements.QUALIFIED_ROLE_NAME, required = false) |
132 | |
private final String qualifiedRoleName; |
133 | |
|
134 | |
@XmlElement(name = Elements.QUALIFIED_ROLE_NAME_LABEL, required = false) |
135 | |
private final String qualifiedRoleNameLabel; |
136 | |
|
137 | |
@XmlElement(name = Elements.ROUTE_NODE_INSTANCE_ID, required = false) |
138 | |
private final String routeNodeInstanceId; |
139 | |
|
140 | |
@XmlElement(name = Elements.NODE_NAME, required = false) |
141 | |
private final String nodeName; |
142 | |
|
143 | |
@XmlElement(name = Elements.REQUEST_LABEL, required = false) |
144 | |
private final String requestLabel; |
145 | |
|
146 | |
@XmlElement(name = Elements.PARENT_ACTION_REQUEST_ID, required = false) |
147 | |
private final String parentActionRequestId; |
148 | |
|
149 | |
@XmlElement(name = Elements.ACTION_TAKEN, required = false) |
150 | |
private final ActionTaken actionTaken; |
151 | |
|
152 | |
@XmlElementWrapper(name = Elements.CHILD_REQUESTS, required = false) |
153 | |
@XmlElement(name = Elements.CHILD_REQUEST, required = false) |
154 | |
private final List<ActionRequest> childRequests; |
155 | |
|
156 | 0 | @SuppressWarnings("unused") |
157 | |
@XmlAnyElement |
158 | |
private final Collection<Element> _futureElements = null; |
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | 0 | private ActionRequest() { |
164 | 0 | this.id = null; |
165 | 0 | this.actionRequestedCode = null; |
166 | 0 | this.statusCode = null; |
167 | 0 | this.current = false; |
168 | 0 | this.dateCreated = null; |
169 | 0 | this.responsibilityId = null; |
170 | 0 | this.documentId = null; |
171 | 0 | this.priority = 0; |
172 | 0 | this.annotation = null; |
173 | 0 | this.recipientTypeCode = null; |
174 | 0 | this.principalId = null; |
175 | 0 | this.groupId = null; |
176 | 0 | this.requestPolicyCode = null; |
177 | 0 | this.responsibilityDescription = null; |
178 | 0 | this.forceAction = false; |
179 | 0 | this.delegationTypeCode = null; |
180 | 0 | this.roleName = null; |
181 | 0 | this.qualifiedRoleName = null; |
182 | 0 | this.qualifiedRoleNameLabel = null; |
183 | 0 | this.routeNodeInstanceId = null; |
184 | 0 | this.nodeName = null; |
185 | 0 | this.requestLabel = null; |
186 | 0 | this.parentActionRequestId = null; |
187 | 0 | this.actionTaken = null; |
188 | 0 | this.childRequests = null; |
189 | 0 | } |
190 | |
|
191 | 0 | private ActionRequest(Builder builder) { |
192 | 0 | this.id = builder.getId(); |
193 | 0 | this.actionRequestedCode = builder.getActionRequested().getCode(); |
194 | 0 | this.statusCode = builder.getStatus().getCode(); |
195 | 0 | this.current = builder.isCurrent(); |
196 | 0 | this.dateCreated = builder.getDateCreated(); |
197 | 0 | this.responsibilityId = builder.getResponsibilityId(); |
198 | 0 | this.documentId = builder.getDocumentId(); |
199 | 0 | this.priority = builder.getPriority(); |
200 | 0 | this.annotation = builder.getAnnotation(); |
201 | 0 | this.recipientTypeCode = builder.getRecipientType().getCode(); |
202 | 0 | this.principalId = builder.getPrincipalId(); |
203 | 0 | this.groupId = builder.getGroupId(); |
204 | 0 | if (builder.getRequestPolicy() == null) { |
205 | 0 | this.requestPolicyCode = null; |
206 | |
} else { |
207 | 0 | this.requestPolicyCode = builder.getRequestPolicy().getCode(); |
208 | |
} |
209 | 0 | this.responsibilityDescription = builder.getResponsibilityDescription(); |
210 | 0 | this.forceAction = builder.isForceAction(); |
211 | 0 | if (builder.getDelegationType() == null) { |
212 | 0 | this.delegationTypeCode = null; |
213 | |
} else { |
214 | 0 | this.delegationTypeCode = builder.getDelegationType().getCode(); |
215 | |
} |
216 | 0 | this.roleName = builder.getRoleName(); |
217 | 0 | this.qualifiedRoleName = builder.getQualifiedRoleName(); |
218 | 0 | this.qualifiedRoleNameLabel = builder.getQualifiedRoleNameLabel(); |
219 | 0 | this.routeNodeInstanceId = builder.getRouteNodeInstanceId(); |
220 | 0 | this.nodeName = builder.getNodeName(); |
221 | 0 | this.requestLabel = builder.getRequestLabel(); |
222 | 0 | this.parentActionRequestId = builder.getParentActionRequestId(); |
223 | 0 | ActionTaken.Builder actionTakenBuilder = builder.getActionTaken(); |
224 | 0 | if (actionTakenBuilder == null) { |
225 | 0 | this.actionTaken = null; |
226 | |
} else { |
227 | 0 | this.actionTaken = actionTakenBuilder.build(); |
228 | |
} |
229 | 0 | this.childRequests = new ArrayList<ActionRequest>(); |
230 | 0 | List<ActionRequest.Builder> childRequestBuilders = builder.getChildRequests(); |
231 | 0 | if (childRequestBuilders != null) { |
232 | 0 | for (ActionRequest.Builder childRequestBuilder : childRequestBuilders) { |
233 | 0 | this.childRequests.add(childRequestBuilder.build()); |
234 | |
} |
235 | |
} |
236 | 0 | } |
237 | |
|
238 | |
@Override |
239 | |
public String getAnnotation() { |
240 | 0 | return this.annotation; |
241 | |
} |
242 | |
|
243 | |
@Override |
244 | |
public int getPriority() { |
245 | 0 | return this.priority; |
246 | |
} |
247 | |
|
248 | |
@Override |
249 | |
public String getId() { |
250 | 0 | return this.id; |
251 | |
} |
252 | |
|
253 | |
@Override |
254 | |
public ActionRequestType getActionRequested() { |
255 | 0 | return ActionRequestType.fromCode(this.actionRequestedCode); |
256 | |
} |
257 | |
|
258 | |
@Override |
259 | |
public ActionRequestStatus getStatus() { |
260 | 0 | return ActionRequestStatus.fromCode(this.statusCode); |
261 | |
} |
262 | |
|
263 | |
@Override |
264 | |
public boolean isCurrent() { |
265 | 0 | return this.current; |
266 | |
} |
267 | |
|
268 | |
@Override |
269 | |
public DateTime getDateCreated() { |
270 | 0 | return this.dateCreated; |
271 | |
} |
272 | |
|
273 | |
@Override |
274 | |
public String getResponsibilityId() { |
275 | 0 | return this.responsibilityId; |
276 | |
} |
277 | |
|
278 | |
@Override |
279 | |
public String getDocumentId() { |
280 | 0 | return this.documentId; |
281 | |
} |
282 | |
|
283 | |
@Override |
284 | |
public RecipientType getRecipientType() { |
285 | 0 | return RecipientType.fromCode(this.recipientTypeCode); |
286 | |
} |
287 | |
|
288 | |
@Override |
289 | |
public String getPrincipalId() { |
290 | 0 | return this.principalId; |
291 | |
} |
292 | |
|
293 | |
@Override |
294 | |
public String getGroupId() { |
295 | 0 | return this.groupId; |
296 | |
} |
297 | |
|
298 | |
@Override |
299 | |
public ActionRequestPolicy getRequestPolicy() { |
300 | 0 | if (this.requestPolicyCode == null) { |
301 | 0 | return null; |
302 | |
} |
303 | 0 | return ActionRequestPolicy.fromCode(this.requestPolicyCode); |
304 | |
} |
305 | |
|
306 | |
@Override |
307 | |
public String getResponsibilityDescription() { |
308 | 0 | return this.responsibilityDescription; |
309 | |
} |
310 | |
|
311 | |
@Override |
312 | |
public boolean isForceAction() { |
313 | 0 | return this.forceAction; |
314 | |
} |
315 | |
|
316 | |
@Override |
317 | |
public DelegationType getDelegationType() { |
318 | 0 | if (this.delegationTypeCode == null) { |
319 | 0 | return null; |
320 | |
} |
321 | 0 | return DelegationType.fromCode(this.delegationTypeCode); |
322 | |
} |
323 | |
|
324 | |
@Override |
325 | |
public String getRoleName() { |
326 | 0 | return this.roleName; |
327 | |
} |
328 | |
|
329 | |
@Override |
330 | |
public String getQualifiedRoleName() { |
331 | 0 | return this.qualifiedRoleName; |
332 | |
} |
333 | |
|
334 | |
@Override |
335 | |
public String getQualifiedRoleNameLabel() { |
336 | 0 | return this.qualifiedRoleNameLabel; |
337 | |
} |
338 | |
|
339 | |
@Override |
340 | |
public String getRouteNodeInstanceId() { |
341 | 0 | return this.routeNodeInstanceId; |
342 | |
} |
343 | |
|
344 | |
@Override |
345 | |
public String getNodeName() { |
346 | 0 | return this.nodeName; |
347 | |
} |
348 | |
|
349 | |
@Override |
350 | |
public String getRequestLabel() { |
351 | 0 | return this.requestLabel; |
352 | |
} |
353 | |
|
354 | |
@Override |
355 | |
public String getParentActionRequestId() { |
356 | 0 | return this.parentActionRequestId; |
357 | |
} |
358 | |
|
359 | |
@Override |
360 | |
public ActionTaken getActionTaken() { |
361 | 0 | return this.actionTaken; |
362 | |
} |
363 | |
|
364 | |
@Override |
365 | |
public List<ActionRequest> getChildRequests() { |
366 | 0 | if (this.childRequests == null) { |
367 | 0 | return Collections.emptyList(); |
368 | |
} else { |
369 | 0 | return Collections.unmodifiableList(this.childRequests); |
370 | |
} |
371 | |
} |
372 | |
|
373 | |
public boolean isAdHocRequest() { |
374 | 0 | return KewApiConstants.ADHOC_REQUEST_RESPONSIBILITY_ID.equals(getResponsibilityId()); |
375 | |
} |
376 | |
|
377 | |
public boolean isGeneratedRequest() { |
378 | 0 | return KewApiConstants.MACHINE_GENERATED_RESPONSIBILITY_ID.equals(getResponsibilityId()); |
379 | |
} |
380 | |
|
381 | |
public boolean isExceptionRequest() { |
382 | 0 | return KewApiConstants.EXCEPTION_REQUEST_RESPONSIBILITY_ID.equals(getResponsibilityId()); |
383 | |
} |
384 | |
|
385 | |
public boolean isRouteModuleRequest() { |
386 | 0 | return getResponsibilityId() != null && Long.parseLong(getResponsibilityId()) > 0; |
387 | |
} |
388 | |
|
389 | |
public boolean isNotificationRequest() { |
390 | 0 | return isAcknowledgeRequest() || isFyiRequest(); |
391 | |
} |
392 | |
|
393 | |
public boolean isApprovalRequest() { |
394 | 0 | return ActionRequestType.APPROVE == getActionRequested() || ActionRequestType.COMPLETE == getActionRequested(); |
395 | |
} |
396 | |
|
397 | |
public boolean isAcknowledgeRequest() { |
398 | 0 | return ActionRequestType.ACKNOWLEDGE == getActionRequested(); |
399 | |
} |
400 | |
|
401 | |
public boolean isFyiRequest() { |
402 | 0 | return ActionRequestType.FYI == getActionRequested(); |
403 | |
} |
404 | |
|
405 | |
public boolean isPending() { |
406 | 0 | return isInitialized() || isActivated(); |
407 | |
} |
408 | |
|
409 | |
public boolean isCompleteRequest() { |
410 | 0 | return ActionRequestType.COMPLETE == getActionRequested(); |
411 | |
} |
412 | |
|
413 | |
public boolean isInitialized() { |
414 | 0 | return ActionRequestStatus.INITIALIZED == getStatus(); |
415 | |
} |
416 | |
|
417 | |
public boolean isActivated() { |
418 | 0 | return ActionRequestStatus.ACTIVATED == getStatus(); |
419 | |
} |
420 | |
|
421 | |
public boolean isDone() { |
422 | 0 | return ActionRequestStatus.DONE == getStatus(); |
423 | |
} |
424 | |
|
425 | |
public boolean isUserRequest() { |
426 | 0 | return RecipientType.PRINCIPAL == getRecipientType(); |
427 | |
} |
428 | |
|
429 | |
public boolean isGroupRequest() { |
430 | 0 | return RecipientType.GROUP == getRecipientType(); |
431 | |
} |
432 | |
|
433 | |
public boolean isRoleRequest() { |
434 | 0 | return RecipientType.ROLE == getRecipientType(); |
435 | |
} |
436 | |
|
437 | |
public List<ActionRequest> flatten() { |
438 | 0 | List<ActionRequest> flattenedRequests = new ArrayList<ActionRequest>(); |
439 | 0 | flattenedRequests.add(this); |
440 | 0 | for (ActionRequest childRequest : getChildRequests()) { |
441 | 0 | flattenedRequests.addAll(childRequest.flatten()); |
442 | |
} |
443 | 0 | return Collections.unmodifiableList(flattenedRequests); |
444 | |
} |
445 | |
|
446 | |
@Override |
447 | |
public int hashCode() { |
448 | 0 | return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
449 | |
} |
450 | |
|
451 | |
@Override |
452 | |
public boolean equals(Object object) { |
453 | 0 | return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE); |
454 | |
} |
455 | |
|
456 | |
@Override |
457 | |
public String toString() { |
458 | 0 | return ToStringBuilder.reflectionToString(this); |
459 | |
} |
460 | |
|
461 | |
|
462 | |
|
463 | |
|
464 | 0 | public final static class Builder implements Serializable, ModelBuilder, ActionRequestContract { |
465 | |
|
466 | |
private static final long serialVersionUID = -1354211147778354091L; |
467 | |
|
468 | |
private String id; |
469 | |
private ActionRequestType actionRequested; |
470 | |
private ActionRequestStatus status; |
471 | |
private boolean current; |
472 | |
private DateTime dateCreated; |
473 | |
private String responsibilityId; |
474 | |
private String documentId; |
475 | |
private int priority; |
476 | |
private String annotation; |
477 | |
private RecipientType recipientType; |
478 | |
private String principalId; |
479 | |
private String groupId; |
480 | |
private ActionRequestPolicy requestPolicy; |
481 | |
private String responsibilityDescription; |
482 | |
private boolean forceAction; |
483 | |
private DelegationType delegationType; |
484 | |
private String roleName; |
485 | |
private String qualifiedRoleName; |
486 | |
private String qualifiedRoleNameLabel; |
487 | |
private String routeNodeInstanceId; |
488 | |
private String nodeName; |
489 | |
private String requestLabel; |
490 | |
private String parentActionRequestId; |
491 | |
private ActionTaken.Builder actionTaken; |
492 | |
private List<ActionRequest.Builder> childRequests; |
493 | |
|
494 | 0 | private Builder(String id, ActionRequestType actionRequested, ActionRequestStatus status, String responsibilityId, String documentId, RecipientType recipientType) { |
495 | 0 | setId(id); |
496 | 0 | setActionRequested(actionRequested); |
497 | 0 | setStatus(status); |
498 | 0 | setResponsibilityId(responsibilityId); |
499 | 0 | setDocumentId(documentId); |
500 | 0 | setRecipientType(recipientType); |
501 | 0 | setCurrent(true); |
502 | 0 | setDateCreated(new DateTime()); |
503 | 0 | } |
504 | |
|
505 | |
public static Builder create(String id, ActionRequestType actionRequested, ActionRequestStatus status, String responsibilityId, String documentId, RecipientType recipientType) { |
506 | 0 | return new Builder(id, actionRequested, status, responsibilityId, documentId, recipientType); |
507 | |
} |
508 | |
|
509 | |
public static Builder create(ActionRequestContract contract) { |
510 | 0 | if (contract == null) { |
511 | 0 | throw new IllegalArgumentException("contract was null"); |
512 | |
} |
513 | |
|
514 | 0 | Builder builder = create(contract.getId(), contract.getActionRequested(), contract.getStatus(), contract.getResponsibilityId(), contract.getDocumentId(), contract.getRecipientType()); |
515 | 0 | builder.setCurrent(contract.isCurrent()); |
516 | 0 | builder.setDateCreated(contract.getDateCreated()); |
517 | 0 | builder.setPriority(contract.getPriority()); |
518 | 0 | builder.setAnnotation(contract.getAnnotation()); |
519 | 0 | builder.setPrincipalId(contract.getPrincipalId()); |
520 | 0 | builder.setGroupId(contract.getGroupId()); |
521 | 0 | builder.setRequestPolicy(contract.getRequestPolicy()); |
522 | 0 | builder.setResponsibilityDescription(contract.getResponsibilityDescription()); |
523 | 0 | builder.setForceAction(contract.isForceAction()); |
524 | 0 | builder.setDelegationType(contract.getDelegationType()); |
525 | 0 | builder.setRoleName(contract.getRoleName()); |
526 | 0 | builder.setQualifiedRoleName(contract.getQualifiedRoleName()); |
527 | 0 | builder.setQualifiedRoleNameLabel(contract.getQualifiedRoleNameLabel()); |
528 | 0 | builder.setNodeName(contract.getNodeName()); |
529 | 0 | builder.setRequestLabel(contract.getRequestLabel()); |
530 | 0 | builder.setParentActionRequestId(contract.getParentActionRequestId()); |
531 | 0 | if (contract.getActionTaken() != null) { |
532 | 0 | builder.setActionTaken(ActionTaken.Builder.create(contract.getActionTaken())); |
533 | |
} |
534 | 0 | List<ActionRequest.Builder> actionRequestBuilders = new ArrayList<ActionRequest.Builder>(); |
535 | 0 | for (ActionRequestContract actionRequest : contract.getChildRequests()) { |
536 | 0 | actionRequestBuilders.add(ActionRequest.Builder.create(actionRequest)); |
537 | |
} |
538 | 0 | builder.setChildRequests(actionRequestBuilders); |
539 | 0 | return builder; |
540 | |
} |
541 | |
|
542 | |
public ActionRequest build() { |
543 | 0 | return new ActionRequest(this); |
544 | |
} |
545 | |
|
546 | |
@Override |
547 | |
public String getId() { |
548 | 0 | return this.id; |
549 | |
} |
550 | |
|
551 | |
@Override |
552 | |
public ActionRequestType getActionRequested() { |
553 | 0 | return this.actionRequested; |
554 | |
} |
555 | |
|
556 | |
@Override |
557 | |
public ActionRequestStatus getStatus() { |
558 | 0 | return this.status; |
559 | |
} |
560 | |
|
561 | |
@Override |
562 | |
public boolean isCurrent() { |
563 | 0 | return this.current; |
564 | |
} |
565 | |
|
566 | |
@Override |
567 | |
public DateTime getDateCreated() { |
568 | 0 | return this.dateCreated; |
569 | |
} |
570 | |
|
571 | |
@Override |
572 | |
public String getResponsibilityId() { |
573 | 0 | return this.responsibilityId; |
574 | |
} |
575 | |
|
576 | |
@Override |
577 | |
public String getDocumentId() { |
578 | 0 | return this.documentId; |
579 | |
} |
580 | |
|
581 | |
@Override |
582 | |
public int getPriority() { |
583 | 0 | return this.priority; |
584 | |
} |
585 | |
|
586 | |
@Override |
587 | |
public String getAnnotation() { |
588 | 0 | return this.annotation; |
589 | |
} |
590 | |
|
591 | |
@Override |
592 | |
public RecipientType getRecipientType() { |
593 | 0 | return this.recipientType; |
594 | |
} |
595 | |
|
596 | |
@Override |
597 | |
public String getPrincipalId() { |
598 | 0 | return this.principalId; |
599 | |
} |
600 | |
|
601 | |
@Override |
602 | |
public String getGroupId() { |
603 | 0 | return this.groupId; |
604 | |
} |
605 | |
|
606 | |
@Override |
607 | |
public ActionRequestPolicy getRequestPolicy() { |
608 | 0 | return this.requestPolicy; |
609 | |
} |
610 | |
|
611 | |
@Override |
612 | |
public String getResponsibilityDescription() { |
613 | 0 | return this.responsibilityDescription; |
614 | |
} |
615 | |
|
616 | |
@Override |
617 | |
public boolean isForceAction() { |
618 | 0 | return this.forceAction; |
619 | |
} |
620 | |
|
621 | |
@Override |
622 | |
public DelegationType getDelegationType() { |
623 | 0 | return this.delegationType; |
624 | |
} |
625 | |
|
626 | |
@Override |
627 | |
public String getRoleName() { |
628 | 0 | return this.roleName; |
629 | |
} |
630 | |
|
631 | |
@Override |
632 | |
public String getQualifiedRoleName() { |
633 | 0 | return this.qualifiedRoleName; |
634 | |
} |
635 | |
|
636 | |
@Override |
637 | |
public String getQualifiedRoleNameLabel() { |
638 | 0 | return this.qualifiedRoleNameLabel; |
639 | |
} |
640 | |
|
641 | |
@Override |
642 | |
public String getRouteNodeInstanceId() { |
643 | 0 | return this.routeNodeInstanceId; |
644 | |
} |
645 | |
|
646 | |
@Override |
647 | |
public String getNodeName() { |
648 | 0 | return this.nodeName; |
649 | |
} |
650 | |
|
651 | |
@Override |
652 | |
public String getRequestLabel() { |
653 | 0 | return this.requestLabel; |
654 | |
} |
655 | |
|
656 | |
@Override |
657 | |
public String getParentActionRequestId() { |
658 | 0 | return this.parentActionRequestId; |
659 | |
} |
660 | |
|
661 | |
@Override |
662 | |
public ActionTaken.Builder getActionTaken() { |
663 | 0 | return this.actionTaken; |
664 | |
} |
665 | |
|
666 | |
@Override |
667 | |
public List<ActionRequest.Builder> getChildRequests() { |
668 | 0 | return this.childRequests; |
669 | |
} |
670 | |
|
671 | |
public void setId(String id) { |
672 | 0 | if (StringUtils.isBlank(id)) { |
673 | 0 | throw new IllegalArgumentException("id was null or blank"); |
674 | |
} |
675 | 0 | this.id = id; |
676 | 0 | } |
677 | |
|
678 | |
public void setActionRequested(ActionRequestType actionRequested) { |
679 | 0 | if (actionRequested == null) { |
680 | 0 | throw new IllegalArgumentException("actionRequested was null"); |
681 | |
} |
682 | 0 | this.actionRequested = actionRequested; |
683 | 0 | } |
684 | |
|
685 | |
public void setStatus(ActionRequestStatus status) { |
686 | 0 | if (status == null) { |
687 | 0 | throw new IllegalArgumentException("status was null"); |
688 | |
} |
689 | 0 | this.status = status; |
690 | 0 | } |
691 | |
|
692 | |
public void setCurrent(boolean current) { |
693 | 0 | this.current = current; |
694 | 0 | } |
695 | |
|
696 | |
public void setDateCreated(DateTime dateCreated) { |
697 | 0 | if (dateCreated == null) { |
698 | 0 | throw new IllegalArgumentException("dateCreated was null"); |
699 | |
} |
700 | 0 | this.dateCreated = dateCreated; |
701 | 0 | } |
702 | |
|
703 | |
public void setResponsibilityId(String responsibilityId) { |
704 | 0 | if (StringUtils.isBlank(responsibilityId)) { |
705 | 0 | throw new IllegalArgumentException("responsibilityId was null or blank"); |
706 | |
} |
707 | 0 | this.responsibilityId = responsibilityId; |
708 | 0 | } |
709 | |
|
710 | |
public void setDocumentId(String documentId) { |
711 | 0 | if (StringUtils.isBlank(documentId)) { |
712 | 0 | throw new IllegalArgumentException("documentId was null or blank"); |
713 | |
} |
714 | 0 | this.documentId = documentId; |
715 | 0 | } |
716 | |
|
717 | |
public void setPriority(int priority) { |
718 | 0 | this.priority = priority; |
719 | 0 | } |
720 | |
|
721 | |
public void setAnnotation(String annotation) { |
722 | 0 | this.annotation = annotation; |
723 | 0 | } |
724 | |
|
725 | |
public void setRecipientType(RecipientType recipientType) { |
726 | 0 | if (recipientType == null) { |
727 | 0 | throw new IllegalArgumentException("recipientType was null"); |
728 | |
} |
729 | 0 | this.recipientType = recipientType; |
730 | 0 | } |
731 | |
|
732 | |
public void setPrincipalId(String principalId) { |
733 | 0 | this.principalId = principalId; |
734 | 0 | } |
735 | |
|
736 | |
public void setGroupId(String groupId) { |
737 | 0 | this.groupId = groupId; |
738 | 0 | } |
739 | |
|
740 | |
public void setRequestPolicy(ActionRequestPolicy requestPolicy) { |
741 | 0 | this.requestPolicy = requestPolicy; |
742 | 0 | } |
743 | |
|
744 | |
public void setResponsibilityDescription(String responsibilityDescription) { |
745 | 0 | this.responsibilityDescription = responsibilityDescription; |
746 | 0 | } |
747 | |
|
748 | |
public void setForceAction(boolean forceAction) { |
749 | 0 | this.forceAction = forceAction; |
750 | 0 | } |
751 | |
|
752 | |
public void setDelegationType(DelegationType delegationType) { |
753 | 0 | this.delegationType = delegationType; |
754 | 0 | } |
755 | |
|
756 | |
public void setRoleName(String roleName) { |
757 | 0 | this.roleName = roleName; |
758 | 0 | } |
759 | |
|
760 | |
public void setQualifiedRoleName(String qualifiedRoleName) { |
761 | 0 | this.qualifiedRoleName = qualifiedRoleName; |
762 | 0 | } |
763 | |
|
764 | |
public void setQualifiedRoleNameLabel(String qualifiedRoleNameLabel) { |
765 | 0 | this.qualifiedRoleNameLabel = qualifiedRoleNameLabel; |
766 | 0 | } |
767 | |
|
768 | |
public void setRouteNodeInstanceId(String routeNodeInstanceId) { |
769 | 0 | this.routeNodeInstanceId = routeNodeInstanceId; |
770 | 0 | } |
771 | |
|
772 | |
public void setNodeName(String nodeName) { |
773 | 0 | this.nodeName = nodeName; |
774 | 0 | } |
775 | |
|
776 | |
public void setRequestLabel(String requestLabel) { |
777 | 0 | this.requestLabel = requestLabel; |
778 | 0 | } |
779 | |
|
780 | |
public void setParentActionRequestId(String parentActionRequestId) { |
781 | 0 | this.parentActionRequestId = parentActionRequestId; |
782 | 0 | } |
783 | |
|
784 | |
public void setActionTaken(ActionTaken.Builder actionTaken) { |
785 | 0 | this.actionTaken = actionTaken; |
786 | 0 | } |
787 | |
|
788 | |
public void setChildRequests(List<ActionRequest.Builder> childRequests) { |
789 | 0 | this.childRequests = childRequests; |
790 | 0 | } |
791 | |
|
792 | |
} |
793 | |
|
794 | |
|
795 | |
|
796 | |
|
797 | |
|
798 | |
|
799 | 0 | static class Constants { |
800 | |
final static String ROOT_ELEMENT_NAME = "actionRequest"; |
801 | |
final static String TYPE_NAME = "ActionRequestType"; |
802 | 0 | final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[] { CoreConstants.CommonElements.FUTURE_ELEMENTS }; |
803 | |
} |
804 | |
|
805 | |
|
806 | |
|
807 | |
|
808 | |
|
809 | |
|
810 | 0 | static class Elements { |
811 | |
final static String ANNOTATION = "annotation"; |
812 | |
final static String PRIORITY = "priority"; |
813 | |
final static String ID = "id"; |
814 | |
final static String ACTION_REQUESTED_CODE = "actionRequestedCode"; |
815 | |
final static String STATUS_CODE = "statusCode"; |
816 | |
final static String CURRENT = "current"; |
817 | |
final static String DATE_CREATED = "dateCreated"; |
818 | |
final static String RESPONSIBILITY_ID = "responsibilityId"; |
819 | |
final static String DOCUMENT_ID = "documentId"; |
820 | |
final static String RECIPIENT_TYPE_CODE = "recipientTypeCode"; |
821 | |
final static String PRINCIPAL_ID = "principalId"; |
822 | |
final static String GROUP_ID = "groupId"; |
823 | |
final static String REQUEST_POLICY_CODE = "requestPolicyCode"; |
824 | |
final static String RESPONSIBILITY_DESCRIPTION = "responsibilityDescription"; |
825 | |
final static String FORCE_ACTION = "forceAction"; |
826 | |
final static String DELEGATION_TYPE_CODE = "delegationTypeCode"; |
827 | |
final static String ROLE_NAME = "roleName"; |
828 | |
final static String QUALIFIED_ROLE_NAME = "qualifiedRoleName"; |
829 | |
final static String QUALIFIED_ROLE_NAME_LABEL = "qualifiedRoleNameLabel"; |
830 | |
final static String ROUTE_NODE_INSTANCE_ID = "routeNodeInstanceId"; |
831 | |
final static String NODE_NAME = "nodeName"; |
832 | |
final static String REQUEST_LABEL = "requestLabel"; |
833 | |
final static String PARENT_ACTION_REQUEST_ID = "parentActionRequestId"; |
834 | |
final static String ACTION_TAKEN = "actionTaken"; |
835 | |
final static String CHILD_REQUESTS = "childRequests"; |
836 | |
final static String CHILD_REQUEST = "childRequest"; |
837 | |
} |
838 | |
|
839 | |
} |
840 | |
|