1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.api.parameter; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.Collection; |
20 | |
import java.util.List; |
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.XmlElementWrapper; |
27 | |
import javax.xml.bind.annotation.XmlRootElement; |
28 | |
import javax.xml.bind.annotation.XmlType; |
29 | |
|
30 | |
import org.kuali.rice.core.api.CoreConstants; |
31 | |
import org.kuali.rice.core.api.criteria.CountAwareQueryResults; |
32 | |
import org.w3c.dom.Element; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
@XmlRootElement(name = ParameterQueryResults.Constants.ROOT_ELEMENT_NAME) |
41 | |
@XmlAccessorType(XmlAccessType.NONE) |
42 | |
@XmlType(name = ParameterQueryResults.Constants.TYPE_NAME, propOrder = { |
43 | |
ParameterQueryResults.Elements.RESULTS, |
44 | |
ParameterQueryResults.Elements.TOTAL_ROW_COUNT, |
45 | |
ParameterQueryResults.Elements.MORE_RESULTS_AVAILALBE, |
46 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS }) |
47 | 0 | public class ParameterQueryResults implements CountAwareQueryResults<Parameter> { |
48 | |
|
49 | |
@XmlElementWrapper(name = Elements.RESULTS, required = false) |
50 | |
@XmlElement(name = Elements.PARAMETER, required = false) |
51 | |
private final List<Parameter> results; |
52 | |
|
53 | |
@XmlElement(name = Elements.TOTAL_ROW_COUNT, required = false) |
54 | |
private final Integer totalRowCount; |
55 | |
|
56 | |
@XmlElement(name = Elements.MORE_RESULTS_AVAILALBE, required = true) |
57 | |
private final boolean moreResultsAvailable; |
58 | |
|
59 | 0 | @SuppressWarnings("unused") |
60 | |
@XmlAnyElement |
61 | |
private final Collection<Element> _futureElements = null; |
62 | |
|
63 | 0 | private ParameterQueryResults() { |
64 | 0 | this.results = null; |
65 | 0 | this.totalRowCount = null; |
66 | 0 | this.moreResultsAvailable = false; |
67 | 0 | } |
68 | |
|
69 | 0 | private ParameterQueryResults(Builder builder) { |
70 | 0 | this.results = builder.getResults(); |
71 | 0 | this.totalRowCount = builder.getTotalRowCount(); |
72 | 0 | this.moreResultsAvailable = builder.isMoreResultsAvailable(); |
73 | 0 | } |
74 | |
|
75 | |
@Override |
76 | |
public List<Parameter> getResults() { |
77 | 0 | return results; |
78 | |
} |
79 | |
|
80 | |
@Override |
81 | |
public Integer getTotalRowCount() { |
82 | 0 | return totalRowCount; |
83 | |
} |
84 | |
|
85 | |
@Override |
86 | |
public boolean isMoreResultsAvailable() { |
87 | 0 | return moreResultsAvailable; |
88 | |
} |
89 | |
|
90 | |
public static class Builder { |
91 | |
|
92 | |
private List<Parameter> results; |
93 | |
private Integer totalRowCount; |
94 | |
private boolean moreResultsAvailable; |
95 | |
|
96 | 0 | private Builder() { |
97 | 0 | this.results = new ArrayList<Parameter>(); |
98 | 0 | this.moreResultsAvailable = false; |
99 | 0 | } |
100 | |
|
101 | |
public ParameterQueryResults build() { |
102 | 0 | return new ParameterQueryResults(this); |
103 | |
} |
104 | |
|
105 | |
public List<Parameter> getResults() { |
106 | 0 | return this.results; |
107 | |
} |
108 | |
|
109 | |
public void setResults(List<Parameter> results) { |
110 | 0 | this.results = results; |
111 | 0 | } |
112 | |
|
113 | |
public Integer getTotalRowCount() { |
114 | 0 | return this.totalRowCount; |
115 | |
} |
116 | |
|
117 | |
public void setTotalRowCount(Integer totalRowCount) { |
118 | 0 | this.totalRowCount = totalRowCount; |
119 | 0 | } |
120 | |
|
121 | |
public boolean isMoreResultsAvailable() { |
122 | 0 | return this.moreResultsAvailable; |
123 | |
} |
124 | |
|
125 | |
public void setMoreResultsAvailable(boolean moreResultsAvailable) { |
126 | 0 | this.moreResultsAvailable = moreResultsAvailable; |
127 | 0 | } |
128 | |
|
129 | |
} |
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | 0 | public static class Constants { |
135 | |
public final static String ROOT_ELEMENT_NAME = "parameterQueryResults"; |
136 | |
public final static String TYPE_NAME = "ParameterQueryResultsType"; |
137 | 0 | public final static String[] HASH_CODE_EQUALS_EXCLUDE = { CoreConstants.CommonElements.FUTURE_ELEMENTS }; |
138 | |
} |
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | 0 | public static class Elements { |
145 | |
public final static String RESULTS = "results"; |
146 | |
public final static String PARAMETER = "parameter"; |
147 | |
public final static String TOTAL_ROW_COUNT = "totalRowCount"; |
148 | |
public final static String MORE_RESULTS_AVAILALBE = "moreResultsAvailable"; |
149 | |
} |
150 | |
|
151 | |
} |