View Javadoc

1   /*
2    * Copyright 2009 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 1.0 (the
5    * "License"); you may not use this file except in compliance with the
6    * License.  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
13   * implied.  See the License for the specific language governing
14   * permissions and limitations under the License.
15   */
16  
17  package org.kuali.student.r2.common.dto;
18  
19  import java.io.Serializable;
20  import java.util.ArrayList;
21  import java.util.List;
22  
23  import javax.xml.bind.annotation.XmlAccessType;
24  import javax.xml.bind.annotation.XmlAccessorType;
25  import javax.xml.bind.annotation.XmlAnyElement;
26  import javax.xml.bind.annotation.XmlElement;
27  import javax.xml.bind.annotation.XmlElementWrapper;
28  import javax.xml.bind.annotation.XmlType;
29  
30  import org.kuali.student.r2.common.infc.Comparison;
31  import org.kuali.student.r2.common.infc.Criteria;
32  //import org.w3c.dom.Element;
33  
34  /**
35   * Query to return some information regarding LUI to person
36   * relationships.
37   * 
38   * @author Kamal
39   * @since Tue Mar 01 15:54:06 PST 2011
40   */
41  
42  @XmlAccessorType(XmlAccessType.FIELD)
43  @XmlType(name = "CriteriaInfo", propOrder = { 
44                  "comparisons", "maxResults" , "_futureElements" }) 
45  
46  public class CriteriaInfo 
47      implements Criteria, Serializable {
48  
49      private static final long serialVersionUID = 1L;
50  
51      @XmlElementWrapper(name = "comparisons")
52      @XmlElement(name = "comparison")
53      private List<ComparisonInfo> comparisons;
54  	
55      @XmlElement
56      private Integer maxResults;
57      
58      
59      @XmlAnyElement
60      private List<Object> _futureElements;
61  
62  
63      /**
64       * Constructs a new CriteriaInfo.
65       */
66      public CriteriaInfo() {
67      }
68  
69      /**
70       * Constructs a new CriteriaInfo from another Criteria.
71       *
72       * @param criteria the criteria to copy
73       */
74      public CriteriaInfo(Criteria criteria) {
75          if (criteria != null) {
76              if (criteria.getComparisons() != null) {
77                  this.comparisons = new ArrayList<ComparisonInfo>();
78                  for (Comparison comparison : criteria.getComparisons()) {
79                      this.comparisons.add(new ComparisonInfo(comparison));
80                  }
81              }
82              this.maxResults = criteria.getMaxResults();
83          }
84      }
85  
86      @Override
87      public List<? extends Comparison> getComparisons() {
88          if (comparisons == null) {
89              comparisons = new ArrayList<ComparisonInfo>(0);
90          }
91  
92          return this.comparisons;
93      }
94      
95      public void setComparisons(List<ComparisonInfo> comparisons) {
96          this.comparisons = comparisons;
97      }
98  
99      @Override
100     public Integer getMaxResults() {
101         return this.maxResults;
102     }
103     
104     public void setMaxResults(Integer maxResults) {
105         this.maxResults = maxResults;
106     }
107 }