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.livisismarthome.internal.client.api.entity.message;
15 import java.util.List;
17 import com.google.gson.annotations.SerializedName;
20 * Defines the structure of a {@link MessageDTO}. Messages are part of the LIVISI SmartHome system and besides other
23 * to raise battery warnings.
25 * @author Oliver Kuhl - Initial contribution
27 public class MessageDTO {
29 /** device related messages */
30 public static final String TYPE_DEVICE_UNREACHABLE = "DeviceUnreachable";
31 public static final String TYPE_DEVICE_LOW_BATTERY = "DeviceLowBattery";
34 * Identifier of the message – must be unique.
39 * Specifies the type of the message.
44 * Defines whether the message has been viewed by a user.
46 @SerializedName("read")
47 private boolean isRead;
50 * Defines whether it is an alert or a message, default is message.
52 @SerializedName("class")
53 private String messageClass;
56 * Timestamp when the message was created.
60 private String timestamp;
63 * Reference to the underlying devices, which the message relates to.
67 private List<String> devices;
70 * Container for all parameters of the message. The parameters are contained in Property entities.
74 private MessagePropertiesDTO properties;
77 * The product (context) that generated the message.
79 private String namespace;
84 public String getId() {
89 * @param id the id to set
91 public void setId(String id) {
98 public String getType() {
103 * @param type the type to set
105 public void setType(String type) {
110 * @return the messageClass
112 public String getMessageClass() {
117 * @param messageClass the messageClass to set
119 public void setMessageClass(String messageClass) {
120 this.messageClass = messageClass;
124 * @return the timestamp
126 public String getTimestamp() {
131 * @param timestamp the timestamp to set
133 public void setTimestamp(String timestamp) {
134 this.timestamp = timestamp;
140 public boolean isRead() {
145 * @param isRead the isRead to set
147 public void setRead(boolean isRead) {
148 this.isRead = isRead;
152 * @return the devices
154 public List<String> getDevices() {
159 * @param devices the devices to set
161 public void setDevices(List<String> devices) {
162 this.devices = devices;
166 * @return the dataPropertyList
168 public MessagePropertiesDTO getProperties() {
173 * @param properties the dataPropertyList to set
175 public void setProperties(MessagePropertiesDTO properties) {
176 this.properties = properties;
180 * @return the namespace
182 public String getNamespace() {
187 * @param namespace the namespace to set
189 public void setNamespace(String namespace) {
190 this.namespace = namespace;
194 * Returns true, if the message is of type "DeviceUnreachable".
196 * @return true if the message is of type "DeviceUnreachable", otherwise false
198 public boolean isTypeDeviceUnreachable() {
199 return TYPE_DEVICE_UNREACHABLE.equals(type);
203 * Returns true, if the message is of type "DeviceLowBattery".
205 * @return true if the message is of type "DeviceLowBattery", otherwise false
207 public boolean isTypeDeviceLowBattery() {
208 return TYPE_DEVICE_LOW_BATTERY.equals(type);