| 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 org.apache.commons.lang.builder.EqualsBuilder; |
| 19 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
| 20 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
| 21 | |
import org.kuali.rice.core.api.CoreConstants; |
| 22 | |
import org.kuali.rice.core.api.criteria.QueryResults; |
| 23 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
| 24 | |
import org.kuali.rice.core.api.mo.ModelObjectComplete; |
| 25 | |
import org.w3c.dom.Element; |
| 26 | |
|
| 27 | |
import javax.xml.bind.annotation.XmlAccessType; |
| 28 | |
import javax.xml.bind.annotation.XmlAccessorType; |
| 29 | |
import javax.xml.bind.annotation.XmlAnyElement; |
| 30 | |
import javax.xml.bind.annotation.XmlElement; |
| 31 | |
import javax.xml.bind.annotation.XmlElementWrapper; |
| 32 | |
import javax.xml.bind.annotation.XmlRootElement; |
| 33 | |
import javax.xml.bind.annotation.XmlType; |
| 34 | |
import java.util.ArrayList; |
| 35 | |
import java.util.Collection; |
| 36 | |
import java.util.List; |
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
@XmlRootElement(name = ParameterQueryResults.Constants.ROOT_ELEMENT_NAME) |
| 42 | |
@XmlAccessorType(XmlAccessType.NONE) |
| 43 | |
@XmlType(name = ParameterQueryResults.Constants.TYPE_NAME, propOrder = { |
| 44 | |
ParameterQueryResults.Elements.RESULTS, |
| 45 | |
ParameterQueryResults.Elements.TOTAL_ROW_COUNT, |
| 46 | |
ParameterQueryResults.Elements.MORE_RESULTS_AVAILALBE, |
| 47 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS }) |
| 48 | 0 | public class ParameterQueryResults implements QueryResults<Parameter>, ModelObjectComplete { |
| 49 | |
|
| 50 | |
@XmlElementWrapper(name = Elements.RESULTS, required = false) |
| 51 | |
@XmlElement(name = Elements.PARAMETER, required = false) |
| 52 | |
private final List<Parameter> results; |
| 53 | |
|
| 54 | |
@XmlElement(name = Elements.TOTAL_ROW_COUNT, required = false) |
| 55 | |
private final Integer totalRowCount; |
| 56 | |
|
| 57 | |
@XmlElement(name = Elements.MORE_RESULTS_AVAILALBE, required = true) |
| 58 | |
private final boolean moreResultsAvailable; |
| 59 | |
|
| 60 | 0 | @SuppressWarnings("unused") |
| 61 | |
@XmlAnyElement |
| 62 | |
private final Collection<Element> _futureElements = null; |
| 63 | |
|
| 64 | 0 | private ParameterQueryResults() { |
| 65 | 0 | this.results = null; |
| 66 | 0 | this.totalRowCount = null; |
| 67 | 0 | this.moreResultsAvailable = false; |
| 68 | 0 | } |
| 69 | |
|
| 70 | 0 | private ParameterQueryResults(Builder builder) { |
| 71 | 0 | this.results = builder.getResults(); |
| 72 | 0 | this.totalRowCount = builder.getTotalRowCount(); |
| 73 | 0 | this.moreResultsAvailable = builder.isMoreResultsAvailable(); |
| 74 | 0 | } |
| 75 | |
|
| 76 | |
@Override |
| 77 | |
public List<Parameter> getResults() { |
| 78 | 0 | return results; |
| 79 | |
} |
| 80 | |
|
| 81 | |
@Override |
| 82 | |
public Integer getTotalRowCount() { |
| 83 | 0 | return totalRowCount; |
| 84 | |
} |
| 85 | |
|
| 86 | |
@Override |
| 87 | |
public boolean isMoreResultsAvailable() { |
| 88 | 0 | return moreResultsAvailable; |
| 89 | |
} |
| 90 | |
|
| 91 | |
@Override |
| 92 | |
public int hashCode() { |
| 93 | 0 | return HashCodeBuilder.reflectionHashCode(this); |
| 94 | |
} |
| 95 | |
|
| 96 | |
@Override |
| 97 | |
public boolean equals(Object obj) { |
| 98 | 0 | return EqualsBuilder.reflectionEquals(obj, this); |
| 99 | |
} |
| 100 | |
|
| 101 | |
@Override |
| 102 | |
public String toString() { |
| 103 | 0 | return ToStringBuilder.reflectionToString(this); |
| 104 | |
} |
| 105 | |
|
| 106 | 0 | public static class Builder implements ModelBuilder, QueryResults<Parameter> { |
| 107 | |
|
| 108 | |
private List<Parameter> results; |
| 109 | |
private Integer totalRowCount; |
| 110 | |
private boolean moreResultsAvailable; |
| 111 | |
|
| 112 | |
public static Builder create() { |
| 113 | 0 | return new Builder(); |
| 114 | |
} |
| 115 | |
|
| 116 | 0 | private Builder() { |
| 117 | 0 | this.results = new ArrayList<Parameter>(); |
| 118 | 0 | this.moreResultsAvailable = false; |
| 119 | 0 | } |
| 120 | |
|
| 121 | |
@Override |
| 122 | |
public ParameterQueryResults build() { |
| 123 | 0 | return new ParameterQueryResults(this); |
| 124 | |
} |
| 125 | |
|
| 126 | |
@Override |
| 127 | |
public List<Parameter> getResults() { |
| 128 | 0 | return this.results; |
| 129 | |
} |
| 130 | |
|
| 131 | |
public void setResults(List<Parameter> results) { |
| 132 | 0 | this.results = results; |
| 133 | 0 | } |
| 134 | |
|
| 135 | |
@Override |
| 136 | |
public Integer getTotalRowCount() { |
| 137 | 0 | return this.totalRowCount; |
| 138 | |
} |
| 139 | |
|
| 140 | |
public void setTotalRowCount(Integer totalRowCount) { |
| 141 | 0 | this.totalRowCount = totalRowCount; |
| 142 | 0 | } |
| 143 | |
|
| 144 | |
@Override |
| 145 | |
public boolean isMoreResultsAvailable() { |
| 146 | 0 | return this.moreResultsAvailable; |
| 147 | |
} |
| 148 | |
|
| 149 | |
public void setMoreResultsAvailable(boolean moreResultsAvailable) { |
| 150 | 0 | this.moreResultsAvailable = moreResultsAvailable; |
| 151 | 0 | } |
| 152 | |
|
| 153 | |
} |
| 154 | |
|
| 155 | |
|
| 156 | |
|
| 157 | |
|
| 158 | 0 | public static class Constants { |
| 159 | |
public final static String ROOT_ELEMENT_NAME = "parameterQueryResults"; |
| 160 | |
public final static String TYPE_NAME = "ParameterQueryResultsType"; |
| 161 | 0 | public final static String[] HASH_CODE_EQUALS_EXCLUDE = { CoreConstants.CommonElements.FUTURE_ELEMENTS }; |
| 162 | |
} |
| 163 | |
|
| 164 | |
|
| 165 | |
|
| 166 | |
|
| 167 | |
|
| 168 | 0 | public static class Elements { |
| 169 | |
public final static String RESULTS = "results"; |
| 170 | |
public final static String PARAMETER = "parameter"; |
| 171 | |
public final static String TOTAL_ROW_COUNT = "totalRowCount"; |
| 172 | |
public final static String MORE_RESULTS_AVAILALBE = "moreResultsAvailable"; |
| 173 | |
} |
| 174 | |
|
| 175 | |
} |