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_EVENT_LOG;
17 import java.util.ArrayList;
18 import java.util.List;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.core.thing.ThingTypeUID;
25 * The event log of the Verisure System.
27 * @author Jan Gustafsson - Initial contribution
31 public class VerisureEventLogDTO extends VerisureBaseThingDTO {
34 public ThingTypeUID getThingTypeUID() {
35 return THING_TYPE_EVENT_LOG;
38 public static class EventLog {
40 private boolean moreDataAvailable;
41 private List<PagedList> pagedList = new ArrayList<>();
42 private @Nullable String typename;
44 public boolean isMoreDataAvailable() {
45 return moreDataAvailable;
48 public List<PagedList> getPagedList() {
52 public @Nullable String getTypename() {
57 public int hashCode() {
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());
68 public boolean equals(@Nullable Object obj) {
75 if (getClass() != obj.getClass()) {
78 EventLog other = (EventLog) obj;
79 if (moreDataAvailable != other.moreDataAvailable) {
82 if (!pagedList.equals(other.pagedList)) {
85 String localTypeName = typename;
86 if (localTypeName == null) {
87 if (other.typename != null) {
90 } else if (!localTypeName.equals(other.typename)) {
97 public String toString() {
98 return "EventLog [moreDataAvailable=" + moreDataAvailable + ", pagedList=" + pagedList + ", typename="
103 public static class PagedList {
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;
120 public @Nullable Device getDevice() {
124 public @Nullable String getGatewayArea() {
128 public @Nullable String getEventType() {
132 public @Nullable String getEventCategory() {
133 return eventCategory;
136 public @Nullable String getEventSource() {
140 public @Nullable String getEventId() {
144 public @Nullable String getEventTime() {
148 public @Nullable String getUserName() {
152 public @Nullable String getArmState() {
156 public @Nullable String getUserType() {
160 public @Nullable String getClimateValue() {
164 public @Nullable String getSensorType() {
168 public @Nullable String getEventCount() {
172 public @Nullable String getTypename() {
177 public int hashCode() {
178 final int prime = 31;
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());
212 public boolean equals(@Nullable Object obj) {
219 if (getClass() != obj.getClass()) {
222 PagedList other = (PagedList) obj;
223 String localArmState = armState;
224 if (localArmState == null) {
225 if (other.armState != null) {
228 } else if (!localArmState.equals(other.armState)) {
231 String localClimateValue = climateValue;
232 if (localClimateValue == null) {
233 if (other.climateValue != null) {
236 } else if (!localClimateValue.equals(other.climateValue)) {
239 Device localDevice = device;
240 if (localDevice == null) {
241 if (other.device != null) {
244 } else if (!localDevice.equals(other.device)) {
247 String localEventCategory = eventCategory;
248 if (localEventCategory == null) {
249 if (other.eventCategory != null) {
252 } else if (!localEventCategory.equals(other.eventCategory)) {
255 String localEventCount = eventCount;
256 if (localEventCount == null) {
257 if (other.eventCount != null) {
260 } else if (!localEventCount.equals(other.eventCount)) {
263 String localEventId = eventId;
264 if (localEventId == null) {
265 if (other.eventId != null) {
268 } else if (!localEventId.equals(other.eventId)) {
271 String localEventSource = eventSource;
272 if (localEventSource == null) {
273 if (other.eventSource != null) {
276 } else if (!localEventSource.equals(other.eventSource)) {
279 String localEventTime = eventTime;
280 if (localEventTime == null) {
281 if (other.eventTime != null) {
284 } else if (!localEventTime.equals(other.eventTime)) {
287 String localEventType = eventType;
288 if (localEventType == null) {
289 if (other.eventType != null) {
292 } else if (!localEventType.equals(other.eventType)) {
295 String localGatewayArea = gatewayArea;
296 if (localGatewayArea == null) {
297 if (other.gatewayArea != null) {
300 } else if (!localGatewayArea.equals(other.gatewayArea)) {
303 String localSensorType = sensorType;
304 if (localSensorType == null) {
305 if (other.sensorType != null) {
308 } else if (!localSensorType.equals(other.sensorType)) {
311 String localTypeName = typename;
312 if (localTypeName == null) {
313 if (other.typename != null) {
316 } else if (!localTypeName.equals(other.typename)) {
319 String localUserName = userName;
320 if (localUserName == null) {
321 if (other.userName != null) {
324 } else if (!localUserName.equals(other.userName)) {
327 String localUserType = userType;
328 if (localUserType == null) {
329 if (other.userType != null) {
332 } else if (!localUserType.equals(other.userType)) {
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 + "]";