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.nest.internal.wwn.dto;
15 import java.util.Date;
16 import java.util.List;
19 * The data for a WWN camera event.
21 * @author David Bennett - Initial contribution
22 * @author Wouter Born - Extract CameraEvent object from Camera
23 * @author Wouter Born - Add equals, hashCode, toString methods
25 public class WWNCameraEvent {
27 private Boolean hasSound;
28 private Boolean hasMotion;
29 private Boolean hasPerson;
30 private Date startTime;
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;
39 public Boolean isHasSound() {
43 public Boolean isHasMotion() {
47 public Boolean isHasPerson() {
51 public Date getStartTime() {
55 public Date getEndTime() {
59 public Date getUrlsExpireTime() {
60 return urlsExpireTime;
63 public String getWebUrl() {
67 public String getAppUrl() {
71 public String getImageUrl() {
75 public String getAnimatedImageUrl() {
76 return animatedImageUrl;
79 public List<String> getActivityZones() {
80 return activityZoneIds;
84 public boolean equals(Object obj) {
91 if (getClass() != obj.getClass()) {
94 WWNCameraEvent other = (WWNCameraEvent) obj;
95 if (activityZoneIds == null) {
96 if (other.activityZoneIds != null) {
99 } else if (!activityZoneIds.equals(other.activityZoneIds)) {
102 if (animatedImageUrl == null) {
103 if (other.animatedImageUrl != null) {
106 } else if (!animatedImageUrl.equals(other.animatedImageUrl)) {
109 if (appUrl == null) {
110 if (other.appUrl != null) {
113 } else if (!appUrl.equals(other.appUrl)) {
116 if (endTime == null) {
117 if (other.endTime != null) {
120 } else if (!endTime.equals(other.endTime)) {
123 if (hasMotion == null) {
124 if (other.hasMotion != null) {
127 } else if (!hasMotion.equals(other.hasMotion)) {
130 if (hasPerson == null) {
131 if (other.hasPerson != null) {
134 } else if (!hasPerson.equals(other.hasPerson)) {
137 if (hasSound == null) {
138 if (other.hasSound != null) {
141 } else if (!hasSound.equals(other.hasSound)) {
144 if (imageUrl == null) {
145 if (other.imageUrl != null) {
148 } else if (!imageUrl.equals(other.imageUrl)) {
151 if (startTime == null) {
152 if (other.startTime != null) {
155 } else if (!startTime.equals(other.startTime)) {
158 if (urlsExpireTime == null) {
159 if (other.urlsExpireTime != null) {
162 } else if (!urlsExpireTime.equals(other.urlsExpireTime)) {
165 if (webUrl == null) {
166 if (other.webUrl != null) {
169 } else if (!webUrl.equals(other.webUrl)) {
176 public int hashCode() {
177 final int prime = 31;
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());
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();