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 org.apache.commons.lang3.builder.EqualsBuilder;
22  import org.apache.commons.lang3.builder.HashCodeBuilder;
23  
24  public class SAML2SPEntityTO extends SAML2EntityTO {
25  
26      private static final long serialVersionUID = 6215073386484048953L;
27  
28      public static class Builder extends SAML2EntityTO.Builder<SAML2SPEntityTO, Builder> {
29  
30          @Override
31          protected SAML2SPEntityTO newInstance() {
32              return new SAML2SPEntityTO();
33          }
34  
35          public Builder keystore(final String keystore) {
36              getInstance().setKeystore(keystore);
37              return this;
38          }
39  
40          public Builder metadata(final String metadata) {
41              getInstance().setMetadata(metadata);
42              return this;
43          }
44      }
45  
46      private String keystore;
47  
48      private String metadata;
49  
50      public String getKeystore() {
51          return keystore;
52      }
53  
54      public void setKeystore(final String keystore) {
55          this.keystore = keystore;
56      }
57  
58      public String getMetadata() {
59          return metadata;
60      }
61  
62      public void setMetadata(final String metadata) {
63          this.metadata = metadata;
64      }
65  
66      @Override
67      public int hashCode() {
68          return new HashCodeBuilder().
69                  appendSuper(super.hashCode()).
70                  append(keystore).
71                  append(metadata).
72                  build();
73      }
74  
75      @Override
76      public boolean equals(final Object obj) {
77          if (this == obj) {
78              return true;
79          }
80          if (obj == null) {
81              return false;
82          }
83          if (getClass() != obj.getClass()) {
84              return false;
85          }
86          SAML2SPEntityTO other = (SAML2SPEntityTO) obj;
87          return new EqualsBuilder().
88                  appendSuper(super.equals(obj)).
89                  append(keystore, other.keystore).
90                  append(metadata, other.metadata).
91                  build();
92      }
93  }