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.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 | |
import org.joda.time.DateTime; |
27 | |
import org.kuali.rice.core.api.CoreConstants; |
28 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
29 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
30 | |
import org.w3c.dom.Element; |
31 | |
|
32 | |
@XmlRootElement(name = DocumentStatusTransition.Constants.ROOT_ELEMENT_NAME) |
33 | |
@XmlAccessorType(XmlAccessType.NONE) |
34 | |
@XmlType(name = DocumentStatusTransition.Constants.TYPE_NAME, propOrder = { |
35 | |
DocumentStatusTransition.Elements.ID, |
36 | |
DocumentStatusTransition.Elements.DOCUMENT_ID, |
37 | |
DocumentStatusTransition.Elements.OLD_APP_DOC_STATUS, |
38 | |
DocumentStatusTransition.Elements.NEW_APP_DOC_STATUS, |
39 | |
DocumentStatusTransition.Elements.STATUS_TRANSITION_DATE, |
40 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
41 | |
}) |
42 | 0 | public final class DocumentStatusTransition |
43 | |
extends AbstractDataTransferObject |
44 | |
implements DocumentStatusTransitionContract |
45 | |
{ |
46 | |
|
47 | |
@XmlElement(name = Elements.ID, required = false) |
48 | |
private final String id; |
49 | |
@XmlElement(name = Elements.DOCUMENT_ID, required = false) |
50 | |
private final String documentId; |
51 | |
@XmlElement(name = Elements.OLD_APP_DOC_STATUS, required = false) |
52 | |
private final String oldStatus; |
53 | |
@XmlElement(name = Elements.NEW_APP_DOC_STATUS, required = false) |
54 | |
private final String newStatus; |
55 | |
@XmlElement(name = Elements.STATUS_TRANSITION_DATE, required = false) |
56 | |
private final DateTime statusTransitionDate; |
57 | 0 | @SuppressWarnings("unused") |
58 | |
@XmlAnyElement |
59 | |
private final Collection<Element> _futureElements = null; |
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | 0 | private DocumentStatusTransition() { |
66 | 0 | this.id = null; |
67 | 0 | this.documentId = null; |
68 | 0 | this.oldStatus = null; |
69 | 0 | this.newStatus = null; |
70 | 0 | this.statusTransitionDate = null; |
71 | 0 | } |
72 | |
|
73 | 0 | private DocumentStatusTransition(Builder builder) { |
74 | 0 | this.id = builder.getId(); |
75 | 0 | this.documentId = builder.getDocumentId(); |
76 | 0 | this.oldStatus = builder.getOldStatus(); |
77 | 0 | this.newStatus = builder.getNewStatus(); |
78 | 0 | this.statusTransitionDate = builder.getStatusTransitionDate(); |
79 | 0 | } |
80 | |
|
81 | |
@Override |
82 | |
public String getId() { |
83 | 0 | return this.id; |
84 | |
} |
85 | |
|
86 | |
@Override |
87 | |
public String getDocumentId() { |
88 | 0 | return this.documentId; |
89 | |
} |
90 | |
|
91 | |
@Override |
92 | |
public String getOldStatus() { |
93 | 0 | return this.oldStatus; |
94 | |
} |
95 | |
|
96 | |
@Override |
97 | |
public String getNewStatus() { |
98 | 0 | return this.newStatus; |
99 | |
} |
100 | |
|
101 | |
@Override |
102 | |
public DateTime getStatusTransitionDate() { |
103 | 0 | return this.statusTransitionDate; |
104 | |
} |
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | 0 | public final static class Builder |
112 | |
implements Serializable, ModelBuilder, DocumentStatusTransitionContract |
113 | |
{ |
114 | |
|
115 | |
private String id; |
116 | |
private String documentId; |
117 | |
private String oldStatus; |
118 | |
private String newStatus; |
119 | |
private DateTime statusTransitionDate; |
120 | |
|
121 | 0 | private Builder(String documentId, String oldStatus, String newStatus) { |
122 | 0 | setDocumentId(documentId); |
123 | 0 | setOldStatus(oldStatus); |
124 | 0 | setNewStatus(newStatus); |
125 | 0 | } |
126 | |
|
127 | |
public static Builder create(String documentId, String oldStatus, String newStatus) { |
128 | 0 | return new Builder(documentId, oldStatus, newStatus); |
129 | |
} |
130 | |
|
131 | |
public static Builder create(DocumentStatusTransitionContract contract) { |
132 | 0 | if (contract == null) { |
133 | 0 | throw new IllegalArgumentException("contract was null"); |
134 | |
} |
135 | 0 | Builder builder = create(contract.getDocumentId(), contract.getOldStatus(), contract.getNewStatus()); |
136 | 0 | builder.setId(contract.getId()); |
137 | 0 | builder.setStatusTransitionDate(contract.getStatusTransitionDate()); |
138 | 0 | return builder; |
139 | |
} |
140 | |
|
141 | |
public DocumentStatusTransition build() { |
142 | 0 | return new DocumentStatusTransition(this); |
143 | |
} |
144 | |
|
145 | |
@Override |
146 | |
public String getId() { |
147 | 0 | return this.id; |
148 | |
} |
149 | |
|
150 | |
@Override |
151 | |
public String getDocumentId() { |
152 | 0 | return this.documentId; |
153 | |
} |
154 | |
|
155 | |
@Override |
156 | |
public String getOldStatus() { |
157 | 0 | return this.oldStatus; |
158 | |
} |
159 | |
|
160 | |
@Override |
161 | |
public String getNewStatus() { |
162 | 0 | return this.newStatus; |
163 | |
} |
164 | |
|
165 | |
@Override |
166 | |
public DateTime getStatusTransitionDate() { |
167 | 0 | return this.statusTransitionDate; |
168 | |
} |
169 | |
|
170 | |
public void setId(String id) { |
171 | |
|
172 | 0 | this.id = id; |
173 | 0 | } |
174 | |
|
175 | |
public void setDocumentId(String documentId) { |
176 | |
|
177 | 0 | this.documentId = documentId; |
178 | 0 | } |
179 | |
|
180 | |
public void setOldStatus(String oldStatus) { |
181 | |
|
182 | 0 | this.oldStatus = oldStatus; |
183 | 0 | } |
184 | |
|
185 | |
public void setNewStatus(String newStatus) { |
186 | |
|
187 | 0 | this.newStatus = newStatus; |
188 | 0 | } |
189 | |
|
190 | |
public void setStatusTransitionDate(DateTime statusTransitionDate) { |
191 | |
|
192 | 0 | this.statusTransitionDate = statusTransitionDate; |
193 | 0 | } |
194 | |
|
195 | |
} |
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | 0 | static class Constants { |
203 | |
|
204 | |
final static String ROOT_ELEMENT_NAME = "documentStatusTransition"; |
205 | |
final static String TYPE_NAME = "DocumentStatusTransitionType"; |
206 | |
|
207 | |
} |
208 | |
|
209 | |
|
210 | |
|
211 | |
|
212 | |
|
213 | |
|
214 | 0 | static class Elements { |
215 | |
|
216 | |
final static String ID = "id"; |
217 | |
final static String DOCUMENT_ID = "documentId"; |
218 | |
final static String OLD_APP_DOC_STATUS = "oldStatus"; |
219 | |
final static String NEW_APP_DOC_STATUS = "newStatus"; |
220 | |
final static String STATUS_TRANSITION_DATE = "statusTransitionDate"; |
221 | |
|
222 | |
} |
223 | |
|
224 | |
} |