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.time.OffsetDateTime;
22  import org.apache.commons.lang3.builder.EqualsBuilder;
23  import org.apache.commons.lang3.builder.HashCodeBuilder;
24  
25  public class AccessTokenTO implements EntityTO {
26  
27      private static final long serialVersionUID = 6577639976115661357L;
28  
29      private String key;
30  
31      private String body;
32  
33      private OffsetDateTime expirationTime;
34  
35      private String owner;
36  
37      @Override
38      public String getKey() {
39          return key;
40      }
41  
42      @Override
43      public void setKey(final String key) {
44          this.key = key;
45      }
46  
47      public String getBody() {
48          return body;
49      }
50  
51      public void setBody(final String body) {
52          this.body = body;
53      }
54  
55      public OffsetDateTime getExpirationTime() {
56          return expirationTime;
57      }
58  
59      public void setExpirationTime(final OffsetDateTime expirationTime) {
60          this.expirationTime = expirationTime;
61      }
62  
63      public String getOwner() {
64          return owner;
65      }
66  
67      public void setOwner(final String owner) {
68          this.owner = owner;
69      }
70  
71      @Override
72      public boolean equals(final Object obj) {
73          if (this == obj) {
74              return true;
75          }
76          if (obj == null) {
77              return false;
78          }
79          if (getClass() != obj.getClass()) {
80              return false;
81          }
82          AccessTokenTO other = (AccessTokenTO) obj;
83          return new EqualsBuilder().
84                  append(key, other.key).
85                  append(body, other.body).
86                  append(expirationTime, other.expirationTime).
87                  append(owner, other.owner).
88                  build();
89      }
90  
91      @Override
92      public int hashCode() {
93          return new HashCodeBuilder().
94                  append(key).
95                  append(body).
96                  append(expirationTime).
97                  append(owner).
98                  build();
99      }
100 }