Coverage Report - org.kuali.rice.core.api.criteria.LessThanOrEqualPredicate
 
Classes in this File Line Coverage Branch Coverage Complexity
LessThanOrEqualPredicate
78%
11/14
N/A
1
LessThanOrEqualPredicate$Constants
0%
0/1
N/A
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 "less than or equal to" statement which is
 33  
  * evaluated the {@link CriteriaValue} of this predicate.
 34  
  * 
 35  
  * @see PredicateFactory for a convenient way to construct this class.
 36  
  * 
 37  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 38  
  * 
 39  
  */
 40  14
 @XmlRootElement(name = LessThanOrEqualPredicate.Constants.ROOT_ELEMENT_NAME)
 41  
 @XmlAccessorType(XmlAccessType.NONE)
 42  
 @XmlType(name = LessThanOrEqualPredicate.Constants.TYPE_NAME, propOrder = {
 43  
     CriteriaSupportUtils.PropertyConstants.VALUE,
 44  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 45  
 })
 46  
 public final class LessThanOrEqualPredicate extends AbstractPredicate implements SingleValuedPredicate {
 47  
             
 48  
         private static final long serialVersionUID = 2576163857285296720L;
 49  
         
 50  
         @XmlAttribute(name = CriteriaSupportUtils.PropertyConstants.PROPERTY_PATH)
 51  
         private final String propertyPath;
 52  
 
 53  
         @XmlElements(value = {
 54  
                         @XmlElement(name = CriteriaDecimalValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaDecimalValue.class, required = true),
 55  
             @XmlElement(name = CriteriaIntegerValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaIntegerValue.class, required = true),
 56  
             @XmlElement(name = CriteriaDateTimeValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaDateTimeValue.class, required = true)
 57  
     })
 58  
         private final CriteriaValue<?> value;
 59  
 
 60  6
     @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  2
     private LessThanOrEqualPredicate() {
 69  2
         this.propertyPath = null;
 70  2
         this.value = null;
 71  2
     }
 72  
     
 73  
     /**
 74  
          * Constructs a LessThanOrEqualPredicate for the given path and value.  LessThanOrEqualPredicate supports the following {@link CriteriaValue}:
 75  
          * 
 76  
          * <ul>
 77  
          *   <li>{@link CriteriaDateTimeValue}</li>
 78  
          *   <li>{@link CriteriaDecimalValue}</li>
 79  
          *   <li>{@link CriteriaIntegerValue}</li>
 80  
          * </ul>
 81  
          * 
 82  
          * @param propertyPath the property path for the predicate, must not be null or blank
 83  
          * @param value the value to evaluation the path against, must not be null.
 84  
          * 
 85  
          * @throws IllegalArgumentException if the propertyPath is null or blank
 86  
          * @throws IllegalArgumentException if the value is null
 87  
          * @throws IllegalArgumentException if this predicate does not support the given type of {@link CriteriaValue}
 88  
          */
 89  4
     LessThanOrEqualPredicate(String propertyPath, CriteriaValue<?> value) {
 90  4
             CriteriaSupportUtils.validateValuedConstruction(getClass(), propertyPath, value);
 91  3
                 this.propertyPath = propertyPath;
 92  3
                 this.value = value;
 93  3
     }
 94  
     
 95  
     @Override
 96  
     public String getPropertyPath() {
 97  0
             return propertyPath;
 98  
     }
 99  
     
 100  
         @Override
 101  
         public CriteriaValue<?> getValue() {
 102  0
                 return value;
 103  
         }
 104  
     
 105  
         /**
 106  
      * Defines some internal constants used on this class.
 107  
      */
 108  0
     static class Constants {
 109  
         final static String ROOT_ELEMENT_NAME = "lessThanOrEqual";
 110  
         final static String TYPE_NAME = "LessThanOrEqualType";
 111  
     }
 112  
 
 113  
     @Override
 114  
     public String toString() {
 115  0
         return CriteriaSupportUtils.toString(this);
 116  
     }
 117  
 }