-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathTrackingIdentity.java
86 lines (71 loc) · 2.32 KB
/
TrackingIdentity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.analytics;
import io.airbyte.commons.version.AirbyteVersion;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
@SuppressWarnings("PMD.CompareObjectsWithEquals")
public class TrackingIdentity {
private final AirbyteVersion airbyteVersion;
private final UUID customerId;
private final String email;
private final Boolean anonymousDataCollection;
private final Boolean news;
private final Boolean securityUpdates;
public static TrackingIdentity empty() {
return new TrackingIdentity(null, null, null, null, null, null);
}
public TrackingIdentity(
final AirbyteVersion airbyteVersion,
final UUID customerId,
final String email,
final Boolean anonymousDataCollection,
final Boolean news,
final Boolean securityUpdates) {
this.airbyteVersion = airbyteVersion;
this.customerId = customerId;
this.email = email;
this.anonymousDataCollection = anonymousDataCollection;
this.news = news;
this.securityUpdates = securityUpdates;
}
public AirbyteVersion getAirbyteVersion() {
return airbyteVersion;
}
public UUID getCustomerId() {
return customerId;
}
public Optional<String> getEmail() {
return Optional.ofNullable(email);
}
public boolean isAnonymousDataCollection() {
return anonymousDataCollection != null && anonymousDataCollection;
}
public boolean isNews() {
return news != null && news;
}
public boolean isSecurityUpdates() {
return securityUpdates != null && securityUpdates;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final TrackingIdentity that = (TrackingIdentity) o;
return anonymousDataCollection == that.anonymousDataCollection &&
news == that.news &&
securityUpdates == that.securityUpdates &&
Objects.equals(customerId, that.customerId) &&
Objects.equals(email, that.email);
}
@Override
public int hashCode() {
return Objects.hash(customerId, email, anonymousDataCollection, news, securityUpdates);
}
}