1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.common.lib.wa;
20
21 import java.time.OffsetDateTime;
22 import java.util.ArrayList;
23 import java.util.List;
24 import org.apache.commons.lang3.builder.EqualsBuilder;
25 import org.apache.commons.lang3.builder.HashCodeBuilder;
26 import org.apache.commons.lang3.builder.ToStringBuilder;
27 import org.apache.syncope.common.lib.BaseBean;
28
29 public class GoogleMfaAuthAccount implements BaseBean {
30
31 private static final long serialVersionUID = 1274073386484048953L;
32
33 public static class Builder {
34
35 private final GoogleMfaAuthAccount instance = new GoogleMfaAuthAccount();
36
37 public GoogleMfaAuthAccount.Builder registrationDate(final OffsetDateTime date) {
38 instance.setRegistrationDate(date);
39 return this;
40 }
41
42 public GoogleMfaAuthAccount.Builder scratchCodes(final List<Integer> codes) {
43 instance.setScratchCodes(codes);
44 return this;
45 }
46
47 public GoogleMfaAuthAccount.Builder secretKey(final String key) {
48 instance.setSecretKey(key);
49 return this;
50 }
51
52 public GoogleMfaAuthAccount.Builder validationCode(final Integer code) {
53 instance.setValidationCode(code);
54 return this;
55 }
56
57 public GoogleMfaAuthAccount.Builder id(final Long id) {
58 instance.setId(id);
59 return this;
60 }
61
62 public GoogleMfaAuthAccount.Builder name(final String name) {
63 instance.setName(name);
64 return this;
65 }
66
67 public GoogleMfaAuthAccount build() {
68 return instance;
69 }
70 }
71
72 private String secretKey;
73
74 private String name;
75
76 private int validationCode;
77
78 private long id;
79
80 private List<Integer> scratchCodes = new ArrayList<>(0);
81
82 private OffsetDateTime registrationDate;
83
84 public String getName() {
85 return name;
86 }
87
88 public void setName(final String name) {
89 this.name = name;
90 }
91
92 public long getId() {
93 return id;
94 }
95
96 public void setId(final long id) {
97 this.id = id;
98 }
99
100 public String getSecretKey() {
101 return secretKey;
102 }
103
104 public void setSecretKey(final String secretKey) {
105 this.secretKey = secretKey;
106 }
107
108 public int getValidationCode() {
109 return validationCode;
110 }
111
112 public void setValidationCode(final int validationCode) {
113 this.validationCode = validationCode;
114 }
115
116 public List<Integer> getScratchCodes() {
117 return scratchCodes;
118 }
119
120 public void setScratchCodes(final List<Integer> scratchCodes) {
121 this.scratchCodes = scratchCodes;
122 }
123
124 public OffsetDateTime getRegistrationDate() {
125 return registrationDate;
126 }
127
128 public void setRegistrationDate(final OffsetDateTime registrationDate) {
129 this.registrationDate = registrationDate;
130 }
131
132 @Override
133 public int hashCode() {
134 return new HashCodeBuilder()
135 .append(secretKey)
136 .append(name)
137 .append(id)
138 .append(scratchCodes)
139 .append(validationCode)
140 .append(registrationDate)
141 .toHashCode();
142 }
143
144 @Override
145 public boolean equals(final Object obj) {
146 if (obj == null) {
147 return false;
148 }
149 if (obj == this) {
150 return true;
151 }
152 if (obj.getClass() != getClass()) {
153 return false;
154 }
155 GoogleMfaAuthAccount other = (GoogleMfaAuthAccount) obj;
156 return new EqualsBuilder()
157 .append(this.secretKey, other.secretKey)
158 .append(this.name, other.name)
159 .append(this.id, other.id)
160 .append(this.scratchCodes, other.scratchCodes)
161 .append(this.registrationDate, other.registrationDate)
162 .append(this.validationCode, other.validationCode)
163 .isEquals();
164 }
165
166 @Override
167 public String toString() {
168 return new ToStringBuilder(this)
169 .append("name", name)
170 .append("secretKey", secretKey)
171 .append("id", id)
172 .append("scratchCodes", scratchCodes)
173 .append("registrationDate", registrationDate)
174 .append("validationCode", validationCode)
175 .toString();
176 }
177 }