1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.api.criteria; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import javax.xml.bind.annotation.XmlAccessType; |
22 | |
import javax.xml.bind.annotation.XmlAccessorType; |
23 | |
import javax.xml.bind.annotation.XmlAttribute; |
24 | |
import javax.xml.bind.annotation.XmlElement; |
25 | |
import javax.xml.bind.annotation.XmlElements; |
26 | |
import javax.xml.bind.annotation.XmlRootElement; |
27 | |
import javax.xml.bind.annotation.XmlType; |
28 | |
|
29 | |
import org.apache.commons.lang.StringUtils; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | 12 | @XmlRootElement(name = NotInExpression.Constants.ROOT_ELEMENT_NAME) |
44 | |
@XmlAccessorType(XmlAccessType.NONE) |
45 | |
@XmlType(name = NotInExpression.Constants.TYPE_NAME) |
46 | |
public final class NotInExpression extends AbstractExpression implements MultiValuedExpression { |
47 | |
|
48 | |
private static final long serialVersionUID = -7676442296587603655L; |
49 | |
|
50 | |
@XmlAttribute(name = CriteriaSupportUtils.PropertyConstants.PROPERTY_PATH) |
51 | |
private final String propertyPath; |
52 | |
@XmlElements(value = { |
53 | |
@XmlElement(name = CriteriaStringValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaStringValue.class, required = true), |
54 | |
@XmlElement(name = CriteriaDateTimeValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaDateTimeValue.class, required = true), |
55 | |
@XmlElement(name = CriteriaIntegerValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaIntegerValue.class, required = true), |
56 | |
@XmlElement(name = CriteriaDecimalValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaDecimalValue.class, required = true) |
57 | |
}) |
58 | |
private final List<? extends CriteriaValue<?>> values; |
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
@SuppressWarnings("unused") |
64 | 12 | private NotInExpression() { |
65 | 12 | this.propertyPath = null; |
66 | 12 | this.values = null; |
67 | 12 | } |
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | 25 | NotInExpression(String propertyPath, List<? extends CriteriaValue<?>> values) { |
80 | 25 | if (StringUtils.isBlank(propertyPath)) { |
81 | 2 | throw new IllegalArgumentException("Property path cannot be null or blank."); |
82 | |
} |
83 | 23 | CriteriaSupportUtils.validateValuesForMultiValuedExpression(values); |
84 | 18 | this.propertyPath = propertyPath; |
85 | 18 | this.values = values; |
86 | 18 | } |
87 | |
|
88 | |
@Override |
89 | |
public String getPropertyPath() { |
90 | 4 | return propertyPath; |
91 | |
} |
92 | |
|
93 | |
@Override |
94 | |
public List<CriteriaValue<?>> getValues() { |
95 | 8 | return new ArrayList<CriteriaValue<?>>(values); |
96 | |
} |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | 0 | static class Constants { |
102 | |
final static String ROOT_ELEMENT_NAME = "notIn"; |
103 | |
final static String TYPE_NAME = "NotInType"; |
104 | |
} |
105 | |
|
106 | |
} |