]> git.basschouten.com Git - openhab-addons.git/blob
63759ab8b0d97dce76f2bb8df2102da31ec01e31
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.verisure.internal.dto;
14
15 import static org.openhab.binding.verisure.internal.VerisureBindingConstants.THING_TYPE_USERPRESENCE;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.thing.ThingTypeUID;
20
21 import com.google.gson.annotations.SerializedName;
22
23 /**
24  * The user presences of the Verisure System.
25  *
26  * @author Jan Gustafsson - Initial contribution
27  *
28  */
29 @NonNullByDefault
30 public class VerisureUserPresencesDTO extends VerisureBaseThingDTO {
31
32     @Override
33     public ThingTypeUID getThingTypeUID() {
34         return THING_TYPE_USERPRESENCE;
35     }
36
37     @Override
38     public int hashCode() {
39         return super.hashCode();
40     }
41
42     @SuppressWarnings("PMD.SimplifyBooleanReturns")
43     @Override
44     public boolean equals(@Nullable Object obj) {
45         if (this == obj) {
46             return true;
47         }
48         if (!super.equals(obj)) {
49             return false;
50         }
51         if (obj == null) {
52             return false;
53         }
54         if (getClass() != obj.getClass()) {
55             return false;
56         }
57         return true;
58     }
59
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;
73
74         public boolean getIsCallingUser() {
75             return isCallingUser;
76         }
77
78         public @Nullable String getWebAccount() {
79             return webAccount;
80         }
81
82         public @Nullable String getStatus() {
83             return status;
84         }
85
86         public @Nullable String getXbnContactId() {
87             return xbnContactId;
88         }
89
90         public @Nullable String getCurrentLocationName() {
91             return currentLocationName;
92         }
93
94         public @Nullable String getDeviceId() {
95             return deviceId;
96         }
97
98         public @Nullable String getName() {
99             return name;
100         }
101
102         public @Nullable String getCurrentLocationTimestamp() {
103             return currentLocationTimestamp;
104         }
105
106         public @Nullable String getDeviceName() {
107             return deviceName;
108         }
109
110         public @Nullable String getCurrentLocationId() {
111             return currentLocationId;
112         }
113
114         public @Nullable String getTypename() {
115             return typename;
116         }
117
118         @Override
119         public int hashCode() {
120             final int prime = 31;
121             int result = 1;
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());
143             return result;
144         }
145
146         @Override
147         public boolean equals(@Nullable Object obj) {
148             if (this == obj) {
149                 return true;
150             }
151             if (obj == null) {
152                 return false;
153             }
154             if (getClass() != obj.getClass()) {
155                 return false;
156             }
157             UserTracking other = (UserTracking) obj;
158             String localCurrentLocationId = currentLocationId;
159             if (localCurrentLocationId == null) {
160                 if (other.currentLocationId != null) {
161                     return false;
162                 }
163             } else if (!localCurrentLocationId.equals(other.currentLocationId)) {
164                 return false;
165             }
166             String localCurrentLocationName = currentLocationName;
167             if (localCurrentLocationName == null) {
168                 if (other.currentLocationName != null) {
169                     return false;
170                 }
171             } else if (!localCurrentLocationName.equals(other.currentLocationName)) {
172                 return false;
173             }
174             String localCurrentLocationTimestamp = currentLocationTimestamp;
175             if (localCurrentLocationTimestamp == null) {
176                 if (other.currentLocationTimestamp != null) {
177                     return false;
178                 }
179             } else if (!localCurrentLocationTimestamp.equals(other.currentLocationTimestamp)) {
180                 return false;
181             }
182             if (!deviceId.equals(other.deviceId)) {
183                 return false;
184             }
185             String localDeviceName = deviceName;
186             if (localDeviceName == null) {
187                 if (other.deviceName != null) {
188                     return false;
189                 }
190             } else if (!localDeviceName.equals(other.deviceName)) {
191                 return false;
192             }
193             if (isCallingUser != other.isCallingUser) {
194                 return false;
195             }
196             String localName = name;
197             if (localName == null) {
198                 if (other.name != null) {
199                     return false;
200                 }
201             } else if (!localName.equals(other.name)) {
202                 return false;
203             }
204             String localStatus = status;
205             if (localStatus == null) {
206                 if (other.status != null) {
207                     return false;
208                 }
209             } else if (!localStatus.equals(other.status)) {
210                 return false;
211             }
212             String localTypeName = typename;
213             if (localTypeName == null) {
214                 if (other.typename != null) {
215                     return false;
216                 }
217             } else if (!localTypeName.equals(other.typename)) {
218                 return false;
219             }
220             String localWebAccount = webAccount;
221             if (localWebAccount == null) {
222                 if (other.webAccount != null) {
223                     return false;
224                 }
225             } else if (!localWebAccount.equals(other.webAccount)) {
226                 return false;
227             }
228             String localXbnContactId = xbnContactId;
229             if (localXbnContactId == null) {
230                 if (other.xbnContactId != null) {
231                     return false;
232                 }
233             } else if (!localXbnContactId.equals(other.xbnContactId)) {
234                 return false;
235             }
236             return true;
237         }
238
239         @Override
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="
245                     + typename + "]";
246         }
247     }
248 }