1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.framework.document.search; |
17 | |
|
18 | |
import org.apache.commons.collections.CollectionUtils; |
19 | |
import org.kuali.rice.core.api.CoreConstants; |
20 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
21 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
22 | |
import org.kuali.rice.core.api.mo.ModelObjectUtils; |
23 | |
import org.w3c.dom.Element; |
24 | |
|
25 | |
import javax.xml.bind.annotation.XmlAccessType; |
26 | |
import javax.xml.bind.annotation.XmlAccessorType; |
27 | |
import javax.xml.bind.annotation.XmlAnyElement; |
28 | |
import javax.xml.bind.annotation.XmlElement; |
29 | |
import javax.xml.bind.annotation.XmlElementWrapper; |
30 | |
import javax.xml.bind.annotation.XmlRootElement; |
31 | |
import javax.xml.bind.annotation.XmlType; |
32 | |
import java.io.Serializable; |
33 | |
import java.util.ArrayList; |
34 | |
import java.util.Collection; |
35 | |
import java.util.List; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
@XmlRootElement(name = DocumentSearchResultValues.Constants.ROOT_ELEMENT_NAME) |
44 | |
@XmlAccessorType(XmlAccessType.NONE) |
45 | |
@XmlType(name = DocumentSearchResultValues.Constants.TYPE_NAME, propOrder = { |
46 | |
DocumentSearchResultValues.Elements.RESULT_VALUES, |
47 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
48 | |
}) |
49 | 0 | public final class DocumentSearchResultValues extends AbstractDataTransferObject implements DocumentSearchResultValuesContract { |
50 | |
|
51 | |
@XmlElementWrapper(name = Elements.RESULT_VALUES, required = false) |
52 | |
@XmlElement(name = Elements.RESULT_VALUE, required = false) |
53 | |
private final List<DocumentSearchResultValue> resultValues; |
54 | |
|
55 | 0 | @SuppressWarnings("unused") |
56 | |
@XmlAnyElement |
57 | |
private final Collection<Element> _futureElements = null; |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
@SuppressWarnings("unused") |
63 | 0 | private DocumentSearchResultValues() { |
64 | 0 | this.resultValues = null; |
65 | 0 | } |
66 | |
|
67 | 0 | private DocumentSearchResultValues(Builder builder) { |
68 | 0 | this.resultValues = ModelObjectUtils.buildImmutableCopy(builder.getResultValues()); |
69 | 0 | } |
70 | |
|
71 | |
@Override |
72 | |
public List<DocumentSearchResultValue> getResultValues() { |
73 | 0 | return this.resultValues; |
74 | |
} |
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | 0 | public final static class Builder implements Serializable, ModelBuilder, DocumentSearchResultValuesContract { |
81 | |
|
82 | |
private List<DocumentSearchResultValue.Builder> resultValues; |
83 | |
|
84 | 0 | private Builder() { |
85 | 0 | setResultValues(new ArrayList<DocumentSearchResultValue.Builder>()); |
86 | 0 | } |
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
public static Builder create() { |
95 | 0 | return new Builder(); |
96 | |
} |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
public static Builder create(DocumentSearchResultValuesContract contract) { |
108 | 0 | if (contract == null) { |
109 | 0 | throw new IllegalArgumentException("contract was null"); |
110 | |
} |
111 | 0 | Builder builder = create(); |
112 | 0 | if (!CollectionUtils.isEmpty(contract.getResultValues())) { |
113 | 0 | for (DocumentSearchResultValueContract resultValueContract : contract.getResultValues()) { |
114 | |
|
115 | |
} |
116 | |
} |
117 | 0 | return builder; |
118 | |
} |
119 | |
|
120 | |
@Override |
121 | |
public DocumentSearchResultValues build() { |
122 | 0 | return new DocumentSearchResultValues(this); |
123 | |
} |
124 | |
|
125 | |
@Override |
126 | |
public List<DocumentSearchResultValue.Builder> getResultValues() { |
127 | 0 | return this.resultValues; |
128 | |
} |
129 | |
|
130 | |
public void setResultValues(List<DocumentSearchResultValue.Builder> resultValues) { |
131 | 0 | this.resultValues = resultValues; |
132 | 0 | } |
133 | |
|
134 | |
} |
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | 0 | static class Constants { |
140 | |
final static String ROOT_ELEMENT_NAME = "documentSearchResultValues"; |
141 | |
final static String TYPE_NAME = "DocumentSearchResultValuesType"; |
142 | |
} |
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | 0 | static class Elements { |
148 | |
final static String RESULT_VALUES = "resultValues"; |
149 | |
final static String RESULT_VALUE = "resultValue"; |
150 | |
} |
151 | |
|
152 | |
} |