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.util.Collection;
19
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.kuali.rice.core.api.CoreConstants;
28 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
29 import org.kuali.rice.kew.api.document.Document;
30 import org.w3c.dom.Element;
31
32 @XmlRootElement(name = DocumentActionResult.Constants.ROOT_ELEMENT_NAME)
33 @XmlAccessorType(XmlAccessType.NONE)
34 @XmlType(name = DocumentActionResult.Constants.TYPE_NAME, propOrder = {
35 DocumentActionResult.Elements.DOCUMENT,
36 DocumentActionResult.Elements.VALID_ACTIONS,
37 DocumentActionResult.Elements.REQUESTED_ACTIONS,
38 CoreConstants.CommonElements.FUTURE_ELEMENTS
39 })
40 public final class DocumentActionResult extends AbstractDataTransferObject {
41
42 private static final long serialVersionUID = -3916503634900791018L;
43
44 @XmlElement(name = Elements.DOCUMENT, required = true)
45 private final Document document;
46
47 @XmlElement(name = Elements.VALID_ACTIONS, required = false)
48 private final ValidActions validActions;
49
50 @XmlElement(name = Elements.REQUESTED_ACTIONS, required = false)
51 private final RequestedActions requestedActions;
52
53 @SuppressWarnings("unused")
54 @XmlAnyElement
55 private final Collection<Element> _futureElements = null;
56
57 private DocumentActionResult() {
58 this.document = null;
59 this.validActions = null;
60 this.requestedActions = null;
61 }
62
63 private DocumentActionResult(Document document, ValidActions validActions, RequestedActions requestedActions) {
64 if (document == null) {
65 throw new IllegalArgumentException("document was null");
66 }
67 this.document = document;
68 this.validActions = validActions;
69 this.requestedActions = requestedActions;
70 }
71
72 public static DocumentActionResult create(Document document, ValidActions validActions, RequestedActions requestedActions) {
73 return new DocumentActionResult(document, validActions, requestedActions);
74 }
75
76 public Document getDocument() {
77 return document;
78 }
79
80 public ValidActions getValidActions() {
81 return validActions;
82 }
83
84 public RequestedActions getRequestedActions() {
85 return requestedActions;
86 }
87
88
89
90
91 static class Constants {
92 final static String ROOT_ELEMENT_NAME = "documentActionResult";
93 final static String TYPE_NAME = "DocumentActionResultType";
94 }
95
96
97
98
99 static class Elements {
100 final static String DOCUMENT = "document";
101 final static String VALID_ACTIONS = "validActions";
102 final static String REQUESTED_ACTIONS = "requestedActions";
103 }
104
105 }