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 org.kuali.rice.core.api.CoreConstants; |
19 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
20 | |
import org.w3c.dom.Element; |
21 | |
|
22 | |
import javax.xml.bind.annotation.XmlAccessType; |
23 | |
import javax.xml.bind.annotation.XmlAccessorType; |
24 | |
import javax.xml.bind.annotation.XmlAnyElement; |
25 | |
import javax.xml.bind.annotation.XmlElement; |
26 | |
import javax.xml.bind.annotation.XmlRootElement; |
27 | |
import javax.xml.bind.annotation.XmlType; |
28 | |
import java.util.Collection; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
@XmlRootElement(name = DocumentWithContent.Constants.ROOT_ELEMENT_NAME) |
37 | |
@XmlAccessorType(XmlAccessType.NONE) |
38 | |
@XmlType(name = DocumentWithContent.Constants.TYPE_NAME, propOrder = { |
39 | |
DocumentWithContent.Elements.DOCUMENT, |
40 | |
DocumentWithContent.Elements.DOCUMENT_CONTENT, |
41 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
42 | |
}) |
43 | |
public final class DocumentWithContent extends AbstractDataTransferObject implements DocumentWithContentContract { |
44 | |
|
45 | |
@XmlElement(name = Elements.DOCUMENT, required = true) |
46 | |
private final Document document; |
47 | |
|
48 | |
@XmlElement(name = Elements.DOCUMENT_CONTENT, required = true) |
49 | |
private final DocumentContent documentContent; |
50 | |
|
51 | 0 | @SuppressWarnings("unused") |
52 | |
@XmlAnyElement |
53 | |
private final Collection<Element> _futureElements = null; |
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | 0 | private DocumentWithContent() { |
59 | 0 | this.document = null; |
60 | 0 | this.documentContent = null; |
61 | 0 | } |
62 | |
|
63 | 0 | private DocumentWithContent(Document document, DocumentContent documentContent) { |
64 | 0 | if (document == null) { |
65 | 0 | throw new IllegalArgumentException("document was null"); |
66 | |
} |
67 | 0 | if (documentContent == null) { |
68 | 0 | throw new IllegalArgumentException("documentContent was null"); |
69 | |
} |
70 | 0 | this.document = document; |
71 | 0 | this.documentContent = documentContent; |
72 | 0 | } |
73 | |
|
74 | |
public static DocumentWithContent create(Document document, DocumentContent documentContent) { |
75 | 0 | return new DocumentWithContent(document, documentContent); |
76 | |
} |
77 | |
|
78 | |
@Override |
79 | |
public Document getDocument() { |
80 | 0 | return this.document; |
81 | |
} |
82 | |
|
83 | |
@Override |
84 | |
public DocumentContent getDocumentContent() { |
85 | 0 | return this.documentContent; |
86 | |
} |
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | 0 | static class Constants { |
92 | |
final static String ROOT_ELEMENT_NAME = "documentWithContent"; |
93 | |
final static String TYPE_NAME = "DocumentWithContentType"; |
94 | |
} |
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | 0 | static class Elements { |
100 | |
final static String DOCUMENT = "document"; |
101 | |
final static String DOCUMENT_CONTENT = "documentContent"; |
102 | |
} |
103 | |
|
104 | |
} |