]> git.basschouten.com Git - openhab-addons.git/blob
5e61d7ff5b514191878ee43d5e32d11e233d7072
[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_EVENT_LOG;
16
17 import java.util.ArrayList;
18 import java.util.List;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.core.thing.ThingTypeUID;
23
24 /**
25  * The event log of the Verisure System.
26  *
27  * @author Jan Gustafsson - Initial contribution
28  *
29  */
30 @NonNullByDefault
31 public class VerisureEventLogDTO extends VerisureBaseThingDTO {
32
33     @Override
34     public ThingTypeUID getThingTypeUID() {
35         return THING_TYPE_EVENT_LOG;
36     }
37
38     public static class EventLog {
39
40         private boolean moreDataAvailable;
41         private List<PagedList> pagedList = new ArrayList<>();
42         private @Nullable String typename;
43
44         public boolean isMoreDataAvailable() {
45             return moreDataAvailable;
46         }
47
48         public List<PagedList> getPagedList() {
49             return pagedList;
50         }
51
52         public @Nullable String getTypename() {
53             return typename;
54         }
55
56         @Override
57         public int hashCode() {
58             final int prime = 31;
59             int result = 1;
60             result = prime * result + (moreDataAvailable ? 1231 : 1237);
61             result = prime * result + pagedList.hashCode();
62             String localTypeName = typename;
63             result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
64             return result;
65         }
66
67         @Override
68         public boolean equals(@Nullable Object obj) {
69             if (this == obj) {
70                 return true;
71             }
72             if (obj == null) {
73                 return false;
74             }
75             if (getClass() != obj.getClass()) {
76                 return false;
77             }
78             EventLog other = (EventLog) obj;
79             if (moreDataAvailable != other.moreDataAvailable) {
80                 return false;
81             }
82             if (!pagedList.equals(other.pagedList)) {
83                 return false;
84             }
85             String localTypeName = typename;
86             if (localTypeName == null) {
87                 if (other.typename != null) {
88                     return false;
89                 }
90             } else if (!localTypeName.equals(other.typename)) {
91                 return false;
92             }
93             return true;
94         }
95
96         @Override
97         public String toString() {
98             return "EventLog [moreDataAvailable=" + moreDataAvailable + ", pagedList=" + pagedList + ", typename="
99                     + typename + "]";
100         }
101     }
102
103     public static class PagedList {
104
105         private @Nullable Device device = new Device();
106         private @Nullable String gatewayArea;
107         private @Nullable String eventType;
108         private @Nullable String eventCategory;
109         private @Nullable String eventSource;
110         private @Nullable String eventId;
111         private @Nullable String eventTime;
112         private @Nullable String userName;
113         private @Nullable String armState;
114         private @Nullable String userType;
115         private @Nullable String climateValue;
116         private @Nullable String sensorType;
117         private @Nullable String eventCount;
118         private @Nullable String typename;
119
120         public @Nullable Device getDevice() {
121             return device;
122         }
123
124         public @Nullable String getGatewayArea() {
125             return gatewayArea;
126         }
127
128         public @Nullable String getEventType() {
129             return eventType;
130         }
131
132         public @Nullable String getEventCategory() {
133             return eventCategory;
134         }
135
136         public @Nullable String getEventSource() {
137             return eventSource;
138         }
139
140         public @Nullable String getEventId() {
141             return eventId;
142         }
143
144         public @Nullable String getEventTime() {
145             return eventTime;
146         }
147
148         public @Nullable String getUserName() {
149             return userName;
150         }
151
152         public @Nullable String getArmState() {
153             return armState;
154         }
155
156         public @Nullable String getUserType() {
157             return userType;
158         }
159
160         public @Nullable String getClimateValue() {
161             return climateValue;
162         }
163
164         public @Nullable String getSensorType() {
165             return sensorType;
166         }
167
168         public @Nullable String getEventCount() {
169             return eventCount;
170         }
171
172         public @Nullable String getTypename() {
173             return typename;
174         }
175
176         @Override
177         public int hashCode() {
178             final int prime = 31;
179             int result = 1;
180             String localArmState = armState;
181             result = prime * result + ((localArmState == null) ? 0 : localArmState.hashCode());
182             String localClimateValue = climateValue;
183             result = prime * result + ((localClimateValue == null) ? 0 : localClimateValue.hashCode());
184             Device localDevice = device;
185             result = prime * result + ((localDevice == null) ? 0 : localDevice.hashCode());
186             String localEventCategory = eventCategory;
187             result = prime * result + ((localEventCategory == null) ? 0 : localEventCategory.hashCode());
188             String localEventCount = eventCount;
189             result = prime * result + ((localEventCount == null) ? 0 : localEventCount.hashCode());
190             String localEventId = eventId;
191             result = prime * result + ((localEventId == null) ? 0 : localEventId.hashCode());
192             String localEventSource = eventSource;
193             result = prime * result + ((localEventSource == null) ? 0 : localEventSource.hashCode());
194             String localEventTime = eventTime;
195             result = prime * result + ((localEventTime == null) ? 0 : localEventTime.hashCode());
196             String localEventType = eventType;
197             result = prime * result + ((localEventType == null) ? 0 : localEventType.hashCode());
198             String localGatewayArea = gatewayArea;
199             result = prime * result + ((localGatewayArea == null) ? 0 : localGatewayArea.hashCode());
200             String localSensorType = sensorType;
201             result = prime * result + ((localSensorType == null) ? 0 : localSensorType.hashCode());
202             String localTypeName = typename;
203             result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
204             String localUserName = userName;
205             result = prime * result + ((localUserName == null) ? 0 : localUserName.hashCode());
206             String localUserType = userType;
207             result = prime * result + ((localUserType == null) ? 0 : localUserType.hashCode());
208             return result;
209         }
210
211         @Override
212         public boolean equals(@Nullable Object obj) {
213             if (this == obj) {
214                 return true;
215             }
216             if (obj == null) {
217                 return false;
218             }
219             if (getClass() != obj.getClass()) {
220                 return false;
221             }
222             PagedList other = (PagedList) obj;
223             String localArmState = armState;
224             if (localArmState == null) {
225                 if (other.armState != null) {
226                     return false;
227                 }
228             } else if (!localArmState.equals(other.armState)) {
229                 return false;
230             }
231             String localClimateValue = climateValue;
232             if (localClimateValue == null) {
233                 if (other.climateValue != null) {
234                     return false;
235                 }
236             } else if (!localClimateValue.equals(other.climateValue)) {
237                 return false;
238             }
239             Device localDevice = device;
240             if (localDevice == null) {
241                 if (other.device != null) {
242                     return false;
243                 }
244             } else if (!localDevice.equals(other.device)) {
245                 return false;
246             }
247             String localEventCategory = eventCategory;
248             if (localEventCategory == null) {
249                 if (other.eventCategory != null) {
250                     return false;
251                 }
252             } else if (!localEventCategory.equals(other.eventCategory)) {
253                 return false;
254             }
255             String localEventCount = eventCount;
256             if (localEventCount == null) {
257                 if (other.eventCount != null) {
258                     return false;
259                 }
260             } else if (!localEventCount.equals(other.eventCount)) {
261                 return false;
262             }
263             String localEventId = eventId;
264             if (localEventId == null) {
265                 if (other.eventId != null) {
266                     return false;
267                 }
268             } else if (!localEventId.equals(other.eventId)) {
269                 return false;
270             }
271             String localEventSource = eventSource;
272             if (localEventSource == null) {
273                 if (other.eventSource != null) {
274                     return false;
275                 }
276             } else if (!localEventSource.equals(other.eventSource)) {
277                 return false;
278             }
279             String localEventTime = eventTime;
280             if (localEventTime == null) {
281                 if (other.eventTime != null) {
282                     return false;
283                 }
284             } else if (!localEventTime.equals(other.eventTime)) {
285                 return false;
286             }
287             String localEventType = eventType;
288             if (localEventType == null) {
289                 if (other.eventType != null) {
290                     return false;
291                 }
292             } else if (!localEventType.equals(other.eventType)) {
293                 return false;
294             }
295             String localGatewayArea = gatewayArea;
296             if (localGatewayArea == null) {
297                 if (other.gatewayArea != null) {
298                     return false;
299                 }
300             } else if (!localGatewayArea.equals(other.gatewayArea)) {
301                 return false;
302             }
303             String localSensorType = sensorType;
304             if (localSensorType == null) {
305                 if (other.sensorType != null) {
306                     return false;
307                 }
308             } else if (!localSensorType.equals(other.sensorType)) {
309                 return false;
310             }
311             String localTypeName = typename;
312             if (localTypeName == null) {
313                 if (other.typename != null) {
314                     return false;
315                 }
316             } else if (!localTypeName.equals(other.typename)) {
317                 return false;
318             }
319             String localUserName = userName;
320             if (localUserName == null) {
321                 if (other.userName != null) {
322                     return false;
323                 }
324             } else if (!localUserName.equals(other.userName)) {
325                 return false;
326             }
327             String localUserType = userType;
328             if (localUserType == null) {
329                 if (other.userType != null) {
330                     return false;
331                 }
332             } else if (!localUserType.equals(other.userType)) {
333                 return false;
334             }
335             return true;
336         }
337
338         @Override
339         public String toString() {
340             return "PagedList [device=" + device + ", gatewayArea=" + gatewayArea + ", eventType=" + eventType
341                     + ", eventCategory=" + eventCategory + ", eventSource=" + eventSource + ", eventId=" + eventId
342                     + ", eventTime=" + eventTime + ", userName=" + userName + ", armState=" + armState + ", userType="
343                     + userType + ", climateValue=" + climateValue + ", sensorType=" + sensorType + ", eventCount="
344                     + eventCount + ", typename=" + typename + "]";
345         }
346     }
347 }