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.Collection; |
20 | |
import javax.xml.bind.annotation.XmlAccessType; |
21 | |
import javax.xml.bind.annotation.XmlAccessorType; |
22 | |
import javax.xml.bind.annotation.XmlAnyElement; |
23 | |
import javax.xml.bind.annotation.XmlElement; |
24 | |
import javax.xml.bind.annotation.XmlRootElement; |
25 | |
import javax.xml.bind.annotation.XmlType; |
26 | |
|
27 | |
import org.apache.commons.lang.StringUtils; |
28 | |
import org.joda.time.DateTime; |
29 | |
import org.kuali.rice.core.api.CoreConstants; |
30 | |
import org.kuali.rice.core.api.delegation.DelegationType; |
31 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
32 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
33 | |
import org.w3c.dom.Element; |
34 | |
|
35 | |
@XmlRootElement(name = ActionItem.Constants.ROOT_ELEMENT_NAME) |
36 | |
@XmlAccessorType(XmlAccessType.NONE) |
37 | |
@XmlType(name = ActionItem.Constants.TYPE_NAME, propOrder = { |
38 | |
ActionItem.Elements.ID, |
39 | |
ActionItem.Elements.DATE_TIME_ASSIGNED, |
40 | |
ActionItem.Elements.ACTION_REQUEST_CD, |
41 | |
ActionItem.Elements.ACTION_REQUEST_ID, |
42 | |
ActionItem.Elements.DOCUMENT_ID, |
43 | |
ActionItem.Elements.DOC_TITLE, |
44 | |
ActionItem.Elements.DOC_LABEL, |
45 | |
ActionItem.Elements.DOC_HANDLER_U_R_L, |
46 | |
ActionItem.Elements.DOC_NAME, |
47 | |
ActionItem.Elements.RESPONSIBILITY_ID, |
48 | |
ActionItem.Elements.ROLE_NAME, |
49 | |
ActionItem.Elements.DATE_ASSIGNED_STRING, |
50 | |
ActionItem.Elements.ACTION_TO_TAKE, |
51 | |
ActionItem.Elements.DELEGATION_TYPE, |
52 | |
ActionItem.Elements.ACTION_ITEM_INDEX, |
53 | |
ActionItem.Elements.GROUP_ID, |
54 | |
ActionItem.Elements.PRINCIPAL_ID, |
55 | |
ActionItem.Elements.DELEGATOR_GROUP_ID, |
56 | |
ActionItem.Elements.DELEGATOR_PRINCIPAL_ID, |
57 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
58 | |
}) |
59 | 0 | public final class ActionItem |
60 | |
extends AbstractDataTransferObject |
61 | |
implements ActionItemContract |
62 | |
{ |
63 | |
|
64 | |
@XmlElement(name = Elements.ID, required = false) |
65 | |
private final String id; |
66 | |
@XmlElement(name = Elements.DATE_TIME_ASSIGNED, required = true) |
67 | |
private final DateTime dateTimeAssigned; |
68 | |
@XmlElement(name = Elements.ACTION_REQUEST_CD, required = true) |
69 | |
private final String actionRequestCd; |
70 | |
@XmlElement(name = Elements.ACTION_REQUEST_ID, required = true) |
71 | |
private final String actionRequestId; |
72 | |
@XmlElement(name = Elements.DOCUMENT_ID, required = true) |
73 | |
private final String documentId; |
74 | |
@XmlElement(name = Elements.DOC_TITLE, required = false) |
75 | |
private final String docTitle; |
76 | |
@XmlElement(name = Elements.DOC_LABEL, required = true) |
77 | |
private final String docLabel; |
78 | |
@XmlElement(name = Elements.DOC_HANDLER_U_R_L, required = true) |
79 | |
private final String docHandlerURL; |
80 | |
@XmlElement(name = Elements.DOC_NAME, required = true) |
81 | |
private final String docName; |
82 | |
@XmlElement(name = Elements.RESPONSIBILITY_ID, required = true) |
83 | |
private final String responsibilityId; |
84 | |
@XmlElement(name = Elements.ROLE_NAME, required = false) |
85 | |
private final String roleName; |
86 | |
@XmlElement(name = Elements.DATE_ASSIGNED_STRING, required = false) |
87 | |
private final String dateAssignedString; |
88 | |
@XmlElement(name = Elements.ACTION_TO_TAKE, required = false) |
89 | |
private final String actionToTake; |
90 | |
@XmlElement(name = Elements.DELEGATION_TYPE, required = false) |
91 | |
private final String delegationType; |
92 | |
@XmlElement(name = Elements.ACTION_ITEM_INDEX, required = false) |
93 | |
private final Integer actionItemIndex; |
94 | |
@XmlElement(name = Elements.GROUP_ID, required = false) |
95 | |
private final String groupId; |
96 | |
@XmlElement(name = Elements.PRINCIPAL_ID, required = true) |
97 | |
private final String principalId; |
98 | |
@XmlElement(name = Elements.DELEGATOR_GROUP_ID, required = false) |
99 | |
private final String delegatorGroupId; |
100 | |
@XmlElement(name = Elements.DELEGATOR_PRINCIPAL_ID, required = false) |
101 | |
private final String delegatorPrincipalId; |
102 | 0 | @SuppressWarnings("unused") |
103 | |
@XmlAnyElement |
104 | |
private final Collection<Element> _futureElements = null; |
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | 0 | private ActionItem() { |
111 | 0 | this.id = null; |
112 | 0 | this.dateTimeAssigned = null; |
113 | 0 | this.actionRequestCd = null; |
114 | 0 | this.actionRequestId = null; |
115 | 0 | this.documentId = null; |
116 | 0 | this.docTitle = null; |
117 | 0 | this.docLabel = null; |
118 | 0 | this.docHandlerURL = null; |
119 | 0 | this.docName = null; |
120 | 0 | this.responsibilityId = null; |
121 | 0 | this.roleName = null; |
122 | 0 | this.dateAssignedString = null; |
123 | 0 | this.actionToTake = null; |
124 | 0 | this.delegationType = null; |
125 | 0 | this.actionItemIndex = null; |
126 | 0 | this.groupId = null; |
127 | 0 | this.principalId = null; |
128 | 0 | this.delegatorGroupId = null; |
129 | 0 | this.delegatorPrincipalId = null; |
130 | 0 | } |
131 | |
|
132 | 0 | private ActionItem(Builder builder) { |
133 | 0 | this.id = builder.getId(); |
134 | 0 | this.dateTimeAssigned = builder.getDateTimeAssigned(); |
135 | 0 | this.actionRequestCd = builder.getActionRequestCd(); |
136 | 0 | this.actionRequestId = builder.getActionRequestId(); |
137 | 0 | this.documentId = builder.getDocumentId(); |
138 | 0 | this.docTitle = builder.getDocTitle(); |
139 | 0 | this.docLabel = builder.getDocLabel(); |
140 | 0 | this.docHandlerURL = builder.getDocHandlerURL(); |
141 | 0 | this.docName = builder.getDocName(); |
142 | 0 | this.responsibilityId = builder.getResponsibilityId(); |
143 | 0 | this.roleName = builder.getRoleName(); |
144 | 0 | this.dateAssignedString = builder.getDateAssignedString(); |
145 | 0 | this.actionToTake = builder.getActionToTake(); |
146 | 0 | this.delegationType = builder.getDelegationType() != null ? builder.getDelegationType().getCode() : null; |
147 | 0 | this.actionItemIndex = builder.getActionItemIndex(); |
148 | 0 | this.groupId = builder.getGroupId(); |
149 | 0 | this.principalId = builder.getPrincipalId(); |
150 | 0 | this.delegatorGroupId = builder.getDelegatorGroupId(); |
151 | 0 | this.delegatorPrincipalId = builder.getDelegatorPrincipalId(); |
152 | 0 | } |
153 | |
|
154 | |
@Override |
155 | |
public String getId() { |
156 | 0 | return this.id; |
157 | |
} |
158 | |
|
159 | |
@Override |
160 | |
public DateTime getDateTimeAssigned() { |
161 | 0 | return this.dateTimeAssigned; |
162 | |
} |
163 | |
|
164 | |
@Override |
165 | |
public String getActionRequestCd() { |
166 | 0 | return this.actionRequestCd; |
167 | |
} |
168 | |
|
169 | |
@Override |
170 | |
public String getActionRequestId() { |
171 | 0 | return this.actionRequestId; |
172 | |
} |
173 | |
|
174 | |
@Override |
175 | |
public String getDocumentId() { |
176 | 0 | return this.documentId; |
177 | |
} |
178 | |
|
179 | |
@Override |
180 | |
public String getDocTitle() { |
181 | 0 | return this.docTitle; |
182 | |
} |
183 | |
|
184 | |
@Override |
185 | |
public String getDocLabel() { |
186 | 0 | return this.docLabel; |
187 | |
} |
188 | |
|
189 | |
@Override |
190 | |
public String getDocHandlerURL() { |
191 | 0 | return this.docHandlerURL; |
192 | |
} |
193 | |
|
194 | |
@Override |
195 | |
public String getDocName() { |
196 | 0 | return this.docName; |
197 | |
} |
198 | |
|
199 | |
@Override |
200 | |
public String getResponsibilityId() { |
201 | 0 | return this.responsibilityId; |
202 | |
} |
203 | |
|
204 | |
@Override |
205 | |
public String getRoleName() { |
206 | 0 | return this.roleName; |
207 | |
} |
208 | |
|
209 | |
@Override |
210 | |
public String getDateAssignedString() { |
211 | 0 | return this.dateAssignedString; |
212 | |
} |
213 | |
|
214 | |
@Override |
215 | |
public String getActionToTake() { |
216 | 0 | return this.actionToTake; |
217 | |
} |
218 | |
|
219 | |
@Override |
220 | |
public DelegationType getDelegationType() { |
221 | 0 | return DelegationType.fromCode(this.delegationType); |
222 | |
} |
223 | |
|
224 | |
@Override |
225 | |
public Integer getActionItemIndex() { |
226 | 0 | return this.actionItemIndex; |
227 | |
} |
228 | |
|
229 | |
@Override |
230 | |
public String getGroupId() { |
231 | 0 | return this.groupId; |
232 | |
} |
233 | |
|
234 | |
@Override |
235 | |
public String getPrincipalId() { |
236 | 0 | return this.principalId; |
237 | |
} |
238 | |
|
239 | |
@Override |
240 | |
public String getDelegatorGroupId() { |
241 | 0 | return this.delegatorGroupId; |
242 | |
} |
243 | |
|
244 | |
@Override |
245 | |
public String getDelegatorPrincipalId() { |
246 | 0 | return this.delegatorPrincipalId; |
247 | |
} |
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
|
253 | |
|
254 | 0 | public final static class Builder |
255 | |
implements Serializable, ModelBuilder, ActionItemContract |
256 | |
{ |
257 | |
|
258 | |
private String id; |
259 | |
private DateTime dateTimeAssigned; |
260 | |
private String actionRequestCd; |
261 | |
private String actionRequestId; |
262 | |
private String documentId; |
263 | |
private String docTitle; |
264 | |
private String docLabel; |
265 | |
private String docHandlerURL; |
266 | |
private String docName; |
267 | |
private String responsibilityId; |
268 | |
private String roleName; |
269 | |
private String dateAssignedString; |
270 | |
private String actionToTake; |
271 | |
private DelegationType delegationType; |
272 | |
private Integer actionItemIndex; |
273 | |
private String groupId; |
274 | |
private String principalId; |
275 | |
private String delegatorGroupId; |
276 | |
private String delegatorPrincipalId; |
277 | |
|
278 | |
private Builder(String documentId, String actionRequestCd, String actionRequestId, |
279 | |
DateTime dateTimeAssigned, String docLabel, String docHanderlURL, |
280 | 0 | String docName, String responsibilityId, String principalId) { |
281 | 0 | setDocumentId(documentId); |
282 | 0 | setActionRequestCd(actionRequestCd); |
283 | 0 | setActionRequestId(actionRequestId); |
284 | 0 | setDateTimeAssigned(dateTimeAssigned); |
285 | 0 | setDocLabel(docLabel); |
286 | 0 | setDocHandlerURL(docHanderlURL); |
287 | 0 | setDocName(docName); |
288 | 0 | setResponsibilityId(responsibilityId); |
289 | 0 | setPrincipalId(principalId); |
290 | 0 | } |
291 | |
|
292 | |
public static Builder create(String documentId, String actionRequestCd, String actionRequestId, |
293 | |
DateTime dateTimeAssigned, String docLabel, String docHanderlURL, |
294 | |
String docName, String responsibilityId, String principalId) { |
295 | 0 | return new Builder(documentId, actionRequestCd, actionRequestId, dateTimeAssigned, docLabel, |
296 | |
docHanderlURL, docName, responsibilityId, principalId); |
297 | |
} |
298 | |
|
299 | |
public static Builder create(ActionItemContract contract) { |
300 | 0 | if (contract == null) { |
301 | 0 | throw new IllegalArgumentException("contract was null"); |
302 | |
} |
303 | 0 | Builder builder = create(contract.getDocumentId(), contract.getActionRequestCd(), contract.getActionRequestId(), |
304 | |
contract.getDateTimeAssigned(), contract.getDocLabel(), contract.getDocHandlerURL(), contract.getDocName(), |
305 | |
contract.getResponsibilityId(), contract.getPrincipalId()); |
306 | 0 | builder.setId(contract.getId()); |
307 | 0 | builder.setRoleName(contract.getRoleName()); |
308 | 0 | builder.setDocTitle(contract.getDocTitle()); |
309 | 0 | builder.setDateAssignedString(contract.getDateAssignedString()); |
310 | 0 | builder.setActionToTake(contract.getActionToTake()); |
311 | 0 | builder.setDelegationType(contract.getDelegationType()); |
312 | 0 | builder.setActionItemIndex(contract.getActionItemIndex()); |
313 | 0 | builder.setGroupId(contract.getGroupId()); |
314 | 0 | builder.setPrincipalId(contract.getPrincipalId()); |
315 | 0 | builder.setDelegatorGroupId(contract.getDelegatorGroupId()); |
316 | 0 | builder.setDelegatorPrincipalId(contract.getDelegatorPrincipalId()); |
317 | 0 | return builder; |
318 | |
} |
319 | |
|
320 | |
public ActionItem build() { |
321 | 0 | return new ActionItem(this); |
322 | |
} |
323 | |
|
324 | |
@Override |
325 | |
public String getId() { |
326 | 0 | return this.id; |
327 | |
} |
328 | |
|
329 | |
@Override |
330 | |
public DateTime getDateTimeAssigned() { |
331 | 0 | return this.dateTimeAssigned; |
332 | |
} |
333 | |
|
334 | |
@Override |
335 | |
public String getActionRequestCd() { |
336 | 0 | return this.actionRequestCd; |
337 | |
} |
338 | |
|
339 | |
@Override |
340 | |
public String getActionRequestId() { |
341 | 0 | return this.actionRequestId; |
342 | |
} |
343 | |
|
344 | |
@Override |
345 | |
public String getDocumentId() { |
346 | 0 | return this.documentId; |
347 | |
} |
348 | |
|
349 | |
@Override |
350 | |
public String getDocTitle() { |
351 | 0 | return this.docTitle; |
352 | |
} |
353 | |
|
354 | |
@Override |
355 | |
public String getDocLabel() { |
356 | 0 | return this.docLabel; |
357 | |
} |
358 | |
|
359 | |
@Override |
360 | |
public String getDocHandlerURL() { |
361 | 0 | return this.docHandlerURL; |
362 | |
} |
363 | |
|
364 | |
@Override |
365 | |
public String getDocName() { |
366 | 0 | return this.docName; |
367 | |
} |
368 | |
|
369 | |
@Override |
370 | |
public String getResponsibilityId() { |
371 | 0 | return this.responsibilityId; |
372 | |
} |
373 | |
|
374 | |
@Override |
375 | |
public String getRoleName() { |
376 | 0 | return this.roleName; |
377 | |
} |
378 | |
|
379 | |
@Override |
380 | |
public String getDateAssignedString() { |
381 | 0 | return this.dateAssignedString; |
382 | |
} |
383 | |
|
384 | |
@Override |
385 | |
public String getActionToTake() { |
386 | 0 | return this.actionToTake; |
387 | |
} |
388 | |
|
389 | |
@Override |
390 | |
public DelegationType getDelegationType() { |
391 | 0 | return this.delegationType; |
392 | |
} |
393 | |
|
394 | |
@Override |
395 | |
public Integer getActionItemIndex() { |
396 | 0 | return this.actionItemIndex; |
397 | |
} |
398 | |
|
399 | |
@Override |
400 | |
public String getGroupId() { |
401 | 0 | return this.groupId; |
402 | |
} |
403 | |
|
404 | |
@Override |
405 | |
public String getPrincipalId() { |
406 | 0 | return this.principalId; |
407 | |
} |
408 | |
|
409 | |
@Override |
410 | |
public String getDelegatorGroupId() { |
411 | 0 | return this.delegatorGroupId; |
412 | |
} |
413 | |
|
414 | |
@Override |
415 | |
public String getDelegatorPrincipalId() { |
416 | 0 | return this.delegatorPrincipalId; |
417 | |
} |
418 | |
|
419 | |
public void setId(String id) { |
420 | 0 | if (StringUtils.isWhitespace(id)) { |
421 | 0 | throw new IllegalArgumentException("id is blank"); |
422 | |
} |
423 | 0 | this.id = id; |
424 | 0 | } |
425 | |
|
426 | |
public void setDateTimeAssigned(DateTime dateTimeAssigned) { |
427 | 0 | if (dateTimeAssigned == null) { |
428 | 0 | throw new IllegalArgumentException("dateTimeAssigned is null"); |
429 | |
} |
430 | 0 | this.dateTimeAssigned = dateTimeAssigned; |
431 | 0 | } |
432 | |
|
433 | |
public void setActionRequestCd(String actionRequestCd) { |
434 | 0 | if (StringUtils.isBlank(actionRequestCd)) { |
435 | 0 | throw new IllegalArgumentException("actionRequestCd is blank"); |
436 | |
} |
437 | 0 | this.actionRequestCd = actionRequestCd; |
438 | 0 | } |
439 | |
|
440 | |
public void setActionRequestId(String actionRequestId) { |
441 | 0 | if (StringUtils.isBlank(actionRequestId)) { |
442 | 0 | throw new IllegalArgumentException("actionRequestId is blank"); |
443 | |
} |
444 | 0 | this.actionRequestId = actionRequestId; |
445 | 0 | } |
446 | |
|
447 | |
public void setDocumentId(String documentId) { |
448 | 0 | if (StringUtils.isBlank(documentId)) { |
449 | 0 | throw new IllegalArgumentException("documentId is blank"); |
450 | |
} |
451 | 0 | this.documentId = documentId; |
452 | 0 | } |
453 | |
|
454 | |
public void setDocTitle(String docTitle) { |
455 | 0 | this.docTitle = docTitle; |
456 | 0 | } |
457 | |
|
458 | |
public void setDocLabel(String docLabel) { |
459 | 0 | if (StringUtils.isBlank(docLabel)) { |
460 | 0 | throw new IllegalArgumentException("docLabel is blank"); |
461 | |
} |
462 | 0 | this.docLabel = docLabel; |
463 | 0 | } |
464 | |
|
465 | |
public void setDocHandlerURL(String docHandlerURL) { |
466 | 0 | if (StringUtils.isBlank(docHandlerURL)) { |
467 | 0 | throw new IllegalArgumentException("docHandlerURL is blank"); |
468 | |
} |
469 | 0 | this.docHandlerURL = docHandlerURL; |
470 | 0 | } |
471 | |
|
472 | |
public void setDocName(String docName) { |
473 | 0 | if (StringUtils.isBlank(docName)) { |
474 | 0 | throw new IllegalArgumentException("docName is blank"); |
475 | |
} |
476 | 0 | this.docName = docName; |
477 | 0 | } |
478 | |
|
479 | |
public void setResponsibilityId(String responsibilityId) { |
480 | 0 | if (StringUtils.isBlank(responsibilityId)) { |
481 | 0 | throw new IllegalArgumentException("responsibilityId is blank"); |
482 | |
} |
483 | 0 | this.responsibilityId = responsibilityId; |
484 | 0 | } |
485 | |
|
486 | |
public void setRoleName(String roleName) { |
487 | 0 | this.roleName = roleName; |
488 | 0 | } |
489 | |
|
490 | |
public void setDateAssignedString(String dateAssignedString) { |
491 | 0 | this.dateAssignedString = dateAssignedString; |
492 | 0 | } |
493 | |
|
494 | |
public void setActionToTake(String actionToTake) { |
495 | 0 | this.actionToTake = actionToTake; |
496 | 0 | } |
497 | |
|
498 | |
public void setDelegationType(DelegationType delegationType) { |
499 | 0 | this.delegationType = delegationType; |
500 | 0 | } |
501 | |
|
502 | |
public void setActionItemIndex(Integer actionItemIndex) { |
503 | 0 | this.actionItemIndex = actionItemIndex; |
504 | 0 | } |
505 | |
|
506 | |
public void setGroupId(String groupId) { |
507 | 0 | this.groupId = groupId; |
508 | 0 | } |
509 | |
|
510 | |
public void setPrincipalId(String principalId) { |
511 | 0 | if (StringUtils.isBlank(principalId)) { |
512 | 0 | throw new IllegalArgumentException("principalId is blank"); |
513 | |
} |
514 | 0 | this.principalId = principalId; |
515 | 0 | } |
516 | |
|
517 | |
public void setDelegatorGroupId(String delegatorGroupId) { |
518 | 0 | this.delegatorGroupId = delegatorGroupId; |
519 | 0 | } |
520 | |
|
521 | |
public void setDelegatorPrincipalId(String delegatorPrincipalId) { |
522 | 0 | this.delegatorPrincipalId = delegatorPrincipalId; |
523 | 0 | } |
524 | |
|
525 | |
} |
526 | |
|
527 | |
|
528 | |
|
529 | |
|
530 | |
|
531 | |
|
532 | 0 | static class Constants { |
533 | |
|
534 | |
final static String ROOT_ELEMENT_NAME = "actionItem"; |
535 | |
final static String TYPE_NAME = "ActionItemType"; |
536 | |
|
537 | |
} |
538 | |
|
539 | |
|
540 | |
|
541 | |
|
542 | |
|
543 | |
|
544 | 0 | static class Elements { |
545 | |
|
546 | |
final static String ID = "id"; |
547 | |
final static String DATE_TIME_ASSIGNED = "dateTimeAssigned"; |
548 | |
final static String ACTION_REQUEST_CD = "actionRequestCd"; |
549 | |
final static String ACTION_REQUEST_ID = "actionRequestId"; |
550 | |
final static String DOCUMENT_ID = "documentId"; |
551 | |
final static String DOC_TITLE = "docTitle"; |
552 | |
final static String DOC_LABEL = "docLabel"; |
553 | |
final static String DOC_HANDLER_U_R_L = "docHandlerURL"; |
554 | |
final static String DOC_NAME = "docName"; |
555 | |
final static String RESPONSIBILITY_ID = "responsibilityId"; |
556 | |
final static String ROLE_NAME = "roleName"; |
557 | |
final static String DATE_ASSIGNED_STRING = "dateAssignedString"; |
558 | |
final static String ACTION_TO_TAKE = "actionToTake"; |
559 | |
final static String DELEGATION_TYPE = "delegationType"; |
560 | |
final static String ACTION_ITEM_INDEX = "actionItemIndex"; |
561 | |
final static String GROUP_ID = "groupId"; |
562 | |
final static String PRINCIPAL_ID = "principalId"; |
563 | |
final static String DELEGATOR_GROUP_ID = "delegatorGroupId"; |
564 | |
final static String DELEGATOR_PRINCIPAL_ID = "delegatorPrincipalId"; |
565 | |
|
566 | |
} |
567 | |
|
568 | |
} |