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.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  
33  
34  
35  
36  
37  
38  
39  
40  @XmlRootElement(name = EqualPredicate.Constants.ROOT_ELEMENT_NAME)
41  @XmlAccessorType(XmlAccessType.NONE)
42  @XmlType(name = EqualPredicate.Constants.TYPE_NAME, propOrder = {
43      CriteriaSupportUtils.PropertyConstants.VALUE,
44      CoreConstants.CommonElements.FUTURE_ELEMENTS
45  })
46  public final class EqualPredicate extends AbstractPredicate implements SingleValuedPredicate {
47  	
48  	private static final long serialVersionUID = 7159459561133496549L;
49  	
50  	@XmlAttribute(name = CriteriaSupportUtils.PropertyConstants.PROPERTY_PATH)
51  	private final String propertyPath;
52  
53      @XmlElements(value = {
54      		@XmlElement(name = CriteriaStringValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaStringValue.class, required = true),
55      		@XmlElement(name = CriteriaDateTimeValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaDateTimeValue.class, required = true),
56      		@XmlElement(name = CriteriaDecimalValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaDecimalValue.class, required = true),
57              @XmlElement(name = CriteriaKualiDecimalValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaKualiDecimalValue.class, required = true),
58              @XmlElement(name = CriteriaKualiPercentValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaKualiPercentValue.class, required = true),
59      		@XmlElement(name = CriteriaIntegerValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaIntegerValue.class, required = true),
60              @XmlElement(name = CriteriaBooleanValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaBooleanValue.class, required = true)
61      })
62  	private final CriteriaValue<?> value;
63  
64      @SuppressWarnings("unused")
65      @XmlAnyElement
66      private final Collection<Element> _futureElements = null;
67  	
68      
69  
70  
71      @SuppressWarnings("unused")
72      private EqualPredicate() {
73          this.propertyPath = null;
74          this.value = null;
75      }
76      
77      
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96      EqualPredicate(String propertyPath, CriteriaValue<?> value) {
97      	CriteriaSupportUtils.validateValuedConstruction(getClass(), propertyPath, value);
98  		this.propertyPath = propertyPath;
99  		this.value = value;
100     }
101         
102     @Override
103     public String getPropertyPath() {
104     	return propertyPath;
105     }
106     
107 	@Override
108 	public CriteriaValue<?> getValue() {
109 		return value;
110 	}
111     
112 	
113 
114 
115     static class Constants {
116         final static String ROOT_ELEMENT_NAME = "equal";
117         final static String TYPE_NAME = "EqualType";
118     }
119 
120     @Override
121     public String toString() {
122         return CriteriaSupportUtils.toString(this);
123     }
124 }