Coverage Report - org.kuali.student.r2.core.search.dto.SearchResultInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
SearchResultInfo
0%
0/29
0%
0/6
1.25
 
 1  
 /*
 2  
  * Copyright 2010 The Kuali Foundation 
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.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.osedu.org/licenses/ECL-2.0
 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.core.search.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.XmlType;
 28  
 
 29  
 import org.kuali.student.r2.core.search.infc.SearchResult;
 30  
 import org.kuali.student.r2.core.search.infc.SearchResultRow;
 31  
 import org.w3c.dom.Element;
 32  
 
 33  
 @XmlAccessorType(XmlAccessType.FIELD)
 34  
 @XmlType(name = "SearchResultInfo", propOrder = {
 35  
                 "startAt", "totalResults", "rows", "sortColumn",
 36  
                 "sortDirection", "_futureElements" })
 37  
 
 38  
 public class SearchResultInfo 
 39  
     implements SearchResult, Serializable {
 40  
 
 41  
     private static final long serialVersionUID = 1L;
 42  
     
 43  
     @XmlElement        
 44  
     private Integer startAt;
 45  
     
 46  
     @XmlElement    
 47  
     private Integer totalResults;
 48  
     
 49  
     @XmlElement    
 50  
     private List<SearchResultRowInfo> rows;
 51  
     
 52  
     @XmlElement    
 53  
     private String sortColumn;
 54  
     
 55  
     @XmlElement    
 56  
     private SortDirection sortDirection;
 57  
 
 58  
     @XmlAnyElement
 59  
     private List<Element> _futureElements;
 60  
 
 61  
 
 62  
     /**
 63  
      * Constructs a new SearchResultInfo.
 64  
      */
 65  0
     public SearchResultInfo() {
 66  0
     }
 67  
 
 68  
     /**
 69  
      * Constructs a new SearchResultInfo from another
 70  
      * SearchResult.
 71  
      *
 72  
      * @param result the SearchResult to copy
 73  
      */
 74  0
     public SearchResultInfo(SearchResult result) {
 75  0
         if (result != null) {
 76  0
             this.startAt = result.getStartAt();
 77  0
             this.totalResults = result.getTotalResults();
 78  
 
 79  0
             this.rows = new ArrayList<SearchResultRowInfo>();
 80  0
             for (SearchResultRow row : result.getRows()) {
 81  0
                 this.rows.add(new SearchResultRowInfo(row));
 82  
             }
 83  
 
 84  0
             this.sortColumn = result.getSortColumn();
 85  0
             this.sortDirection = result.getSortDirection();
 86  
         }
 87  0
     }
 88  
     
 89  
     @Override
 90  
     public Integer getStartAt() {
 91  0
         return startAt;
 92  
     }
 93  
         
 94  
     public void setStartAt(Integer startAt) {
 95  0
         this.startAt = startAt;
 96  0
     }
 97  
         
 98  
     @Override
 99  
     public Integer getTotalResults() {
 100  0
         return totalResults;
 101  
     }
 102  
     
 103  
     public void setTotalResults(Integer totalResults) {
 104  0
         this.totalResults = totalResults;
 105  0
     }
 106  
         
 107  
     @Override
 108  
     public List<SearchResultRowInfo> getRows() {
 109  0
         if (rows == null) {
 110  0
             rows = new ArrayList<SearchResultRowInfo>(0);
 111  
         }
 112  0
         return rows;
 113  
     }
 114  
     
 115  
     public void setRows(List<SearchResultRowInfo> rows) {
 116  0
         this.rows = rows;
 117  0
     }
 118  
     
 119  
     @Override
 120  
     public String getSortColumn() {
 121  0
         return sortColumn;
 122  
     }
 123  
         
 124  
     public void setSortColumn(String sortColumn) {
 125  0
         this.sortColumn = sortColumn;
 126  0
     }
 127  
     
 128  
     @Override
 129  
     public SortDirection getSortDirection() {
 130  0
         return sortDirection;
 131  
     }
 132  
         
 133  
     public void setSortDirection(SortDirection sortDirection) {
 134  0
         this.sortDirection = sortDirection;
 135  0
     }
 136  
 }