1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.xds.core.metadata;
17
18 import ca.uhn.hl7v2.model.v25.datatype.XTN;
19
20 import javax.xml.bind.annotation.XmlAccessType;
21 import javax.xml.bind.annotation.XmlAccessorType;
22 import javax.xml.bind.annotation.XmlElement;
23 import javax.xml.bind.annotation.XmlTransient;
24 import javax.xml.bind.annotation.XmlType;
25 import java.util.Objects;
26
27
28
29
30
31
32
33
34
35
36
37
38 @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
39 @XmlType(name = "Telecom", propOrder = {"use", "type", "email", "countryCode",
40 "areaCityCode", "localNumber", "extension", "unformattedPhoneNumber"})
41 public class Telecom extends Hl7v2Based<XTN> {
42 private static final long serialVersionUID = 526836203236101658L;
43
44 public Telecom() {
45 super(new XTN(MESSAGE));
46 }
47
48 public Telecom(XTN xtn) {
49 super(xtn);
50 }
51
52 @Deprecated
53 public Telecom(String address, String addressType) {
54 this();
55 setAddress(address);
56 setAddressType(addressType);
57 }
58
59
60
61
62
63
64 public Telecom(String email) {
65 this();
66 setUse("NET");
67 setType("Internet");
68 setEmail(email);
69 }
70
71
72
73
74
75
76
77
78
79 public Telecom(Long countryCode, Long areaCityCode, Long localNumber, Long extension) {
80 this();
81 setUse("PRN");
82 setType("PH");
83 setCountryCode(countryCode);
84 setAreaCityCode(areaCityCode);
85 setLocalNumber(localNumber);
86 setExtension(extension);
87 }
88
89
90
91
92
93
94
95
96 public Telecom(Integer countryCode, Integer areaCityCode, Integer localNumber, Integer extension) {
97 this(
98 countryCode == null ? null : countryCode.longValue(),
99 areaCityCode == null ? null : areaCityCode.longValue(),
100 localNumber == null ? null : localNumber.longValue(),
101 extension == null ? null : extension.longValue());
102 }
103
104
105
106
107 @XmlElement(name = "use")
108 public String getUse() {
109 return getHapiObject().getXtn2_TelecommunicationUseCode().getValue();
110 }
111
112
113
114
115 public void setUse(String use) {
116 setValue(getHapiObject().getXtn2_TelecommunicationUseCode(), use);
117 }
118
119
120
121
122 @XmlElement(name = "type")
123 public String getType() {
124 return getHapiObject().getXtn3_TelecommunicationEquipmentType().getValue();
125 }
126
127
128
129
130 public void setType(String type) {
131 setValue(getHapiObject().getXtn3_TelecommunicationEquipmentType(), type);
132 }
133
134
135
136
137
138 @Deprecated
139 @XmlTransient
140 public String getAddressType() {
141 return getType();
142 }
143
144
145
146
147
148 @Deprecated
149 public void setAddressType(String addressType) {
150 setType(addressType);
151 }
152
153
154
155
156 @XmlElement(name = "email")
157 public String getEmail() {
158 return getHapiObject().getXtn4_EmailAddress().getValue();
159 }
160
161
162
163
164 public void setEmail(String email) {
165 setValue(getHapiObject().getXtn4_EmailAddress(), email);
166 }
167
168
169
170
171
172 @Deprecated
173 @XmlTransient
174 public String getAddress() {
175 return getEmail();
176 }
177
178
179
180
181
182 @Deprecated
183 public void setAddress(String address) {
184 setEmail(address);
185 }
186
187
188
189
190 @XmlElement(name = "countryCode")
191 public Long getCountryCode() {
192 return getLongValue(getHapiObject().getXtn5_CountryCode());
193 }
194
195
196
197
198 public void setCountryCode(Long countryCode) {
199 setValue(getHapiObject().getXtn5_CountryCode(), countryCode == null ? null : countryCode.toString());
200 }
201
202
203
204
205 @XmlElement(name = "areaCityCode")
206 public Long getAreaCityCode() {
207 return getLongValue(getHapiObject().getXtn6_AreaCityCode());
208 }
209
210
211
212
213 public void setAreaCityCode(Long areaCityCode) {
214 setValue(getHapiObject().getXtn6_AreaCityCode(), areaCityCode == null ? null : areaCityCode.toString());
215 }
216
217
218
219
220 @XmlElement(name = "localNumber")
221 public Long getLocalNumber() {
222 return getLongValue(getHapiObject().getXtn7_LocalNumber());
223 }
224
225
226
227
228 public void setLocalNumber(Long localNumber) {
229 setValue(getHapiObject().getXtn7_LocalNumber(), localNumber == null ? null : localNumber.toString() );
230 }
231
232
233
234
235 @XmlElement(name = "extension")
236 public Long getExtension() {
237 return getLongValue(getHapiObject().getXtn8_Extension());
238 }
239
240
241
242
243 public void setExtension(Long extension) {
244 setValue(getHapiObject().getXtn8_Extension(), extension == null ? null : extension.toString());
245 }
246
247
248
249
250 @XmlElement(name = "unformattedPhoneNumber")
251 public String getUnformattedPhoneNumber() {
252 return getHapiObject().getXtn12_UnformattedTelephoneNumber().getValue();
253 }
254
255
256
257
258 public void setUnformattedPhoneNumber(String unformattedPhoneNumber) {
259 setValue(getHapiObject().getXtn12_UnformattedTelephoneNumber(), unformattedPhoneNumber);
260 }
261
262 @Override
263 public boolean equals(Object o) {
264 if (this == o) return true;
265 if (o == null || getClass() != o.getClass()) return false;
266 Telecom that = (Telecom) o;
267 return Objects.equals(getUse(), that.getUse()) &&
268 Objects.equals(getType(), that.getType()) &&
269 Objects.equals(getEmail(), that.getEmail()) &&
270 Objects.equals(getCountryCode(), that.getCountryCode()) &&
271 Objects.equals(getAreaCityCode(), that.getAreaCityCode()) &&
272 Objects.equals(getLocalNumber(), that.getLocalNumber()) &&
273 Objects.equals(getExtension(), that.getExtension()) &&
274 Objects.equals(getUnformattedPhoneNumber(), that.getUnformattedPhoneNumber());
275 }
276
277 @Override
278 public int hashCode() {
279 return Objects.hash(getUse(), getType(), getEmail(), getCountryCode(),
280 getAreaCityCode(), getLocalNumber(), getExtension(), getUnformattedPhoneNumber());
281 }
282
283 @Override
284 public String toString() {
285 return "Telecom(" +
286 "use=" + getUse() +
287 ", type=" + getType() +
288 ", email=" + getEmail() +
289 ", countryCode=" + getCountryCode() +
290 ", areaCityCode=" + getAreaCityCode() +
291 ", localNumber=" + getLocalNumber() +
292 ", extension=" + getExtension() +
293 ", unformattedPhoneNumber=" + getUnformattedPhoneNumber() +
294 ')';
295 }
296 }