2 * Copyright (c) 2010-2020 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.dwdunwetter.internal.data;
15 import java.math.BigDecimal;
16 import java.time.Instant;
18 import org.apache.commons.lang.StringUtils;
21 * Data for one warning.
23 * @author Martin Koehler - Initial contribution
25 public class DwdWarningData {
29 private Severity severity;
30 private String description;
31 private Instant effective;
32 private Instant expires;
33 private Instant onset;
35 private String status;
36 private String msgType;
37 private String headline;
38 private BigDecimal altitude;
39 private BigDecimal ceiling;
40 private String instruction;
41 private Urgency urgency;
43 public void setId(String id) {
47 public String getId() {
51 public void setSeverity(Severity severity) {
52 this.severity = severity;
55 public Severity getSeverity() {
56 return severity == null ? Severity.UNKNOWN : severity;
59 public void setDescription(String description) {
60 this.description = description;
63 public String getDescription() {
67 public void setEffective(Instant effective) {
68 this.effective = effective;
71 public Instant getEffective() {
75 public void setExpires(Instant expires) {
76 this.expires = expires;
79 public Instant getExpires() {
83 public void setEvent(String event) {
87 public String getEvent() {
91 public void setStatus(String status) {
95 public boolean isTest() {
96 return StringUtils.equalsIgnoreCase(status, "Test");
99 public void setMsgType(String msgType) {
100 this.msgType = msgType;
103 public boolean isCancel() {
104 return StringUtils.equalsIgnoreCase(msgType, "Cancel");
107 public void setHeadline(String headline) {
108 this.headline = headline;
111 public String getHeadline() {
115 public Instant getOnset() {
119 public void setOnset(Instant onset) {
123 public void setAltitude(BigDecimal altitude) {
124 this.altitude = altitude;
127 public BigDecimal getAltitude() {
131 public void setCeiling(BigDecimal ceiling) {
132 this.ceiling = ceiling;
135 public BigDecimal getCeiling() {
139 public void setInstruction(String instruction) {
140 this.instruction = instruction;
143 public String getInstruction() {
147 public void setUrgency(Urgency urgency) {
148 this.urgency = urgency;
151 public Urgency getUrgency() {
156 public int hashCode() {
157 final int prime = 31;
159 result = prime * result + ((id == null) ? 0 : id.hashCode());
164 public boolean equals(Object obj) {
171 if (getClass() != obj.getClass()) {
174 DwdWarningData other = (DwdWarningData) obj;
176 if (other.id != null) {
179 } else if (!id.equals(other.id)) {