| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |   | 
  | 6 |  |   | 
  | 7 |  |   | 
  | 8 |  |   | 
  | 9 |  |   | 
  | 10 |  |   | 
  | 11 |  |   | 
  | 12 |  |   | 
  | 13 |  |   | 
  | 14 |  |   | 
  | 15 |  |   | 
  | 16 |  |  package org.kuali.student.common.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 SearchRequest() { | 
  | 37 | 0 |                  super(); | 
  | 38 | 0 |          } | 
  | 39 |  |   | 
  | 40 |  |          public SearchRequest(String searchKey){ | 
  | 41 | 0 |                  this(); | 
  | 42 | 0 |                  this.searchKey = searchKey; | 
  | 43 | 0 |          } | 
  | 44 |  |   | 
  | 45 |  |          public void addParam(String key, String value){ | 
  | 46 | 0 |                  getParams().add(new SearchParam(key, value)); | 
  | 47 | 0 |          } | 
  | 48 |  |           | 
  | 49 |  |          public void addParam(String key, List<String> value){ | 
  | 50 | 0 |                  getParams().add(new SearchParam(key, value)); | 
  | 51 | 0 |          } | 
  | 52 |  |   | 
  | 53 |  |          public String getSearchKey() { | 
  | 54 | 0 |                  return searchKey; | 
  | 55 |  |          } | 
  | 56 |  |          public void setSearchKey(String searchKey) { | 
  | 57 | 0 |                  this.searchKey = searchKey; | 
  | 58 | 0 |          } | 
  | 59 |  |          public List<SearchParam> getParams() { | 
  | 60 | 0 |                  if(params == null){ | 
  | 61 | 0 |                          params = new ArrayList<SearchParam>(); | 
  | 62 |  |                  } | 
  | 63 | 0 |                  return params; | 
  | 64 |  |          } | 
  | 65 |  |          public void setParams(List<SearchParam> params) { | 
  | 66 | 0 |                  this.params = params; | 
  | 67 | 0 |          } | 
  | 68 |  |          public String getSortColumn() { | 
  | 69 | 0 |                  return sortColumn; | 
  | 70 |  |          } | 
  | 71 |  |          public void setSortColumn(String sortColumn) { | 
  | 72 | 0 |                  this.sortColumn = sortColumn; | 
  | 73 | 0 |          } | 
  | 74 |  |          public SortDirection getSortDirection() { | 
  | 75 | 0 |                  return sortDirection; | 
  | 76 |  |          } | 
  | 77 |  |          public void setSortDirection(SortDirection sortDirection) { | 
  | 78 | 0 |                  this.sortDirection = sortDirection; | 
  | 79 | 0 |          } | 
  | 80 |  |          public Integer getStartAt() { | 
  | 81 | 0 |                  return startAt; | 
  | 82 |  |          } | 
  | 83 |  |          public void setStartAt(Integer startAt) { | 
  | 84 | 0 |                  this.startAt = startAt; | 
  | 85 | 0 |          } | 
  | 86 |  |          public Integer getMaxResults() { | 
  | 87 | 0 |                  return maxResults; | 
  | 88 |  |          } | 
  | 89 |  |          public void setMaxResults(Integer maxResults) { | 
  | 90 | 0 |                  this.maxResults = maxResults; | 
  | 91 | 0 |          } | 
  | 92 |  |          public Boolean getNeededTotalResults() { | 
  | 93 | 0 |                  return neededTotalResults; | 
  | 94 |  |          } | 
  | 95 |  |          public void setNeededTotalResults(Boolean neededTotalResults) { | 
  | 96 | 0 |                  this.neededTotalResults = neededTotalResults; | 
  | 97 | 0 |          } | 
  | 98 |  |          @Override | 
  | 99 |  |          public String toString() { | 
  | 100 | 0 |                  return "SearchRequest [searchKey=" + searchKey + ", params=" + params | 
  | 101 |  |                                  + ", sortColumn=" + sortColumn + ", sortDirection=" | 
  | 102 |  |                                  + sortDirection + ", startAt=" + startAt + ", maxResults=" | 
  | 103 |  |                                  + maxResults + ", neededTotalResults=" + neededTotalResults | 
  | 104 |  |                                  + "]"; | 
  | 105 |  |          } | 
  | 106 |  |   | 
  | 107 |  |      @Override | 
  | 108 |  |      public boolean equals(Object o) { | 
  | 109 | 0 |          if (this == o) return true; | 
  | 110 | 0 |          if (o == null || getClass() != o.getClass()) return false; | 
  | 111 |  |   | 
  | 112 | 0 |          SearchRequest that = (SearchRequest) o; | 
  | 113 |  |   | 
  | 114 | 0 |          if (maxResults != null ? !maxResults.equals(that.maxResults) : that.maxResults != null) return false; | 
  | 115 | 0 |          if (neededTotalResults != null ? !neededTotalResults.equals(that.neededTotalResults) : that.neededTotalResults != null) | 
  | 116 | 0 |              return false; | 
  | 117 | 0 |          if (params != null ? !params.equals(that.params) : that.params != null) return false; | 
  | 118 | 0 |          if (searchKey != null ? !searchKey.equals(that.searchKey) : that.searchKey != null) return false; | 
  | 119 | 0 |          if (sortColumn != null ? !sortColumn.equals(that.sortColumn) : that.sortColumn != null) return false; | 
  | 120 | 0 |          if (sortDirection != that.sortDirection) return false; | 
  | 121 | 0 |          if (startAt != null ? !startAt.equals(that.startAt) : that.startAt != null) return false; | 
  | 122 |  |   | 
  | 123 | 0 |          return true; | 
  | 124 |  |      } | 
  | 125 |  |   | 
  | 126 |  |      @Override | 
  | 127 |  |      public int hashCode() { | 
  | 128 | 0 |          int result = searchKey != null ? searchKey.hashCode() : 0; | 
  | 129 | 0 |          result = 31 * result + (params != null ? params.hashCode() : 0); | 
  | 130 | 0 |          result = 31 * result + (sortColumn != null ? sortColumn.hashCode() : 0); | 
  | 131 | 0 |          result = 31 * result + (sortDirection != null ? sortDirection.hashCode() : 0); | 
  | 132 | 0 |          result = 31 * result + (startAt != null ? startAt.hashCode() : 0); | 
  | 133 | 0 |          result = 31 * result + (maxResults != null ? maxResults.hashCode() : 0); | 
  | 134 | 0 |          result = 31 * result + (neededTotalResults != null ? neededTotalResults.hashCode() : 0); | 
  | 135 | 0 |          return result; | 
  | 136 |  |      } | 
  | 137 |  |  } |