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.core.persistence.api.dao.search;
20  
21  import org.apache.commons.lang3.builder.EqualsBuilder;
22  import org.apache.commons.lang3.builder.HashCodeBuilder;
23  import org.apache.commons.lang3.builder.ToStringBuilder;
24  
25  public class AssignableCond extends AbstractSearchCond {
26  
27      private static final long serialVersionUID = 1237627275756159522L;
28  
29      private String realmFullPath;
30  
31      /**
32       * Whether this condition should be evaluated from the assignable group's or instead the
33       * assignee's point of view (default).
34       * The converter from FIQL will ignore this setting, which is meant for internal usage.
35       */
36      private boolean fromGroup = false;
37  
38      public String getRealmFullPath() {
39          return realmFullPath;
40      }
41  
42      public void setRealmFullPath(final String realmFullPath) {
43          this.realmFullPath = realmFullPath;
44      }
45  
46      public boolean isFromGroup() {
47          return fromGroup;
48      }
49  
50      public void setFromGroup(final boolean fromGroup) {
51          this.fromGroup = fromGroup;
52      }
53  
54      @Override
55      public final boolean isValid() {
56          return realmFullPath != null;
57      }
58  
59      @Override
60      public int hashCode() {
61          return new HashCodeBuilder().
62                  append(realmFullPath).
63                  append(fromGroup).
64                  build();
65      }
66  
67      @Override
68      public boolean equals(final Object obj) {
69          if (this == obj) {
70              return true;
71          }
72          if (obj == null) {
73              return false;
74          }
75          if (getClass() != obj.getClass()) {
76              return false;
77          }
78          final AssignableCond other = (AssignableCond) obj;
79          return new EqualsBuilder().
80                  append(realmFullPath, other.realmFullPath).
81                  append(fromGroup, other.fromGroup).
82                  build();
83      }
84  
85      @Override
86      public String toString() {
87          return new ToStringBuilder(this).
88                  append(realmFullPath).
89                  append(fromGroup).
90                  build();
91      }
92  }