1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.core.search.dto;
17
18 import java.io.Serializable;
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import javax.xml.bind.annotation.XmlAccessType;
23 import javax.xml.bind.annotation.XmlAccessorType;
24
25 @XmlAccessorType(XmlAccessType.FIELD)
26 public class SearchRequest implements Serializable {
27 private static final long serialVersionUID = 1L;
28 private String searchKey;
29 private List<SearchParam> params;
30 private String sortColumn;
31 private SortDirection sortDirection;
32 private Integer startAt;
33 private Integer maxResults;
34 private Boolean neededTotalResults;
35
36 public String getSearchKey() {
37 return searchKey;
38 }
39 public void setSearchKey(String searchKey) {
40 this.searchKey = searchKey;
41 }
42 public List<SearchParam> getParams() {
43 if(params == null){
44 params = new ArrayList<SearchParam>();
45 }
46 return params;
47 }
48 public void setParams(List<SearchParam> params) {
49 this.params = params;
50 }
51 public String getSortColumn() {
52 return sortColumn;
53 }
54 public void setSortColumn(String sortColumn) {
55 this.sortColumn = sortColumn;
56 }
57 public SortDirection getSortDirection() {
58 return sortDirection;
59 }
60 public void setSortDirection(SortDirection sortDirection) {
61 this.sortDirection = sortDirection;
62 }
63 public Integer getStartAt() {
64 return startAt;
65 }
66 public void setStartAt(Integer startAt) {
67 this.startAt = startAt;
68 }
69 public Integer getMaxResults() {
70 return maxResults;
71 }
72 public void setMaxResults(Integer maxResults) {
73 this.maxResults = maxResults;
74 }
75 public Boolean getNeededTotalResults() {
76 return neededTotalResults;
77 }
78 public void setNeededTotalResults(Boolean neededTotalResults) {
79 this.neededTotalResults = neededTotalResults;
80 }
81 @Override
82 public String toString() {
83 return "SearchRequest [searchKey=" + searchKey + ", params=" + params
84 + ", sortColumn=" + sortColumn + ", sortDirection="
85 + sortDirection + ", startAt=" + startAt + ", maxResults="
86 + maxResults + ", neededTotalResults=" + neededTotalResults
87 + "]";
88 }
89
90 @Override
91 public boolean equals(Object o) {
92 if (this == o) return true;
93 if (o == null || getClass() != o.getClass()) return false;
94
95 SearchRequest that = (SearchRequest) o;
96
97 if (maxResults != null ? !maxResults.equals(that.maxResults) : that.maxResults != null) return false;
98 if (neededTotalResults != null ? !neededTotalResults.equals(that.neededTotalResults) : that.neededTotalResults != null)
99 return false;
100 if (params != null ? !params.equals(that.params) : that.params != null) return false;
101 if (searchKey != null ? !searchKey.equals(that.searchKey) : that.searchKey != null) return false;
102 if (sortColumn != null ? !sortColumn.equals(that.sortColumn) : that.sortColumn != null) return false;
103 if (sortDirection != that.sortDirection) return false;
104 if (startAt != null ? !startAt.equals(that.startAt) : that.startAt != null) return false;
105
106 return true;
107 }
108
109 @Override
110 public int hashCode() {
111 int result = searchKey != null ? searchKey.hashCode() : 0;
112 result = 31 * result + (params != null ? params.hashCode() : 0);
113 result = 31 * result + (sortColumn != null ? sortColumn.hashCode() : 0);
114 result = 31 * result + (sortDirection != null ? sortDirection.hashCode() : 0);
115 result = 31 * result + (startAt != null ? startAt.hashCode() : 0);
116 result = 31 * result + (maxResults != null ? maxResults.hashCode() : 0);
117 result = 31 * result + (neededTotalResults != null ? neededTotalResults.hashCode() : 0);
118 return result;
119 }
120 }