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.XAD;
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.XmlType;
24 import java.util.Objects;
25
26
27
28
29
30
31
32
33
34
35
36
37 @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
38 @XmlType(name = "Address", propOrder = {
39 "streetAddress", "otherDesignation", "city", "countyParishCode", "stateOrProvince", "country",
40 "zipOrPostalCode"})
41 public class Address extends Hl7v2Based<XAD> {
42 private static final long serialVersionUID = -5050715144917393181L;
43
44 public Address() {
45 super(new XAD(MESSAGE));
46 }
47
48 public Address(XAD xad) {
49 super(xad);
50 }
51
52
53
54
55
56 public String getStreetAddress() {
57 return getHapiObject().getXad1_StreetAddress().getSad1_StreetOrMailingAddress().getValue();
58 }
59
60
61
62
63
64 public void setStreetAddress(String streetAddress) {
65 setValue(getHapiObject().getXad1_StreetAddress().getSad1_StreetOrMailingAddress(), streetAddress);
66 }
67
68
69
70
71 @XmlElement(name = "additionalLocator")
72 public String getOtherDesignation() {
73 return getHapiObject().getXad2_OtherDesignation().getValue();
74 }
75
76
77
78
79
80 public void setOtherDesignation(String otherDesignation) {
81 setValue(getHapiObject().getXad2_OtherDesignation(), otherDesignation);
82 }
83
84
85
86
87 public String getCity() {
88 return getHapiObject().getXad3_City().getValue();
89 }
90
91
92
93
94
95 public void setCity(String city) {
96 setValue(getHapiObject().getXad3_City(), city);
97 }
98
99
100
101
102 @XmlElement(name = "state")
103 public String getStateOrProvince() {
104 return getHapiObject().getXad4_StateOrProvince().getValue();
105 }
106
107
108
109
110
111 public void setStateOrProvince(String stateOrProvince) {
112 setValue(getHapiObject().getXad4_StateOrProvince(), stateOrProvince);
113 }
114
115
116
117
118 @XmlElement(name = "postalCode")
119 public String getZipOrPostalCode() {
120 return getHapiObject().getXad5_ZipOrPostalCode().getValue();
121 }
122
123
124
125
126
127 public void setZipOrPostalCode(String zipOrPostalCode) {
128 setValue(getHapiObject().getXad5_ZipOrPostalCode(), zipOrPostalCode);
129 }
130
131
132
133
134 public String getCountry() {
135 return getHapiObject().getXad6_Country().getValue();
136 }
137
138
139
140
141
142 public void setCountry(String country) {
143 setValue(getHapiObject().getXad6_Country(), country);
144 }
145
146
147
148
149 @XmlElement(name = "county")
150 public String getCountyParishCode() {
151 return getHapiObject().getXad9_CountyParishCode().getValue();
152 }
153
154
155
156
157
158 public void setCountyParishCode(String countyParishCode) {
159 setValue(getHapiObject().getXad9_CountyParishCode(), countyParishCode);
160 }
161
162 @Override
163 public boolean equals(Object o) {
164 if (this == o) return true;
165 if (o == null || getClass() != o.getClass()) return false;
166 Address that = (Address) o;
167 return Objects.equals(getCity(), that.getCity()) &&
168 Objects.equals(getCountry(), that.getCountry()) &&
169 Objects.equals(getCountyParishCode(), that.getCountyParishCode()) &&
170 Objects.equals(getOtherDesignation(), that.getOtherDesignation()) &&
171 Objects.equals(getStateOrProvince(), that.getStateOrProvince()) &&
172 Objects.equals(getStreetAddress(), that.getStreetAddress()) &&
173 Objects.equals(getZipOrPostalCode(), that.getZipOrPostalCode());
174 }
175
176 @Override
177 public int hashCode() {
178 return Objects.hash(
179 getCity(), getCountry(), getCountyParishCode(), getOtherDesignation(),
180 getStateOrProvince(), getStreetAddress(), getZipOrPostalCode());
181 }
182
183 @Override
184 public String toString() {
185 return "Address(" +
186 "streetAddress=" + getStreetAddress() +
187 ", otherDesignation=" + getOtherDesignation() +
188 ", city=" + getCity() +
189 ", stateOrProvince=" + getStateOrProvince() +
190 ", zipOrPostalCode=" + getZipOrPostalCode() +
191 ", country=" + getCountry() +
192 ", countyParishCode=" + getCountyParishCode() +
193 ')';
194 }
195 }