2 * Copyright (c) 2010-2021 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_ALARM;
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 alarms of the Verisure System.
27 * @author Jan Gustafsson - Initial contribution
31 public class VerisureAlarmsDTO extends VerisureBaseThingDTO {
34 public ThingTypeUID getThingTypeUID() {
35 return THING_TYPE_ALARM;
39 public int hashCode() {
40 return super.hashCode();
44 public boolean equals(@Nullable Object obj) {
48 if (!super.equals(obj)) {
54 if (getClass() != obj.getClass()) {
60 public static class ArmState {
62 private @Nullable String type;
63 private @Nullable String statusType;
64 private @Nullable String date;
65 private @Nullable String name;
66 private @Nullable String changedVia;
67 private boolean allowedForFirstLine;
68 private boolean allowed;
69 private List<Object> errorCodes = new ArrayList<>();
70 private @Nullable String typename;
72 public @Nullable String getType() {
76 public @Nullable String getStatusType() {
80 public void setStatusType(@Nullable String statusType) {
81 this.statusType = statusType;
84 public @Nullable String getDate() {
88 public @Nullable String getName() {
92 public @Nullable String getChangedVia() {
96 public boolean getAllowedForFirstLine() {
97 return allowedForFirstLine;
100 public boolean getAllowed() {
104 public List<Object> getErrorCodes() {
108 public @Nullable String getTypename() {
113 public int hashCode() {
114 final int prime = 31;
116 result = prime * result + (allowed ? 1231 : 1237);
117 result = prime * result + (allowedForFirstLine ? 1231 : 1237);
118 String localChangedVia = changedVia;
119 result = prime * result + ((localChangedVia == null) ? 0 : localChangedVia.hashCode());
120 String localDate = date;
121 result = prime * result + ((localDate == null) ? 0 : localDate.hashCode());
122 result = prime * result + errorCodes.hashCode();
123 String localName = name;
124 result = prime * result + ((localName == null) ? 0 : localName.hashCode());
125 String localStatusType = statusType;
126 result = prime * result + ((localStatusType == null) ? 0 : localStatusType.hashCode());
127 String localType = type;
128 result = prime * result + ((localType == null) ? 0 : localType.hashCode());
129 String localTypeName = typename;
130 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
135 public boolean equals(@Nullable Object obj) {
142 if (getClass() != obj.getClass()) {
145 ArmState other = (ArmState) obj;
146 if (allowed != other.allowed) {
149 if (allowedForFirstLine != other.allowedForFirstLine) {
152 String localChangedVia = changedVia;
153 if (localChangedVia == null) {
154 if (other.changedVia != null) {
157 } else if (!localChangedVia.equals(other.changedVia)) {
160 String localdate = date;
161 if (localdate == null) {
162 if (other.date != null) {
165 } else if (!localdate.equals(other.date)) {
168 if (!errorCodes.equals(other.errorCodes)) {
171 String localName = name;
172 if (localName == null) {
173 if (other.name != null) {
176 } else if (!localName.equals(other.name)) {
179 String localStatusType = statusType;
180 if (localStatusType == null) {
181 if (other.statusType != null) {
184 } else if (!localStatusType.equals(other.statusType)) {
187 String localType = type;
188 if (localType == null) {
189 if (other.type != null) {
192 } else if (!localType.equals(other.type)) {
195 String localTypeName = typename;
196 if (localTypeName == null) {
197 if (other.typename != null) {
200 } else if (!localTypeName.equals(other.typename)) {
207 public String toString() {
208 return "ArmState [type=" + type + ", statusType=" + statusType + ", date=" + date + ", name=" + name
209 + ", changedVia=" + changedVia + ", allowedForFirstLine=" + allowedForFirstLine + ", allowed="
210 + allowed + ", errorCodes=" + errorCodes + ", typename=" + typename + "]";