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 org.apache.commons.lang.StringUtils; |
19 | |
import org.kuali.rice.core.api.CoreConstants; |
20 | |
import org.w3c.dom.Element; |
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.XmlAttribute; |
26 | |
import javax.xml.bind.annotation.XmlElement; |
27 | |
import javax.xml.bind.annotation.XmlElements; |
28 | |
import javax.xml.bind.annotation.XmlRootElement; |
29 | |
import javax.xml.bind.annotation.XmlType; |
30 | |
import java.util.Collection; |
31 | |
import java.util.Collections; |
32 | |
import java.util.HashSet; |
33 | |
import java.util.Set; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | 0 | @XmlRootElement(name = NotInIgnoreCasePredicate.Constants.ROOT_ELEMENT_NAME) |
44 | |
@XmlAccessorType(XmlAccessType.NONE) |
45 | |
@XmlType(name = NotInIgnoreCasePredicate.Constants.TYPE_NAME, propOrder = { |
46 | |
CriteriaSupportUtils.PropertyConstants.VALUES, |
47 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
48 | |
}) |
49 | |
public final class NotInIgnoreCasePredicate extends AbstractPredicate implements MultiValuedPredicate { |
50 | |
|
51 | |
private static final long serialVersionUID = -7676442296587603655L; |
52 | |
|
53 | |
@XmlAttribute(name = CriteriaSupportUtils.PropertyConstants.PROPERTY_PATH) |
54 | |
private final String propertyPath; |
55 | |
|
56 | |
@XmlElements(value = { |
57 | |
@XmlElement(name = CriteriaStringValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaStringValue.class, required = true) |
58 | |
}) |
59 | |
private final Set<CriteriaStringValue> values; |
60 | |
|
61 | 2 | @SuppressWarnings("unused") |
62 | |
@XmlAnyElement |
63 | |
private final Collection<Element> _futureElements = null; |
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
@SuppressWarnings("unused") |
69 | 0 | private NotInIgnoreCasePredicate() { |
70 | 0 | this.propertyPath = null; |
71 | 0 | this.values = null; |
72 | 0 | } |
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | 2 | NotInIgnoreCasePredicate(String propertyPath, Set<CriteriaStringValue> values) { |
85 | 2 | if (StringUtils.isBlank(propertyPath)) { |
86 | 0 | throw new IllegalArgumentException("Property path cannot be null or blank."); |
87 | |
} |
88 | 2 | this.propertyPath = propertyPath; |
89 | |
|
90 | 2 | if (values == null) { |
91 | 0 | this.values = Collections.emptySet(); |
92 | |
} else { |
93 | 2 | final Set<CriteriaStringValue> temp = new HashSet<CriteriaStringValue>(); |
94 | 2 | for (CriteriaStringValue value: values) { |
95 | 6 | if (value != null) { |
96 | 6 | temp.add(value); |
97 | |
} |
98 | |
} |
99 | 2 | this.values = Collections.unmodifiableSet(temp); |
100 | |
} |
101 | 2 | } |
102 | |
|
103 | |
@Override |
104 | |
public String getPropertyPath() { |
105 | 0 | return propertyPath; |
106 | |
} |
107 | |
|
108 | |
@Override |
109 | |
public Set<CriteriaStringValue> getValues() { |
110 | 0 | return Collections.unmodifiableSet(values); |
111 | |
} |
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | 0 | static class Constants { |
117 | |
final static String ROOT_ELEMENT_NAME = "notInIgnoreCase"; |
118 | |
final static String TYPE_NAME = "NotInIgnoreCaseType"; |
119 | |
} |
120 | |
|
121 | |
@Override |
122 | |
public String toString() { |
123 | 0 | return CriteriaSupportUtils.toString(this); |
124 | |
} |
125 | |
} |