View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.common.rest.api.beans;
20  
21  import javax.ws.rs.QueryParam;
22  import org.apache.commons.lang3.builder.EqualsBuilder;
23  import org.apache.commons.lang3.builder.HashCodeBuilder;
24  
25  public class RealmQuery extends AbstractQuery {
26  
27      private static final long serialVersionUID = -2278419397595186866L;
28  
29      public static class Builder extends AbstractQuery.Builder<RealmQuery, Builder> {
30  
31          @Override
32          protected RealmQuery newInstance() {
33              return new RealmQuery();
34          }
35  
36          public Builder keyword(final String keyword) {
37              getInstance().setKeyword(keyword);
38              return this;
39          }
40  
41          public Builder base(final String base) {
42              getInstance().setBase(base);
43              return this;
44          }
45      }
46  
47      private String keyword;
48  
49      private String base;
50  
51      public String getKeyword() {
52          return keyword;
53      }
54  
55      @QueryParam("keyword")
56      public void setKeyword(final String keyword) {
57          this.keyword = keyword;
58      }
59  
60      public String getBase() {
61          return base;
62      }
63  
64      @QueryParam("base")
65      public void setBase(final String base) {
66          this.base = base;
67      }
68  
69      @Override
70      public boolean equals(final Object obj) {
71          if (this == obj) {
72              return true;
73          }
74          if (obj == null) {
75              return false;
76          }
77          if (getClass() != obj.getClass()) {
78              return false;
79          }
80          RealmQuery other = (RealmQuery) obj;
81          return new EqualsBuilder().
82                  appendSuper(super.equals(obj)).
83                  append(keyword, other.keyword).
84                  append(base, other.base).
85                  build();
86      }
87  
88      @Override
89      public int hashCode() {
90          return new HashCodeBuilder().
91                  appendSuper(super.hashCode()).
92                  append(keyword).
93                  append(base).
94                  build();
95      }
96  }