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.lib.to;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  import javax.ws.rs.PathParam;
24  import org.apache.commons.lang3.builder.EqualsBuilder;
25  import org.apache.commons.lang3.builder.HashCodeBuilder;
26  import org.apache.syncope.common.lib.auth.AuthModuleConf;
27  import org.apache.syncope.common.lib.types.AuthModuleState;
28  
29  public class AuthModuleTO implements EntityTO {
30  
31      private static final long serialVersionUID = -7490425997956703057L;
32  
33      private String key;
34  
35      private String description;
36  
37      private AuthModuleState state = AuthModuleState.ACTIVE;
38  
39      private int order = 0;
40  
41      private final List<Item> items = new ArrayList<>();
42  
43      private AuthModuleConf conf;
44  
45      @Override
46      public String getKey() {
47          return key;
48      }
49  
50      @PathParam("key")
51      @Override
52      public void setKey(final String key) {
53          this.key = key;
54      }
55  
56      public String getDescription() {
57          return description;
58      }
59  
60      public void setDescription(final String description) {
61          this.description = description;
62      }
63  
64      public AuthModuleState getState() {
65          return state;
66      }
67  
68      public void setState(final AuthModuleState state) {
69          this.state = state;
70      }
71  
72      public int getOrder() {
73          return order;
74      }
75  
76      public void setOrder(final int order) {
77          this.order = order;
78      }
79  
80      public List<Item> getItems() {
81          return items;
82      }
83  
84      public AuthModuleConf getConf() {
85          return conf;
86      }
87  
88      public void setConf(final AuthModuleConf conf) {
89          this.conf = conf;
90      }
91  
92      @Override
93      public boolean equals(final Object obj) {
94          if (this == obj) {
95              return true;
96          }
97          if (obj == null) {
98              return false;
99          }
100         if (getClass() != obj.getClass()) {
101             return false;
102         }
103         AuthModuleTO other = (AuthModuleTO) obj;
104         return new EqualsBuilder().
105                 append(key, other.key).
106                 append(description, other.description).
107                 append(state, other.state).
108                 append(order, other.order).
109                 append(items, other.items).
110                 append(conf, other.conf).
111                 build();
112     }
113 
114     @Override
115     public int hashCode() {
116         return new HashCodeBuilder().
117                 append(key).
118                 append(description).
119                 append(items).
120                 append(conf).
121                 build();
122     }
123 }