]> git.basschouten.com Git - openhab-addons.git/blob
0ee5c7fff17d748e850fe8f8d4dd9ad05efdaec3
[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     @Override
43     public boolean equals(@Nullable Object obj) {
44         if (this == obj) {
45             return true;
46         }
47         if (!super.equals(obj)) {
48             return false;
49         }
50         if (obj == null) {
51             return false;
52         }
53         if (getClass() != obj.getClass()) {
54             return false;
55         }
56         return true;
57     }
58
59     public static class UserTracking {
60         private boolean isCallingUser;
61         private @Nullable String webAccount;
62         private @Nullable String status;
63         private @Nullable String xbnContactId;
64         private @Nullable String currentLocationName;
65         private String deviceId = "";
66         private @Nullable String name;
67         private @Nullable String currentLocationTimestamp;
68         private @Nullable String deviceName;
69         private @Nullable String currentLocationId;
70         @SerializedName("__typename")
71         private @Nullable String typename;
72
73         public boolean getIsCallingUser() {
74             return isCallingUser;
75         }
76
77         public @Nullable String getWebAccount() {
78             return webAccount;
79         }
80
81         public @Nullable String getStatus() {
82             return status;
83         }
84
85         public @Nullable String getXbnContactId() {
86             return xbnContactId;
87         }
88
89         public @Nullable String getCurrentLocationName() {
90             return currentLocationName;
91         }
92
93         public @Nullable String getDeviceId() {
94             return deviceId;
95         }
96
97         public @Nullable String getName() {
98             return name;
99         }
100
101         public @Nullable String getCurrentLocationTimestamp() {
102             return currentLocationTimestamp;
103         }
104
105         public @Nullable String getDeviceName() {
106             return deviceName;
107         }
108
109         public @Nullable String getCurrentLocationId() {
110             return currentLocationId;
111         }
112
113         public @Nullable String getTypename() {
114             return typename;
115         }
116
117         @Override
118         public int hashCode() {
119             final int prime = 31;
120             int result = 1;
121             String localCurrentLocationId = currentLocationId;
122             result = prime * result + ((localCurrentLocationId == null) ? 0 : localCurrentLocationId.hashCode());
123             String localCurrentLocationName = currentLocationName;
124             result = prime * result + ((localCurrentLocationName == null) ? 0 : localCurrentLocationName.hashCode());
125             String localCurrentLocationTimestamp = currentLocationTimestamp;
126             result = prime * result
127                     + ((localCurrentLocationTimestamp == null) ? 0 : localCurrentLocationTimestamp.hashCode());
128             result = prime * result + deviceId.hashCode();
129             String localDeviceName = deviceName;
130             result = prime * result + ((localDeviceName == null) ? 0 : localDeviceName.hashCode());
131             result = prime * result + (isCallingUser ? 1231 : 1237);
132             String localName = name;
133             result = prime * result + ((localName == null) ? 0 : localName.hashCode());
134             String localStatus = status;
135             result = prime * result + ((localStatus == null) ? 0 : localStatus.hashCode());
136             String localTypeName = typename;
137             result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
138             String localWebAccount = webAccount;
139             result = prime * result + ((localWebAccount == null) ? 0 : localWebAccount.hashCode());
140             String localXbnContactId = xbnContactId;
141             result = prime * result + ((localXbnContactId == null) ? 0 : localXbnContactId.hashCode());
142             return result;
143         }
144
145         @Override
146         public boolean equals(@Nullable Object obj) {
147             if (this == obj) {
148                 return true;
149             }
150             if (obj == null) {
151                 return false;
152             }
153             if (getClass() != obj.getClass()) {
154                 return false;
155             }
156             UserTracking other = (UserTracking) obj;
157             String localCurrentLocationId = currentLocationId;
158             if (localCurrentLocationId == null) {
159                 if (other.currentLocationId != null) {
160                     return false;
161                 }
162             } else if (!localCurrentLocationId.equals(other.currentLocationId)) {
163                 return false;
164             }
165             String localCurrentLocationName = currentLocationName;
166             if (localCurrentLocationName == null) {
167                 if (other.currentLocationName != null) {
168                     return false;
169                 }
170             } else if (!localCurrentLocationName.equals(other.currentLocationName)) {
171                 return false;
172             }
173             String localCurrentLocationTimestamp = currentLocationTimestamp;
174             if (localCurrentLocationTimestamp == null) {
175                 if (other.currentLocationTimestamp != null) {
176                     return false;
177                 }
178             } else if (!localCurrentLocationTimestamp.equals(other.currentLocationTimestamp)) {
179                 return false;
180             }
181             if (!deviceId.equals(other.deviceId)) {
182                 return false;
183             }
184             String localDeviceName = deviceName;
185             if (localDeviceName == null) {
186                 if (other.deviceName != null) {
187                     return false;
188                 }
189             } else if (!localDeviceName.equals(other.deviceName)) {
190                 return false;
191             }
192             if (isCallingUser != other.isCallingUser) {
193                 return false;
194             }
195             String localName = name;
196             if (localName == null) {
197                 if (other.name != null) {
198                     return false;
199                 }
200             } else if (!localName.equals(other.name)) {
201                 return false;
202             }
203             String localStatus = status;
204             if (localStatus == null) {
205                 if (other.status != null) {
206                     return false;
207                 }
208             } else if (!localStatus.equals(other.status)) {
209                 return false;
210             }
211             String localTypeName = typename;
212             if (localTypeName == null) {
213                 if (other.typename != null) {
214                     return false;
215                 }
216             } else if (!localTypeName.equals(other.typename)) {
217                 return false;
218             }
219             String localWebAccount = webAccount;
220             if (localWebAccount == null) {
221                 if (other.webAccount != null) {
222                     return false;
223                 }
224             } else if (!localWebAccount.equals(other.webAccount)) {
225                 return false;
226             }
227             String localXbnContactId = xbnContactId;
228             if (localXbnContactId == null) {
229                 if (other.xbnContactId != null) {
230                     return false;
231                 }
232             } else if (!localXbnContactId.equals(other.xbnContactId)) {
233                 return false;
234             }
235             return true;
236         }
237
238         @Override
239         public String toString() {
240             return "UserTracking [isCallingUser=" + isCallingUser + ", webAccount=" + webAccount + ", status=" + status
241                     + ", xbnContactId=" + xbnContactId + ", currentLocationName=" + currentLocationName + ", deviceId="
242                     + deviceId + ", name=" + name + ", currentLocationTimestamp=" + currentLocationTimestamp
243                     + ", deviceName=" + deviceName + ", currentLocationId=" + currentLocationId + ", typename="
244                     + typename + "]";
245         }
246     }
247 }