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.zoneminder.internal.handler;
15 import java.util.Date;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
21 * The {@link Event} represents the attributes of a Zoneminder event
22 * that are relevant to this binding.
24 * @author Mark Hilbush - Initial contribution
36 private int alarmFrames;
37 private double length;
39 public Event(String id, String name, String cause, String notes, Date start, Date end) {
48 public String getId() {
52 public String setId(String id) {
56 public String getName() {
60 public void setName(String name) {
64 public String getCause() {
68 public void setCause(String cause) {
72 public String getNotes() {
76 public void setNotes(String notes) {
80 public Date getStart() {
84 public void setStart(Date start) {
88 public Date getEnd() {
92 public void setEnd(Date end) {
96 public int getFrames() {
100 public void setFrames(@Nullable Integer frames) {
101 this.frames = frames != null ? frames : 0;
104 public int getAlarmFrames() {
108 public void setAlarmFrames(@Nullable Integer alarmFrames) {
109 this.alarmFrames = alarmFrames != null ? alarmFrames : 0;
112 public double getLength() {
116 public void setLength(@Nullable Double length) {
117 this.length = length != null ? length : 0;
121 public String toString() {
122 StringBuffer sb = new StringBuffer();
123 sb.append("id=").append(id);
124 sb.append(", name=").append(name);
125 sb.append(", cause=").append(cause);
126 sb.append(", start=").append(start.toString());
127 sb.append(", end=").append(end.toString());
128 sb.append(", frames=").append(String.format("%d", frames));
129 sb.append(", alarmFrames=").append(String.format("%d", alarmFrames));
130 sb.append(", length=").append(String.format("%6.2", length));
132 return sb.toString();