1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
package org.kuali.rice.core.api.criteria; |
9 | |
|
10 | |
import javax.xml.bind.annotation.XmlAccessType; |
11 | |
import javax.xml.bind.annotation.XmlAccessorType; |
12 | |
import javax.xml.bind.annotation.XmlElement; |
13 | |
import javax.xml.bind.annotation.XmlElements; |
14 | |
import javax.xml.bind.annotation.XmlType; |
15 | |
import java.util.Collections; |
16 | |
import java.util.HashSet; |
17 | |
import java.util.Set; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
@XmlAccessorType(XmlAccessType.NONE) |
29 | |
@XmlType(name = AbstractCompositePredicate.Constants.TYPE_NAME) |
30 | |
abstract class AbstractCompositePredicate extends AbstractPredicate implements CompositePredicate { |
31 | |
|
32 | |
private static final long serialVersionUID = 6164560054223588779L; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
@XmlElements(value = { |
41 | |
@XmlElement(name = AndPredicate.Constants.ROOT_ELEMENT_NAME, type = AndPredicate.class, required = true), |
42 | |
@XmlElement(name = EqualPredicate.Constants.ROOT_ELEMENT_NAME, type = EqualPredicate.class, required = true), |
43 | |
@XmlElement(name = GreaterThanPredicate.Constants.ROOT_ELEMENT_NAME, type = GreaterThanPredicate.class, required = true), |
44 | |
@XmlElement(name = GreaterThanOrEqualPredicate.Constants.ROOT_ELEMENT_NAME, type = GreaterThanOrEqualPredicate.class, required = true), |
45 | |
@XmlElement(name = InPredicate.Constants.ROOT_ELEMENT_NAME, type = InPredicate.class, required = true), |
46 | |
@XmlElement(name = LessThanPredicate.Constants.ROOT_ELEMENT_NAME, type = LessThanPredicate.class, required = true), |
47 | |
@XmlElement(name = LessThanOrEqualPredicate.Constants.ROOT_ELEMENT_NAME, type = LessThanOrEqualPredicate.class, required = true), |
48 | |
@XmlElement(name = LikePredicate.Constants.ROOT_ELEMENT_NAME, type = LikePredicate.class, required = true), |
49 | |
@XmlElement(name = NotEqualPredicate.Constants.ROOT_ELEMENT_NAME, type = NotEqualPredicate.class, required = true), |
50 | |
@XmlElement(name = NotInPredicate.Constants.ROOT_ELEMENT_NAME, type = NotInPredicate.class, required = true), |
51 | |
@XmlElement(name = NotLikePredicate.Constants.ROOT_ELEMENT_NAME, type = NotLikePredicate.class, required = true), |
52 | |
@XmlElement(name = NotNullPredicate.Constants.ROOT_ELEMENT_NAME, type = NotNullPredicate.class, required = true), |
53 | |
@XmlElement(name = NullPredicate.Constants.ROOT_ELEMENT_NAME, type = NullPredicate.class, required = true), |
54 | |
@XmlElement(name = OrPredicate.Constants.ROOT_ELEMENT_NAME, type = OrPredicate.class, required = true) |
55 | |
}) |
56 | |
private final Set<Predicate> predicates; |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | 20 | AbstractCompositePredicate() { |
63 | 20 | this.predicates = null; |
64 | 20 | } |
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | 29 | AbstractCompositePredicate(final Set<Predicate> predicates) { |
74 | 29 | if (predicates == null) { |
75 | 2 | this.predicates = Collections.emptySet(); |
76 | |
} else { |
77 | 27 | final Set<Predicate> temp = new HashSet<Predicate>(); |
78 | 27 | for (Predicate predicate: predicates) { |
79 | 70 | if (predicate != null) { |
80 | 70 | temp.add(predicate); |
81 | |
} |
82 | |
} |
83 | 27 | this.predicates = Collections.unmodifiableSet(temp); |
84 | |
} |
85 | 29 | } |
86 | |
|
87 | |
@Override |
88 | |
public Set<Predicate> getPredicates() { |
89 | 15 | return Collections.unmodifiableSet(predicates); |
90 | |
} |
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | 0 | static class Constants { |
96 | |
final static String TYPE_NAME = "CompositePredicateType"; |
97 | |
} |
98 | |
|
99 | |
} |