| 1 | |
package org.kuali.rice.core.api.uif; |
| 2 | |
|
| 3 | |
import java.io.Serializable; |
| 4 | |
import java.util.Collection; |
| 5 | |
import javax.xml.bind.annotation.XmlAccessType; |
| 6 | |
import javax.xml.bind.annotation.XmlAccessorType; |
| 7 | |
import javax.xml.bind.annotation.XmlAnyElement; |
| 8 | |
import javax.xml.bind.annotation.XmlElement; |
| 9 | |
import javax.xml.bind.annotation.XmlRootElement; |
| 10 | |
import javax.xml.bind.annotation.XmlType; |
| 11 | |
|
| 12 | |
import org.apache.commons.lang.StringUtils; |
| 13 | |
import org.kuali.rice.core.api.CoreConstants; |
| 14 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
| 15 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
| 16 | |
import org.w3c.dom.Element; |
| 17 | |
|
| 18 | |
@XmlRootElement(name = RemotableAttributeLookupSettings.Constants.ROOT_ELEMENT_NAME) |
| 19 | |
@XmlAccessorType(XmlAccessType.NONE) |
| 20 | |
@XmlType(name = RemotableAttributeLookupSettings.Constants.TYPE_NAME, propOrder = { |
| 21 | |
RemotableAttributeLookupSettings.Elements.IN_CRITERIA, |
| 22 | |
RemotableAttributeLookupSettings.Elements.IN_RESULTS, |
| 23 | |
RemotableAttributeLookupSettings.Elements.RANGED, |
| 24 | |
RemotableAttributeLookupSettings.Elements.LOWER_BOUND_NAME, |
| 25 | |
RemotableAttributeLookupSettings.Elements.LOWER_BOUND_LABEL, |
| 26 | |
RemotableAttributeLookupSettings.Elements.LOWER_BOUND_INCLUSIVE, |
| 27 | |
RemotableAttributeLookupSettings.Elements.UPPER_BOUND_NAME, |
| 28 | |
RemotableAttributeLookupSettings.Elements.UPPER_BOUND_LABEL, |
| 29 | |
RemotableAttributeLookupSettings.Elements.UPPER_BOUND_INCLUSIVE, |
| 30 | |
RemotableAttributeLookupSettings.Elements.CASE_SENSITIVE, |
| 31 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
| 32 | |
}) |
| 33 | 0 | public final class RemotableAttributeLookupSettings extends AbstractDataTransferObject implements AttributeLookupSettings { |
| 34 | |
|
| 35 | |
@XmlElement(name = Elements.IN_CRITERIA, required = true) |
| 36 | |
private final boolean inCriteria; |
| 37 | |
|
| 38 | |
@XmlElement(name = Elements.IN_RESULTS, required = true) |
| 39 | |
private final boolean inResults; |
| 40 | |
|
| 41 | |
@XmlElement(name = Elements.RANGED, required = true) |
| 42 | |
private final boolean ranged; |
| 43 | |
|
| 44 | |
@XmlElement(name = Elements.LOWER_BOUND_NAME, required = false) |
| 45 | |
private final String lowerBoundName; |
| 46 | |
|
| 47 | |
@XmlElement(name = Elements.LOWER_BOUND_LABEL, required = false) |
| 48 | |
private final String lowerBoundLabel; |
| 49 | |
|
| 50 | |
@XmlElement(name = Elements.LOWER_BOUND_INCLUSIVE, required = false) |
| 51 | |
private final boolean lowerBoundInclusive; |
| 52 | |
|
| 53 | |
@XmlElement(name = Elements.UPPER_BOUND_NAME, required = false) |
| 54 | |
private final String upperBoundName; |
| 55 | |
|
| 56 | |
@XmlElement(name = Elements.UPPER_BOUND_LABEL, required = false) |
| 57 | |
private final String upperBoundLabel; |
| 58 | |
|
| 59 | |
@XmlElement(name = Elements.UPPER_BOUND_INCLUSIVE, required = false) |
| 60 | |
private final boolean upperBoundInclusive; |
| 61 | |
|
| 62 | |
@XmlElement(name = Elements.CASE_SENSITIVE, required = false) |
| 63 | |
private final Boolean caseSensitive; |
| 64 | |
|
| 65 | 0 | @SuppressWarnings("unused") |
| 66 | |
@XmlAnyElement |
| 67 | |
private final Collection<Element> _futureElements = null; |
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | 0 | private RemotableAttributeLookupSettings() { |
| 73 | 0 | this.inCriteria = false; |
| 74 | 0 | this.inResults = false; |
| 75 | 0 | this.ranged = false; |
| 76 | 0 | this.lowerBoundName = null; |
| 77 | 0 | this.lowerBoundLabel = null; |
| 78 | 0 | this.lowerBoundInclusive = false; |
| 79 | 0 | this.upperBoundName = null; |
| 80 | 0 | this.upperBoundLabel = null; |
| 81 | 0 | this.upperBoundInclusive = false; |
| 82 | 0 | this.caseSensitive = null; |
| 83 | 0 | } |
| 84 | |
|
| 85 | 0 | private RemotableAttributeLookupSettings(Builder builder) { |
| 86 | 0 | this.inCriteria = builder.isInCriteria(); |
| 87 | 0 | this.inResults = builder.isInResults(); |
| 88 | 0 | this.ranged = builder.isRanged(); |
| 89 | 0 | this.lowerBoundName = builder.getLowerBoundName(); |
| 90 | 0 | this.lowerBoundLabel = builder.getLowerBoundLabel(); |
| 91 | 0 | this.lowerBoundInclusive = builder.isLowerBoundInclusive(); |
| 92 | 0 | this.upperBoundName = builder.getUpperBoundName(); |
| 93 | 0 | this.upperBoundLabel = builder.getUpperBoundLabel(); |
| 94 | 0 | this.upperBoundInclusive = builder.isUpperBoundInclusive(); |
| 95 | 0 | this.caseSensitive = builder.isCaseSensitive(); |
| 96 | 0 | } |
| 97 | |
|
| 98 | |
@Override |
| 99 | |
public boolean isInCriteria() { |
| 100 | 0 | return inCriteria; |
| 101 | |
} |
| 102 | |
|
| 103 | |
@Override |
| 104 | |
public boolean isInResults() { |
| 105 | 0 | return inResults; |
| 106 | |
} |
| 107 | |
|
| 108 | |
@Override |
| 109 | |
public boolean isRanged() { |
| 110 | 0 | return ranged; |
| 111 | |
} |
| 112 | |
|
| 113 | |
@Override |
| 114 | |
public String getLowerBoundName() { |
| 115 | 0 | return this.lowerBoundName; |
| 116 | |
} |
| 117 | |
|
| 118 | |
@Override |
| 119 | |
public String getLowerBoundLabel() { |
| 120 | 0 | return this.lowerBoundLabel; |
| 121 | |
} |
| 122 | |
|
| 123 | |
@Override |
| 124 | |
public boolean isLowerBoundInclusive() { |
| 125 | 0 | return this.lowerBoundInclusive; |
| 126 | |
} |
| 127 | |
|
| 128 | |
@Override |
| 129 | |
public String getUpperBoundName() { |
| 130 | 0 | return this.upperBoundName; |
| 131 | |
} |
| 132 | |
|
| 133 | |
@Override |
| 134 | |
public String getUpperBoundLabel() { |
| 135 | 0 | return this.upperBoundLabel; |
| 136 | |
} |
| 137 | |
|
| 138 | |
@Override |
| 139 | |
public boolean isUpperBoundInclusive() { |
| 140 | 0 | return this.upperBoundInclusive; |
| 141 | |
} |
| 142 | |
|
| 143 | |
@Override |
| 144 | |
public Boolean isCaseSensitive() { |
| 145 | 0 | return caseSensitive; |
| 146 | |
} |
| 147 | |
|
| 148 | |
|
| 149 | |
|
| 150 | |
|
| 151 | 0 | public final static class Builder implements Serializable, ModelBuilder, AttributeLookupSettings { |
| 152 | |
|
| 153 | |
private boolean inCriteria; |
| 154 | |
private boolean inResults; |
| 155 | |
private boolean ranged; |
| 156 | |
private String lowerBoundName; |
| 157 | |
private String lowerBoundLabel; |
| 158 | |
private boolean lowerBoundInclusive; |
| 159 | |
private String upperBoundName; |
| 160 | |
private String upperBoundLabel; |
| 161 | |
private boolean upperBoundInclusive; |
| 162 | |
private Boolean caseSensitive; |
| 163 | |
|
| 164 | 0 | private Builder() { |
| 165 | 0 | setInCriteria(true); |
| 166 | 0 | setInResults(true); |
| 167 | 0 | setRanged(false); |
| 168 | 0 | } |
| 169 | |
|
| 170 | |
public static Builder create() { |
| 171 | 0 | return new Builder(); |
| 172 | |
} |
| 173 | |
|
| 174 | |
public static Builder create(AttributeLookupSettings contract) { |
| 175 | 0 | if (contract == null) { |
| 176 | 0 | throw new IllegalArgumentException("contract was null"); |
| 177 | |
} |
| 178 | 0 | Builder builder = create(); |
| 179 | 0 | builder.setInCriteria(contract.isInCriteria()); |
| 180 | 0 | builder.setInResults(contract.isInResults()); |
| 181 | 0 | builder.setRanged(contract.isRanged()); |
| 182 | 0 | builder.setLowerBoundName(contract.getLowerBoundName()); |
| 183 | 0 | builder.setLowerBoundLabel(contract.getLowerBoundLabel()); |
| 184 | 0 | builder.setLowerBoundInclusive(contract.isLowerBoundInclusive()); |
| 185 | 0 | builder.setUpperBoundName(contract.getUpperBoundName()); |
| 186 | 0 | builder.setUpperBoundLabel(contract.getUpperBoundLabel()); |
| 187 | 0 | builder.setUpperBoundInclusive(contract.isUpperBoundInclusive()); |
| 188 | 0 | builder.setCaseSensitive(contract.isCaseSensitive()); |
| 189 | 0 | return builder; |
| 190 | |
} |
| 191 | |
|
| 192 | |
public RemotableAttributeLookupSettings build() { |
| 193 | 0 | return new RemotableAttributeLookupSettings(this); |
| 194 | |
} |
| 195 | |
|
| 196 | |
@Override |
| 197 | |
public boolean isInCriteria() { |
| 198 | 0 | return inCriteria; |
| 199 | |
} |
| 200 | |
|
| 201 | |
@Override |
| 202 | |
public boolean isInResults() { |
| 203 | 0 | return inResults; |
| 204 | |
} |
| 205 | |
|
| 206 | |
@Override |
| 207 | |
public boolean isRanged() { |
| 208 | 0 | return ranged; |
| 209 | |
} |
| 210 | |
|
| 211 | |
@Override |
| 212 | |
public String getLowerBoundName() { |
| 213 | 0 | return this.lowerBoundName; |
| 214 | |
} |
| 215 | |
|
| 216 | |
@Override |
| 217 | |
public String getLowerBoundLabel() { |
| 218 | 0 | return this.lowerBoundLabel; |
| 219 | |
} |
| 220 | |
|
| 221 | |
@Override |
| 222 | |
public boolean isLowerBoundInclusive() { |
| 223 | 0 | return this.lowerBoundInclusive; |
| 224 | |
} |
| 225 | |
|
| 226 | |
@Override |
| 227 | |
public String getUpperBoundName() { |
| 228 | 0 | return this.upperBoundName; |
| 229 | |
} |
| 230 | |
|
| 231 | |
@Override |
| 232 | |
public String getUpperBoundLabel() { |
| 233 | 0 | return this.upperBoundLabel; |
| 234 | |
} |
| 235 | |
|
| 236 | |
@Override |
| 237 | |
public boolean isUpperBoundInclusive() { |
| 238 | 0 | return this.upperBoundInclusive; |
| 239 | |
} |
| 240 | |
|
| 241 | |
@Override |
| 242 | |
public Boolean isCaseSensitive() { |
| 243 | 0 | return caseSensitive; |
| 244 | |
} |
| 245 | |
|
| 246 | |
public void setInCriteria(boolean inCriteria) { |
| 247 | 0 | this.inCriteria = inCriteria; |
| 248 | 0 | } |
| 249 | |
|
| 250 | |
public void setInResults(boolean inResults) { |
| 251 | 0 | this.inResults = inResults; |
| 252 | 0 | } |
| 253 | |
|
| 254 | |
public void setRanged(boolean ranged) { |
| 255 | 0 | this.ranged = ranged; |
| 256 | 0 | } |
| 257 | |
|
| 258 | |
public void setLowerBoundName(String lowerBoundName) { |
| 259 | 0 | if (StringUtils.isBlank(lowerBoundName)) { |
| 260 | 0 | throw new IllegalArgumentException("lowerBoundName was null or blank"); |
| 261 | |
} |
| 262 | 0 | this.lowerBoundName = lowerBoundName; |
| 263 | 0 | } |
| 264 | |
|
| 265 | |
public void setLowerBoundLabel(String lowerBoundLabel) { |
| 266 | 0 | this.lowerBoundLabel = lowerBoundLabel; |
| 267 | 0 | } |
| 268 | |
|
| 269 | |
public void setLowerBoundInclusive(boolean lowerBoundInclusive) { |
| 270 | 0 | this.lowerBoundInclusive = lowerBoundInclusive; |
| 271 | 0 | } |
| 272 | |
|
| 273 | |
public void setUpperBoundName(String upperBoundName) { |
| 274 | 0 | if (StringUtils.isBlank(upperBoundName)) { |
| 275 | 0 | throw new IllegalArgumentException("upperBoundName was null or blank"); |
| 276 | |
} |
| 277 | 0 | this.upperBoundName = upperBoundName; |
| 278 | 0 | } |
| 279 | |
|
| 280 | |
public void setUpperBoundLabel(String upperBoundLabel) { |
| 281 | 0 | this.upperBoundLabel = upperBoundLabel; |
| 282 | 0 | } |
| 283 | |
|
| 284 | |
public void setUpperBoundInclusive(boolean upperBoundInclusive) { |
| 285 | 0 | this.upperBoundInclusive = upperBoundInclusive; |
| 286 | 0 | } |
| 287 | |
|
| 288 | |
public void setCaseSensitive(Boolean caseSensitive) { |
| 289 | 0 | this.caseSensitive = caseSensitive; |
| 290 | 0 | } |
| 291 | |
|
| 292 | |
} |
| 293 | |
|
| 294 | |
|
| 295 | |
|
| 296 | |
|
| 297 | 0 | static class Constants { |
| 298 | |
final static String ROOT_ELEMENT_NAME = "remotableAttributeLookupSettings"; |
| 299 | |
final static String TYPE_NAME = "RemotableAttributeLookupSettingsType"; |
| 300 | |
} |
| 301 | |
|
| 302 | |
|
| 303 | |
|
| 304 | |
|
| 305 | 0 | static class Elements { |
| 306 | |
final static String IN_CRITERIA = "inCriteria"; |
| 307 | |
final static String IN_RESULTS = "inResults"; |
| 308 | |
final static String RANGED = "ranged"; |
| 309 | |
final static String LOWER_BOUND_NAME = "lowerBoundName"; |
| 310 | |
final static String LOWER_BOUND_LABEL = "lowerBoundLabel"; |
| 311 | |
final static String LOWER_BOUND_INCLUSIVE = "lowerBoundInclusive"; |
| 312 | |
final static String UPPER_BOUND_NAME = "upperBoundName"; |
| 313 | |
final static String UPPER_BOUND_LABEL = "upperBoundLabel"; |
| 314 | |
final static String UPPER_BOUND_INCLUSIVE = "upperBoundInclusive"; |
| 315 | |
final static String CASE_SENSITIVE = "caseSensitive"; |
| 316 | |
} |
| 317 | |
|
| 318 | |
} |