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.wa;
20  
21  import java.time.ZonedDateTime;
22  import org.apache.commons.lang3.builder.EqualsBuilder;
23  import org.apache.commons.lang3.builder.HashCodeBuilder;
24  import org.apache.commons.lang3.builder.ToStringBuilder;
25  import org.apache.syncope.common.lib.BaseBean;
26  
27  public class MfaTrustedDevice implements BaseBean {
28  
29      private static final long serialVersionUID = 5120423450725182470L;
30  
31      private long id;
32  
33      private String name;
34  
35      private String deviceFingerprint;
36  
37      private String recordKey;
38  
39      private ZonedDateTime recordDate;
40  
41      private ZonedDateTime expirationDate;
42  
43      public long getId() {
44          return id;
45      }
46  
47      public void setId(final long id) {
48          this.id = id;
49      }
50  
51      public String getName() {
52          return name;
53      }
54  
55      public void setName(final String name) {
56          this.name = name;
57      }
58  
59      public String getDeviceFingerprint() {
60          return deviceFingerprint;
61      }
62  
63      public void setDeviceFingerprint(final String deviceFingerprint) {
64          this.deviceFingerprint = deviceFingerprint;
65      }
66  
67      public ZonedDateTime getRecordDate() {
68          return recordDate;
69      }
70  
71      public void setRecordDate(final ZonedDateTime recordDate) {
72          this.recordDate = recordDate;
73      }
74  
75      public String getRecordKey() {
76          return recordKey;
77      }
78  
79      public void setRecordKey(final String recordKey) {
80          this.recordKey = recordKey;
81      }
82  
83      public ZonedDateTime getExpirationDate() {
84          return expirationDate;
85      }
86  
87      public void setExpirationDate(final ZonedDateTime expirationDate) {
88          this.expirationDate = expirationDate;
89      }
90  
91      @Override
92      public int hashCode() {
93          return new HashCodeBuilder()
94                  .append(id)
95                  .append(name)
96                  .append(deviceFingerprint)
97                  .append(recordDate)
98                  .append(recordKey)
99                  .append(expirationDate)
100                 .toHashCode();
101     }
102 
103     @Override
104     public boolean equals(final Object obj) {
105         if (obj == null) {
106             return false;
107         }
108         if (obj == this) {
109             return true;
110         }
111         if (obj.getClass() != getClass()) {
112             return false;
113         }
114         MfaTrustedDevice other = (MfaTrustedDevice) obj;
115         return new EqualsBuilder()
116                 .append(this.id, other.id)
117                 .append(this.name, other.name)
118                 .append(this.deviceFingerprint, other.deviceFingerprint)
119                 .append(this.recordDate, other.recordDate)
120                 .append(this.recordKey, other.recordKey)
121                 .append(this.expirationDate, other.expirationDate)
122                 .isEquals();
123     }
124 
125     @Override
126     public String toString() {
127         return new ToStringBuilder(this)
128                 .append("id", id)
129                 .append("name", name)
130                 .append("deviceFingerprint", deviceFingerprint)
131                 .append("recordDate", recordDate)
132                 .append("recordKey", recordKey)
133                 .append("expirationDate", expirationDate)
134                 .toString();
135     }
136 }