]> git.basschouten.com Git - openhab-addons.git/blob
19384197ef4bdd0fd550a82af117f9aac65ad09a
[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.dwdunwetter.internal.dto;
14
15 import java.math.BigDecimal;
16 import java.time.Instant;
17
18 /**
19  * Data for one warning.
20  *
21  * @author Martin Koehler - Initial contribution
22  */
23 public class DwdWarningData {
24
25     private String id;
26
27     private Severity severity;
28     private String description;
29     private Instant effective;
30     private Instant expires;
31     private Instant onset;
32     private String event;
33     private String status;
34     private String msgType;
35     private String headline;
36     private BigDecimal altitude;
37     private BigDecimal ceiling;
38     private String instruction;
39     private Urgency urgency;
40
41     public void setId(String id) {
42         this.id = id;
43     }
44
45     public String getId() {
46         return id;
47     }
48
49     public void setSeverity(Severity severity) {
50         this.severity = severity;
51     }
52
53     public Severity getSeverity() {
54         return severity == null ? Severity.UNKNOWN : severity;
55     }
56
57     public void setDescription(String description) {
58         this.description = description;
59     }
60
61     public String getDescription() {
62         return description;
63     }
64
65     public void setEffective(Instant effective) {
66         this.effective = effective;
67     }
68
69     public Instant getEffective() {
70         return effective;
71     }
72
73     public void setExpires(Instant expires) {
74         this.expires = expires;
75     }
76
77     public Instant getExpires() {
78         return expires;
79     }
80
81     public void setEvent(String event) {
82         this.event = event;
83     }
84
85     public String getEvent() {
86         return event;
87     }
88
89     public void setStatus(String status) {
90         this.status = status;
91     }
92
93     public boolean isTest() {
94         return "Test".equalsIgnoreCase(status);
95     }
96
97     public void setMsgType(String msgType) {
98         this.msgType = msgType;
99     }
100
101     public boolean isCancel() {
102         return "Cancel".equalsIgnoreCase(msgType);
103     }
104
105     public void setHeadline(String headline) {
106         this.headline = headline;
107     }
108
109     public String getHeadline() {
110         return headline;
111     }
112
113     public Instant getOnset() {
114         return onset;
115     }
116
117     public void setOnset(Instant onset) {
118         this.onset = onset;
119     }
120
121     public void setAltitude(BigDecimal altitude) {
122         this.altitude = altitude;
123     }
124
125     public BigDecimal getAltitude() {
126         return altitude;
127     }
128
129     public void setCeiling(BigDecimal ceiling) {
130         this.ceiling = ceiling;
131     }
132
133     public BigDecimal getCeiling() {
134         return ceiling;
135     }
136
137     public void setInstruction(String instruction) {
138         this.instruction = instruction;
139     }
140
141     public String getInstruction() {
142         return instruction;
143     }
144
145     public void setUrgency(Urgency urgency) {
146         this.urgency = urgency;
147     }
148
149     public Urgency getUrgency() {
150         return urgency;
151     }
152
153     @Override
154     public int hashCode() {
155         final int prime = 31;
156         int result = 1;
157         result = prime * result + ((id == null) ? 0 : id.hashCode());
158         return result;
159     }
160
161     @Override
162     public boolean equals(Object obj) {
163         if (this == obj) {
164             return true;
165         }
166         if (obj == null) {
167             return false;
168         }
169         if (getClass() != obj.getClass()) {
170             return false;
171         }
172         DwdWarningData other = (DwdWarningData) obj;
173         if (id == null) {
174             if (other.id != null) {
175                 return false;
176             }
177         } else if (!id.equals(other.id)) {
178             return false;
179         }
180         return true;
181     }
182 }