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.Collections;
22 import java.util.List;
23
24 import javax.xml.bind.annotation.XmlAccessType;
25 import javax.xml.bind.annotation.XmlAccessorType;
26 import javax.xml.bind.annotation.XmlAnyElement;
27 import javax.xml.bind.annotation.XmlElement;
28 import javax.xml.bind.annotation.XmlElementWrapper;
29 import javax.xml.bind.annotation.XmlRootElement;
30 import javax.xml.bind.annotation.XmlType;
31
32 import org.kuali.rice.core.api.CoreConstants;
33 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
34 import org.kuali.rice.core.api.mo.ModelBuilder;
35 import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
36 import org.w3c.dom.Element;
37
38
39
40
41
42
43
44
45
46
47
48
49
50 @XmlRootElement(name = DocumentContentUpdate.Constants.ROOT_ELEMENT_NAME)
51 @XmlAccessorType(XmlAccessType.NONE)
52 @XmlType(name = DocumentContentUpdate.Constants.TYPE_NAME, propOrder = {
53 DocumentContentUpdate.Elements.APPLICATION_CONTENT,
54 DocumentContentUpdate.Elements.ATTRIBUTE_CONTENT,
55 DocumentContentUpdate.Elements.SEARCHABLE_CONTENT,
56 DocumentContentUpdate.Elements.ATTRIBUTE_DEFINITIONS,
57 DocumentContentUpdate.Elements.SEARCHABLE_DEFINITIONS,
58 CoreConstants.CommonElements.FUTURE_ELEMENTS
59 })
60 public final class DocumentContentUpdate extends AbstractDataTransferObject {
61
62 private static final long serialVersionUID = -7386661044232391889L;
63
64 @XmlElement(name = Elements.APPLICATION_CONTENT, required = false)
65 private final String applicationContent;
66
67 @XmlElement(name = Elements.ATTRIBUTE_CONTENT, required = false)
68 private final String attributeContent;
69
70 @XmlElement(name = Elements.SEARCHABLE_CONTENT, required = false)
71 private final String searchableContent;
72
73 @XmlElementWrapper(name = Elements.ATTRIBUTE_DEFINITIONS, required = false)
74 @XmlElement(name = Elements.ATTRIBUTE_DEFINITION, required = false)
75 private List<WorkflowAttributeDefinition> attributeDefinitions;
76
77 @XmlElementWrapper(name = Elements.SEARCHABLE_DEFINITIONS, required = false)
78 @XmlElement(name = Elements.SEARCHABLE_DEFINITION, required = false)
79 private List<WorkflowAttributeDefinition> searchableDefinitions;
80
81 @SuppressWarnings("unused")
82 @XmlAnyElement
83 private final Collection<Element> _futureElements = null;
84
85
86
87
88 private DocumentContentUpdate() {
89 this.applicationContent = null;
90 this.attributeContent = null;
91 this.searchableContent = null;
92 this.attributeDefinitions = null;
93 this.searchableDefinitions = null;
94 }
95
96 private DocumentContentUpdate(Builder builder) {
97 this.applicationContent = builder.getApplicationContent();
98 this.attributeContent = builder.getAttributeContent();
99 this.searchableContent = builder.getSearchableContent();
100 if (builder.getAttributeDefinitions() != null) {
101 this.attributeDefinitions = new ArrayList<WorkflowAttributeDefinition>(builder.getAttributeDefinitions());
102 } else {
103 this.attributeDefinitions = new ArrayList<WorkflowAttributeDefinition>();
104 }
105 if (builder.getSearchableDefinitions() != null) {
106 this.searchableDefinitions = new ArrayList<WorkflowAttributeDefinition>(builder.getSearchableDefinitions());
107 } else {
108 this.searchableDefinitions = new ArrayList<WorkflowAttributeDefinition>();
109 }
110 }
111
112 public String getApplicationContent() {
113 return applicationContent;
114 }
115
116 public String getAttributeContent() {
117 return attributeContent;
118 }
119
120 public String getSearchableContent() {
121 return searchableContent;
122 }
123
124 public List<WorkflowAttributeDefinition> getAttributeDefinitions() {
125 return Collections.unmodifiableList(attributeDefinitions);
126 }
127
128 public List<WorkflowAttributeDefinition> getSearchableDefinitions() {
129 return Collections.unmodifiableList(searchableDefinitions);
130 }
131
132
133
134
135 public final static class Builder implements Serializable, ModelBuilder {
136
137 private static final long serialVersionUID = -1680695196516508680L;
138
139 private String attributeContent;
140 private String applicationContent;
141 private String searchableContent;
142 private List<WorkflowAttributeDefinition> attributeDefinitions;
143 private List<WorkflowAttributeDefinition> searchableDefinitions;
144
145 private Builder() {
146 this.attributeContent = "";
147 this.applicationContent = "";
148 this.searchableContent = "";
149 this.attributeDefinitions = new ArrayList<WorkflowAttributeDefinition>();
150 this.searchableDefinitions = new ArrayList<WorkflowAttributeDefinition>();
151 }
152
153 public static Builder create() {
154 return new Builder();
155 }
156
157 public static Builder create(DocumentContent documentContent) {
158 if (documentContent == null) {
159 throw new IllegalArgumentException("documentContent was null");
160 }
161 Builder builder = create();
162 builder.setAttributeContent(documentContent.getAttributeContent());
163 builder.setApplicationContent(documentContent.getApplicationContent());
164 builder.setSearchableContent(documentContent.getSearchableContent());
165 return builder;
166 }
167
168 public static Builder create(DocumentContentUpdate documentContentUpdate) {
169 if (documentContentUpdate == null) {
170 throw new IllegalArgumentException("documentContentUpdate was null");
171 }
172 Builder builder = create();
173 builder.setAttributeContent(documentContentUpdate.getAttributeContent());
174 builder.setApplicationContent(documentContentUpdate.getApplicationContent());
175 builder.setSearchableContent(documentContentUpdate.getSearchableContent());
176 builder.setAttributeDefinitions(documentContentUpdate.getAttributeDefinitions());
177 builder.setSearchableDefinitions(documentContentUpdate.getSearchableDefinitions());
178 return builder;
179 }
180
181 public DocumentContentUpdate build() {
182 return new DocumentContentUpdate(this);
183 }
184
185 public String getAttributeContent() {
186 return attributeContent;
187 }
188
189 public void setAttributeContent(String attributeContent) {
190 this.attributeContent = attributeContent;
191 }
192
193 public String getApplicationContent() {
194 return applicationContent;
195 }
196
197 public void setApplicationContent(String applicationContent) {
198 this.applicationContent = applicationContent;
199 }
200
201 public String getSearchableContent() {
202 return searchableContent;
203 }
204
205 public void setSearchableContent(String searchableContent) {
206 this.searchableContent = searchableContent;
207 }
208
209 public List<WorkflowAttributeDefinition> getAttributeDefinitions() {
210 return attributeDefinitions;
211 }
212
213 public void setAttributeDefinitions(List<WorkflowAttributeDefinition> attributeDefinitions) {
214 this.attributeDefinitions = attributeDefinitions;
215 }
216
217 public List<WorkflowAttributeDefinition> getSearchableDefinitions() {
218 return searchableDefinitions;
219 }
220
221 public void setSearchableDefinitions(List<WorkflowAttributeDefinition> searchableDefinitions) {
222 this.searchableDefinitions = searchableDefinitions;
223 }
224
225 }
226
227
228
229
230 static class Constants {
231 final static String ROOT_ELEMENT_NAME = "documentContentUpdate";
232 final static String TYPE_NAME = "DocumentContentUpdateType";
233 }
234
235
236
237
238 static class Elements {
239 final static String APPLICATION_CONTENT = "applicationContent";
240 final static String ATTRIBUTE_CONTENT = "attributeContent";
241 final static String SEARCHABLE_CONTENT = "searchableContent";
242 final static String ATTRIBUTE_DEFINITION = "attributeDefinition";
243 final static String ATTRIBUTE_DEFINITIONS = "attributeDefinitions";
244 final static String SEARCHABLE_DEFINITION = "searchableDefinition";
245 final static String SEARCHABLE_DEFINITIONS = "searchableDefinitions";
246 }
247
248 }