Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
NotLikePredicate |
|
| 1.0;1 | ||||
NotLikePredicate$Constants |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 1.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl1.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.core.api.criteria; | |
17 | ||
18 | import org.kuali.rice.core.api.CoreConstants; | |
19 | import org.w3c.dom.Element; | |
20 | ||
21 | import javax.xml.bind.annotation.XmlAccessType; | |
22 | import javax.xml.bind.annotation.XmlAccessorType; | |
23 | import javax.xml.bind.annotation.XmlAnyElement; | |
24 | import javax.xml.bind.annotation.XmlAttribute; | |
25 | import javax.xml.bind.annotation.XmlElement; | |
26 | import javax.xml.bind.annotation.XmlElements; | |
27 | import javax.xml.bind.annotation.XmlRootElement; | |
28 | import javax.xml.bind.annotation.XmlType; | |
29 | import java.util.Collection; | |
30 | ||
31 | /** | |
32 | * An immutable predicate which represents a "not like" statement which is | |
33 | * evaluated the {@link CriteriaValue} of this predicate. The criteria | |
34 | * value for a like predicate should support wildcards using "*" for multiple | |
35 | * values and "?" for a single value. | |
36 | * | |
37 | * @see PredicateFactory for a convenient way to construct this class. | |
38 | * | |
39 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
40 | * | |
41 | */ | |
42 | 0 | @XmlRootElement(name = NotLikePredicate.Constants.ROOT_ELEMENT_NAME) |
43 | @XmlAccessorType(XmlAccessType.NONE) | |
44 | @XmlType(name = NotLikePredicate.Constants.TYPE_NAME, propOrder = { | |
45 | CriteriaSupportUtils.PropertyConstants.VALUE, | |
46 | CoreConstants.CommonElements.FUTURE_ELEMENTS | |
47 | }) | |
48 | public final class NotLikePredicate extends AbstractPredicate implements SingleValuedPredicate { | |
49 | ||
50 | private static final long serialVersionUID = 6406122080039813800L; | |
51 | ||
52 | @XmlAttribute(name = CriteriaSupportUtils.PropertyConstants.PROPERTY_PATH) | |
53 | private final String propertyPath; | |
54 | ||
55 | @XmlElements(value = { | |
56 | @XmlElement(name = CriteriaStringValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaStringValue.class, required = true) | |
57 | }) | |
58 | private final CriteriaValue<?> value; | |
59 | ||
60 | 4 | @SuppressWarnings("unused") |
61 | @XmlAnyElement | |
62 | private final Collection<Element> _futureElements = null; | |
63 | ||
64 | /** | |
65 | * Should only be invoked by JAXB. | |
66 | */ | |
67 | @SuppressWarnings("unused") | |
68 | 0 | private NotLikePredicate() { |
69 | 0 | this.propertyPath = null; |
70 | 0 | this.value = null; |
71 | 0 | } |
72 | ||
73 | /** | |
74 | * Constructs a NotLikePredicate for the given path and value. NotLikePredicate supports only the | |
75 | * {@link org.kuali.rice.core.api.criteria.CriteriaStringValue}. | |
76 | * | |
77 | * @param propertyPath the property path for the predicate, must not be null or blank | |
78 | * @param value the value to evaluation the path against, must not be null. | |
79 | * | |
80 | * @throws IllegalArgumentException if the propertyPath is null or blank | |
81 | * @throws IllegalArgumentException if the value is null | |
82 | * @throws IllegalArgumentException if this predicate does not support the given type of {@link org.kuali.rice.core.api.criteria.CriteriaValue} | |
83 | */ | |
84 | 4 | NotLikePredicate(String propertyPath, CriteriaValue<?> value) { |
85 | 4 | CriteriaSupportUtils.validateValuedConstruction(getClass(), propertyPath, value); |
86 | 3 | this.propertyPath = propertyPath; |
87 | 3 | this.value = value; |
88 | 3 | } |
89 | ||
90 | @Override | |
91 | public String getPropertyPath() { | |
92 | 0 | return propertyPath; |
93 | } | |
94 | ||
95 | @Override | |
96 | public CriteriaValue<?> getValue() { | |
97 | 0 | return value; |
98 | } | |
99 | ||
100 | /** | |
101 | * Defines some internal constants used on this class. | |
102 | */ | |
103 | 0 | static class Constants { |
104 | final static String ROOT_ELEMENT_NAME = "notLike"; | |
105 | final static String TYPE_NAME = "NotLikeType"; | |
106 | } | |
107 | ||
108 | } |