1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.api.document; |
17 | |
|
18 | |
import java.io.Serializable; |
19 | |
import java.util.ArrayList; |
20 | |
import java.util.Collection; |
21 | |
import java.util.List; |
22 | |
|
23 | |
import javax.xml.bind.annotation.XmlAccessType; |
24 | |
import javax.xml.bind.annotation.XmlAccessorType; |
25 | |
import javax.xml.bind.annotation.XmlAnyElement; |
26 | |
import javax.xml.bind.annotation.XmlElement; |
27 | |
import javax.xml.bind.annotation.XmlElementWrapper; |
28 | |
import javax.xml.bind.annotation.XmlRootElement; |
29 | |
import javax.xml.bind.annotation.XmlType; |
30 | |
|
31 | |
import org.kuali.rice.core.api.CoreConstants; |
32 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
33 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
34 | |
import org.kuali.rice.kew.api.action.ActionRequest; |
35 | |
import org.kuali.rice.kew.api.action.ActionTaken; |
36 | |
import org.kuali.rice.kew.api.document.node.RouteNodeInstance; |
37 | |
import org.w3c.dom.Element; |
38 | |
|
39 | |
@XmlRootElement(name = DocumentDetail.Constants.ROOT_ELEMENT_NAME) |
40 | |
@XmlAccessorType(XmlAccessType.NONE) |
41 | |
@XmlType(name = DocumentDetail.Constants.TYPE_NAME, propOrder = { |
42 | |
DocumentDetail.Elements.DOCUMENT, |
43 | |
DocumentDetail.Elements.ACTION_REQUESTS, |
44 | |
DocumentDetail.Elements.ACTIONS_TAKEN, |
45 | |
DocumentDetail.Elements.ROUTE_NODE_INSTANCES, |
46 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
47 | |
}) |
48 | 0 | public final class DocumentDetail extends AbstractDataTransferObject implements DocumentDetailContract { |
49 | |
|
50 | |
private static final long serialVersionUID = -8569515693892958719L; |
51 | |
|
52 | |
@XmlElement(name = Elements.DOCUMENT, required = true) |
53 | |
private final Document document; |
54 | |
|
55 | |
@XmlElementWrapper(name = Elements.ACTION_REQUESTS, required = true) |
56 | |
@XmlElement(name = Elements.ACTION_REQUEST, required = false) |
57 | |
private final List<ActionRequest> actionRequests; |
58 | |
|
59 | |
@XmlElementWrapper(name = Elements.ACTIONS_TAKEN, required = true) |
60 | |
@XmlElement(name = Elements.ACTION_TAKEN, required = false) |
61 | |
private final List<ActionTaken> actionsTaken; |
62 | |
|
63 | |
@XmlElementWrapper(name = Elements.ROUTE_NODE_INSTANCES, required = true) |
64 | |
@XmlElement(name = Elements.ROUTE_NODE_INSTANCES, required = true) |
65 | |
private final List<RouteNodeInstance> routeNodeInstances; |
66 | |
|
67 | 0 | @SuppressWarnings("unused") |
68 | |
@XmlAnyElement |
69 | |
private final Collection<Element> _futureElements = null; |
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | 0 | private DocumentDetail() { |
75 | 0 | this.document = null; |
76 | 0 | this.actionRequests = null; |
77 | 0 | this.actionsTaken = null; |
78 | 0 | this.routeNodeInstances = null; |
79 | 0 | } |
80 | |
|
81 | 0 | private DocumentDetail(Builder builder) { |
82 | 0 | this.document = builder.getDocument(); |
83 | 0 | this.actionRequests = builder.getActionRequests(); |
84 | 0 | this.actionsTaken = builder.getActionsTaken(); |
85 | 0 | this.routeNodeInstances = builder.getRouteNodeInstances(); |
86 | 0 | } |
87 | |
|
88 | |
@Override |
89 | |
public Document getDocument() { |
90 | 0 | return this.document; |
91 | |
} |
92 | |
|
93 | |
@Override |
94 | |
public List<ActionRequest> getActionRequests() { |
95 | 0 | return this.actionRequests; |
96 | |
} |
97 | |
|
98 | |
@Override |
99 | |
public List<ActionTaken> getActionsTaken() { |
100 | 0 | return this.actionsTaken; |
101 | |
} |
102 | |
|
103 | |
@Override |
104 | |
public List<RouteNodeInstance> getRouteNodeInstances() { |
105 | 0 | return this.routeNodeInstances; |
106 | |
} |
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
|
112 | 0 | public final static class Builder implements Serializable, ModelBuilder, DocumentDetailContract { |
113 | |
|
114 | |
private static final long serialVersionUID = 3108177943363491329L; |
115 | |
|
116 | |
private Document document; |
117 | |
private List<ActionRequest> actionRequests; |
118 | |
private List<ActionTaken> actionsTaken; |
119 | |
private List<RouteNodeInstance> routeNodeInstances; |
120 | |
|
121 | 0 | private Builder() { |
122 | |
|
123 | 0 | } |
124 | |
|
125 | |
public static Builder create(Document document) { |
126 | 0 | Builder builder = new Builder(); |
127 | 0 | builder.setDocument(document); |
128 | 0 | builder.setActionRequests(new ArrayList<ActionRequest>()); |
129 | 0 | builder.setActionsTaken(new ArrayList<ActionTaken>()); |
130 | 0 | builder.setRouteNodeInstances(new ArrayList<RouteNodeInstance>()); |
131 | 0 | return builder; |
132 | |
} |
133 | |
|
134 | |
public static Builder create(DocumentDetailContract contract) { |
135 | 0 | if (contract == null) { |
136 | 0 | throw new IllegalArgumentException("contract was null"); |
137 | |
} |
138 | 0 | Builder builder = create(contract.getDocument()); |
139 | 0 | builder.setActionRequests(contract.getActionRequests()); |
140 | 0 | builder.setActionsTaken(contract.getActionsTaken()); |
141 | 0 | builder.setRouteNodeInstances(contract.getRouteNodeInstances()); |
142 | 0 | return builder; |
143 | |
} |
144 | |
|
145 | |
public DocumentDetail build() { |
146 | 0 | return new DocumentDetail(this); |
147 | |
} |
148 | |
|
149 | |
@Override |
150 | |
public Document getDocument() { |
151 | 0 | return this.document; |
152 | |
} |
153 | |
|
154 | |
@Override |
155 | |
public List<ActionRequest> getActionRequests() { |
156 | 0 | return this.actionRequests; |
157 | |
} |
158 | |
|
159 | |
@Override |
160 | |
public List<ActionTaken> getActionsTaken() { |
161 | 0 | return this.actionsTaken; |
162 | |
} |
163 | |
|
164 | |
@Override |
165 | |
public List<RouteNodeInstance> getRouteNodeInstances() { |
166 | 0 | return this.routeNodeInstances; |
167 | |
} |
168 | |
|
169 | |
public void setDocument(Document document) { |
170 | 0 | if (document == null) { |
171 | 0 | throw new IllegalArgumentException("document was null"); |
172 | |
} |
173 | 0 | this.document = document; |
174 | 0 | } |
175 | |
|
176 | |
public void setActionRequests(List<ActionRequest> actionRequests) { |
177 | 0 | if (actionRequests == null) { |
178 | 0 | throw new IllegalArgumentException("actionRequests was null"); |
179 | |
} |
180 | 0 | this.actionRequests = actionRequests; |
181 | 0 | } |
182 | |
|
183 | |
public void setActionsTaken(List<ActionTaken> actionsTaken) { |
184 | 0 | if (actionsTaken == null) { |
185 | 0 | throw new IllegalArgumentException("actionsTaken was null"); |
186 | |
} |
187 | 0 | this.actionsTaken = actionsTaken; |
188 | 0 | } |
189 | |
|
190 | |
public void setRouteNodeInstances(List<RouteNodeInstance> routeNodeInstances) { |
191 | 0 | if (routeNodeInstances == null) { |
192 | 0 | throw new IllegalArgumentException("routeNodeInstances was null"); |
193 | |
} |
194 | 0 | this.routeNodeInstances = routeNodeInstances; |
195 | 0 | } |
196 | |
|
197 | |
} |
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | 0 | static class Constants { |
203 | |
final static String ROOT_ELEMENT_NAME = "documentDetail"; |
204 | |
final static String TYPE_NAME = "DocumentDetailType"; |
205 | |
} |
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | 0 | static class Elements { |
211 | |
final static String DOCUMENT = "document"; |
212 | |
final static String ACTION_REQUESTS = "actionRequests"; |
213 | |
final static String ACTION_REQUEST = "actionRequest"; |
214 | |
final static String ACTIONS_TAKEN = "actionsTaken"; |
215 | |
final static String ACTION_TAKEN = "actionTaken"; |
216 | |
final static String ROUTE_NODE_INSTANCES = "routeNodeInstances"; |
217 | |
final static String ROUTE_NODE_INSTANCE = "routeNodeInstance"; |
218 | |
} |
219 | |
|
220 | |
} |
221 | |
|