2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.verisure.internal.dto;
15 import static org.openhab.binding.verisure.internal.VerisureBindingConstants.THING_TYPE_USERPRESENCE;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.thing.ThingTypeUID;
21 import com.google.gson.annotations.SerializedName;
24 * The user presences of the Verisure System.
26 * @author Jan Gustafsson - Initial contribution
30 public class VerisureUserPresencesDTO extends VerisureBaseThingDTO {
33 public ThingTypeUID getThingTypeUID() {
34 return THING_TYPE_USERPRESENCE;
38 public int hashCode() {
39 return super.hashCode();
42 @SuppressWarnings("PMD.SimplifyBooleanReturns")
44 public boolean equals(@Nullable Object obj) {
48 if (!super.equals(obj)) {
54 if (getClass() != obj.getClass()) {
60 public static class UserTracking {
61 private boolean isCallingUser;
62 private @Nullable String webAccount;
63 private @Nullable String status;
64 private @Nullable String xbnContactId;
65 private @Nullable String currentLocationName;
66 private String deviceId = "";
67 private @Nullable String name;
68 private @Nullable String currentLocationTimestamp;
69 private @Nullable String deviceName;
70 private @Nullable String currentLocationId;
71 @SerializedName("__typename")
72 private @Nullable String typename;
74 public boolean getIsCallingUser() {
78 public @Nullable String getWebAccount() {
82 public @Nullable String getStatus() {
86 public @Nullable String getXbnContactId() {
90 public @Nullable String getCurrentLocationName() {
91 return currentLocationName;
94 public @Nullable String getDeviceId() {
98 public @Nullable String getName() {
102 public @Nullable String getCurrentLocationTimestamp() {
103 return currentLocationTimestamp;
106 public @Nullable String getDeviceName() {
110 public @Nullable String getCurrentLocationId() {
111 return currentLocationId;
114 public @Nullable String getTypename() {
119 public int hashCode() {
120 final int prime = 31;
122 String localCurrentLocationId = currentLocationId;
123 result = prime * result + ((localCurrentLocationId == null) ? 0 : localCurrentLocationId.hashCode());
124 String localCurrentLocationName = currentLocationName;
125 result = prime * result + ((localCurrentLocationName == null) ? 0 : localCurrentLocationName.hashCode());
126 String localCurrentLocationTimestamp = currentLocationTimestamp;
127 result = prime * result
128 + ((localCurrentLocationTimestamp == null) ? 0 : localCurrentLocationTimestamp.hashCode());
129 result = prime * result + deviceId.hashCode();
130 String localDeviceName = deviceName;
131 result = prime * result + ((localDeviceName == null) ? 0 : localDeviceName.hashCode());
132 result = prime * result + (isCallingUser ? 1231 : 1237);
133 String localName = name;
134 result = prime * result + ((localName == null) ? 0 : localName.hashCode());
135 String localStatus = status;
136 result = prime * result + ((localStatus == null) ? 0 : localStatus.hashCode());
137 String localTypeName = typename;
138 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
139 String localWebAccount = webAccount;
140 result = prime * result + ((localWebAccount == null) ? 0 : localWebAccount.hashCode());
141 String localXbnContactId = xbnContactId;
142 result = prime * result + ((localXbnContactId == null) ? 0 : localXbnContactId.hashCode());
147 public boolean equals(@Nullable Object obj) {
154 if (getClass() != obj.getClass()) {
157 UserTracking other = (UserTracking) obj;
158 String localCurrentLocationId = currentLocationId;
159 if (localCurrentLocationId == null) {
160 if (other.currentLocationId != null) {
163 } else if (!localCurrentLocationId.equals(other.currentLocationId)) {
166 String localCurrentLocationName = currentLocationName;
167 if (localCurrentLocationName == null) {
168 if (other.currentLocationName != null) {
171 } else if (!localCurrentLocationName.equals(other.currentLocationName)) {
174 String localCurrentLocationTimestamp = currentLocationTimestamp;
175 if (localCurrentLocationTimestamp == null) {
176 if (other.currentLocationTimestamp != null) {
179 } else if (!localCurrentLocationTimestamp.equals(other.currentLocationTimestamp)) {
182 if (!deviceId.equals(other.deviceId)) {
185 String localDeviceName = deviceName;
186 if (localDeviceName == null) {
187 if (other.deviceName != null) {
190 } else if (!localDeviceName.equals(other.deviceName)) {
193 if (isCallingUser != other.isCallingUser) {
196 String localName = name;
197 if (localName == null) {
198 if (other.name != null) {
201 } else if (!localName.equals(other.name)) {
204 String localStatus = status;
205 if (localStatus == null) {
206 if (other.status != null) {
209 } else if (!localStatus.equals(other.status)) {
212 String localTypeName = typename;
213 if (localTypeName == null) {
214 if (other.typename != null) {
217 } else if (!localTypeName.equals(other.typename)) {
220 String localWebAccount = webAccount;
221 if (localWebAccount == null) {
222 if (other.webAccount != null) {
225 } else if (!localWebAccount.equals(other.webAccount)) {
228 String localXbnContactId = xbnContactId;
229 if (localXbnContactId == null) {
230 if (other.xbnContactId != null) {
233 } else if (!localXbnContactId.equals(other.xbnContactId)) {
240 public String toString() {
241 return "UserTracking [isCallingUser=" + isCallingUser + ", webAccount=" + webAccount + ", status=" + status
242 + ", xbnContactId=" + xbnContactId + ", currentLocationName=" + currentLocationName + ", deviceId="
243 + deviceId + ", name=" + name + ", currentLocationTimestamp=" + currentLocationTimestamp
244 + ", deviceName=" + deviceName + ", currentLocationId=" + currentLocationId + ", typename="