| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 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 | |
|
| 64 | |
|
| 65 | 0 | public SearchResultInfo() { |
| 66 | 0 | } |
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 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 | |
} |