]> git.basschouten.com Git - openhab-addons.git/blob
6e9ee768640c4f90141f69c1f533fe6d31e4745d
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.nest.internal.wwn.dto;
14
15 import java.util.Date;
16 import java.util.List;
17
18 /**
19  * The data for the WWN camera.
20  *
21  * @author David Bennett - Initial contribution
22  * @author Wouter Born - Add equals and hashCode methods
23  */
24 public class WWNCamera extends BaseWWNDevice {
25
26     private Boolean isStreaming;
27     private Boolean isAudioInputEnabled;
28     private Date lastIsOnlineChange;
29     private Boolean isVideoHistoryEnabled;
30     private String webUrl;
31     private String appUrl;
32     private Boolean isPublicShareEnabled;
33     private List<WWNActivityZone> activityZones;
34     private String publicShareUrl;
35     private String snapshotUrl;
36     private WWNCameraEvent lastEvent;
37
38     public Boolean isStreaming() {
39         return isStreaming;
40     }
41
42     public Boolean isAudioInputEnabled() {
43         return isAudioInputEnabled;
44     }
45
46     public Date getLastIsOnlineChange() {
47         return lastIsOnlineChange;
48     }
49
50     public Boolean isVideoHistoryEnabled() {
51         return isVideoHistoryEnabled;
52     }
53
54     public String getWebUrl() {
55         return webUrl;
56     }
57
58     public String getAppUrl() {
59         return appUrl;
60     }
61
62     public Boolean isPublicShareEnabled() {
63         return isPublicShareEnabled;
64     }
65
66     public List<WWNActivityZone> getActivityZones() {
67         return activityZones;
68     }
69
70     public String getPublicShareUrl() {
71         return publicShareUrl;
72     }
73
74     public String getSnapshotUrl() {
75         return snapshotUrl;
76     }
77
78     public WWNCameraEvent getLastEvent() {
79         return lastEvent;
80     }
81
82     @Override
83     public boolean equals(Object obj) {
84         if (this == obj) {
85             return true;
86         }
87         if (obj == null || !super.equals(obj)) {
88             return false;
89         }
90         if (getClass() != obj.getClass()) {
91             return false;
92         }
93         WWNCamera other = (WWNCamera) obj;
94         if (activityZones == null) {
95             if (other.activityZones != null) {
96                 return false;
97             }
98         } else if (!activityZones.equals(other.activityZones)) {
99             return false;
100         }
101         if (appUrl == null) {
102             if (other.appUrl != null) {
103                 return false;
104             }
105         } else if (!appUrl.equals(other.appUrl)) {
106             return false;
107         }
108         if (isAudioInputEnabled == null) {
109             if (other.isAudioInputEnabled != null) {
110                 return false;
111             }
112         } else if (!isAudioInputEnabled.equals(other.isAudioInputEnabled)) {
113             return false;
114         }
115         if (isPublicShareEnabled == null) {
116             if (other.isPublicShareEnabled != null) {
117                 return false;
118             }
119         } else if (!isPublicShareEnabled.equals(other.isPublicShareEnabled)) {
120             return false;
121         }
122         if (isStreaming == null) {
123             if (other.isStreaming != null) {
124                 return false;
125             }
126         } else if (!isStreaming.equals(other.isStreaming)) {
127             return false;
128         }
129         if (isVideoHistoryEnabled == null) {
130             if (other.isVideoHistoryEnabled != null) {
131                 return false;
132             }
133         } else if (!isVideoHistoryEnabled.equals(other.isVideoHistoryEnabled)) {
134             return false;
135         }
136         if (lastEvent == null) {
137             if (other.lastEvent != null) {
138                 return false;
139             }
140         } else if (!lastEvent.equals(other.lastEvent)) {
141             return false;
142         }
143         if (lastIsOnlineChange == null) {
144             if (other.lastIsOnlineChange != null) {
145                 return false;
146             }
147         } else if (!lastIsOnlineChange.equals(other.lastIsOnlineChange)) {
148             return false;
149         }
150         if (publicShareUrl == null) {
151             if (other.publicShareUrl != null) {
152                 return false;
153             }
154         } else if (!publicShareUrl.equals(other.publicShareUrl)) {
155             return false;
156         }
157         if (snapshotUrl == null) {
158             if (other.snapshotUrl != null) {
159                 return false;
160             }
161         } else if (!snapshotUrl.equals(other.snapshotUrl)) {
162             return false;
163         }
164         if (webUrl == null) {
165             if (other.webUrl != null) {
166                 return false;
167             }
168         } else if (!webUrl.equals(other.webUrl)) {
169             return false;
170         }
171         return true;
172     }
173
174     @Override
175     public int hashCode() {
176         final int prime = 31;
177         int result = super.hashCode();
178         result = prime * result + ((activityZones == null) ? 0 : activityZones.hashCode());
179         result = prime * result + ((appUrl == null) ? 0 : appUrl.hashCode());
180         result = prime * result + ((isAudioInputEnabled == null) ? 0 : isAudioInputEnabled.hashCode());
181         result = prime * result + ((isPublicShareEnabled == null) ? 0 : isPublicShareEnabled.hashCode());
182         result = prime * result + ((isStreaming == null) ? 0 : isStreaming.hashCode());
183         result = prime * result + ((isVideoHistoryEnabled == null) ? 0 : isVideoHistoryEnabled.hashCode());
184         result = prime * result + ((lastEvent == null) ? 0 : lastEvent.hashCode());
185         result = prime * result + ((lastIsOnlineChange == null) ? 0 : lastIsOnlineChange.hashCode());
186         result = prime * result + ((publicShareUrl == null) ? 0 : publicShareUrl.hashCode());
187         result = prime * result + ((snapshotUrl == null) ? 0 : snapshotUrl.hashCode());
188         result = prime * result + ((webUrl == null) ? 0 : webUrl.hashCode());
189         return result;
190     }
191
192     @Override
193     public String toString() {
194         StringBuilder builder = new StringBuilder();
195         builder.append("Camera [isStreaming=").append(isStreaming).append(", isAudioInputEnabled=")
196                 .append(isAudioInputEnabled).append(", lastIsOnlineChange=").append(lastIsOnlineChange)
197                 .append(", isVideoHistoryEnabled=").append(isVideoHistoryEnabled).append(", webUrl=").append(webUrl)
198                 .append(", appUrl=").append(appUrl).append(", isPublicShareEnabled=").append(isPublicShareEnabled)
199                 .append(", activityZones=").append(activityZones).append(", publicShareUrl=").append(publicShareUrl)
200                 .append(", snapshotUrl=").append(snapshotUrl).append(", lastEvent=").append(lastEvent)
201                 .append(", getId()=").append(getId()).append(", getName()=").append(getName())
202                 .append(", getDeviceId()=").append(getDeviceId()).append(", getLastConnection()=")
203                 .append(getLastConnection()).append(", isOnline()=").append(isOnline()).append(", getNameLong()=")
204                 .append(getNameLong()).append(", getSoftwareVersion()=").append(getSoftwareVersion())
205                 .append(", getStructureId()=").append(getStructureId()).append(", getWhereId()=").append(getWhereId())
206                 .append("]");
207         return builder.toString();
208     }
209 }