View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.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/ecl2.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.XmlRootElement;
25  import javax.xml.bind.annotation.XmlType;
26  import java.util.Collection;
27  import java.util.Set;
28  
29  /**
30   * An immutable composite predicate which implements "or-ing" of multiple
31   * predicates together.
32   * 
33   * @see PredicateFactory for a convenient way to construct this class.
34   * 
35   * @author Kuali Rice Team (rice.collab@kuali.org)
36   */
37  @XmlRootElement(name = OrPredicate.Constants.ROOT_ELEMENT_NAME)
38  @XmlAccessorType(XmlAccessType.NONE)
39  @XmlType(name = OrPredicate.Constants.TYPE_NAME, propOrder = {
40      CoreConstants.CommonElements.FUTURE_ELEMENTS
41  })
42  public final class OrPredicate extends AbstractCompositePredicate {
43  	
44  	private static final long serialVersionUID = -6575256900578172242L;
45  
46      @SuppressWarnings("unused")
47      @XmlAnyElement
48      private final Collection<Element> _futureElements = null;
49  
50  	/**
51  	 * Used only by JAXB for construction.
52  	 */
53  	@SuppressWarnings("unused")
54  	private OrPredicate() {
55  		super();
56  	}
57  	
58  	/**
59  	 * Construct an "Or" predicate from the given list of predicates.  The given list
60  	 * of predicates can be null or empty.  If the list is null then it will be
61  	 * translated internally to an empty list.
62  	 * 
63  	 * @param predicates the List of predicates to set on the And predicate
64  	 */
65  	OrPredicate(Set<Predicate> predicates) {
66  	    //don't worry about defensive copy of list here - super class takes care of it.
67          super(predicates);
68  	}
69  	
70  	/**
71       * Defines some internal constants used on this class.
72       */
73      static class Constants {
74          final static String ROOT_ELEMENT_NAME = "or";
75          final static String TYPE_NAME = "OrType";
76      }
77  
78  }