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