1
18 package org.torweg.pulse.component.shop.checkout;
19
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.xml.bind.annotation.XmlAccessType;
23 import javax.xml.bind.annotation.XmlAccessorType;
24 import javax.xml.bind.annotation.XmlElement;
25 import javax.xml.bind.annotation.XmlRootElement;
26
27 import org.torweg.pulse.util.entity.AbstractBasicEntity;
28
29
35 @Entity(name = "checkout_Address")
36 @XmlRootElement(name = "address")
37 @XmlAccessorType(XmlAccessType.NONE)
38 public class Address extends AbstractBasicEntity {
39
40
43 private static final long serialVersionUID = -8269668143815450812L;
44
45
48 @Column(updatable = false)
49 @XmlElement(name = "salutation")
50 private String salutation;
51
52
55 @Column(updatable = false)
56 @XmlElement(name = "first-name")
57 private String firstName;
58
59
62 @Column(updatable = false)
63 @XmlElement(name = "last-name")
64 private String lastName;
65
66
69 @Column(updatable = false)
70 @XmlElement(name = "additional-name-info")
71 private String additionalNameInfo;
72
73
76 @Column(updatable = false)
77 @XmlElement(name = "institution")
78 private String institution;
79
80
83 @Column(updatable = false)
84 @XmlElement(name = "street")
85 private String street;
86
87
90 @Column(updatable = false)
91 @XmlElement(name = "additional-street-info")
92 private String additionalStreetInfo;
93
94
97 @Column(updatable = false)
98 @XmlElement(name = "postal-code")
99 private String postalCode;
100
101
104 @Column(updatable = false)
105 @XmlElement(name = "city")
106 private String city;
107
108
111 @Column(updatable = false)
112 @XmlElement(name = "region")
113 private String region;
114
115
118 @Column(updatable = false)
119 @XmlElement(name = "country")
120 private String country;
121
122
125 @Deprecated
126 protected Address() {
127 super();
128 }
129
130
138 public Address(final Address a) {
139 super();
140
141 if (a == null) {
142 throw new IllegalArgumentException("The given Address is null.");
143 }
144
145 this.salutation = a.getSalutation();
146 this.firstName = a.getFirstName();
147 this.lastName = a.getLastName();
148 this.additionalNameInfo = a.getAdditionalNameInfo();
149 this.institution = a.getInstitution();
150 this.street = a.getStreet();
151 this.additionalStreetInfo = a.getAdditionalStreetInfo();
152 this.postalCode = a.getPostalCode();
153 this.city = a.getCity();
154 this.region = a.getRegion();
155 this.country = a.getCountry();
156 }
157
158
164 private Address(final AddressBuilder builder) {
165 super();
166
167 this.salutation = builder.getSalutation();
168 this.firstName = builder.getFirstName();
169 this.lastName = builder.getLastName();
170 this.additionalNameInfo = builder.getAdditionalNameInfo();
171 this.institution = builder.getInstitution();
172 this.street = builder.getStreet();
173 this.additionalStreetInfo = builder.getAdditionalStreetInfo();
174 this.postalCode = builder.getPostalCode();
175 this.city = builder.getCity();
176 this.region = builder.getRegion();
177 this.country = builder.getCountry();
178 }
179
180
185 public final String getSalutation() {
186 return this.salutation;
187 }
188
189
194 public final String getFirstName() {
195 return this.firstName;
196 }
197
198
203 public final String getLastName() {
204 return this.lastName;
205 }
206
207
212 public final String getAdditionalNameInfo() {
213 return this.additionalNameInfo;
214 }
215
216
221 public final String getInstitution() {
222 return this.institution;
223 }
224
225
230 public final String getStreet() {
231 return this.street;
232 }
233
234
239 public final String getAdditionalStreetInfo() {
240 return this.additionalStreetInfo;
241 }
242
243
248 public final String getPostalCode() {
249 return this.postalCode;
250 }
251
252
257 public final String getCity() {
258 return this.city;
259 }
260
261
266 public final String getRegion() {
267 return this.region;
268 }
269
270
275 public final String getCountry() {
276 return this.country;
277 }
278
279
285 public static class AddressBuilder {
286
287
290 private String salutation;
291
292
295 private String firstName;
296
297
300 private String lastName;
301
302
305 private String additionalNameInfo;
306
307
310 private String institution;
311
312
315 private String street;
316
317
320 private String additionalStreetInfo;
321
322
325 private String postalCode;
326
327
330 private String city;
331
332
335 private String region;
336
337
340 private String country;
341
342
345 public AddressBuilder() {
346 super();
347 }
348
349
354 public final String getSalutation() {
355 return this.salutation;
356 }
357
358
365 public final AddressBuilder setSalutation(final String s) {
366 this.salutation = s;
367 return this;
368 }
369
370
375 public final String getFirstName() {
376 return this.firstName;
377 }
378
379
386 public final AddressBuilder setFirstName(final String fn) {
387 this.firstName = fn;
388 return this;
389 }
390
391
396 public final String getLastName() {
397 return this.lastName;
398 }
399
400
407 public final AddressBuilder setLastName(final String ln) {
408 this.lastName = ln;
409 return this;
410 }
411
412
417 public final String getAdditionalNameInfo() {
418 return this.additionalNameInfo;
419 }
420
421
428 public final AddressBuilder setAdditionalNameInfo(final String ani) {
429 this.additionalNameInfo = ani;
430 return this;
431 }
432
433
438 public final String getInstitution() {
439 return this.institution;
440 }
441
442
449 public final AddressBuilder setInstitution(final String i) {
450 this.institution = i;
451 return this;
452 }
453
454
459 public final String getStreet() {
460 return this.street;
461 }
462
463
470 public final AddressBuilder setStreet(final String s) {
471 this.street = s;
472 return this;
473 }
474
475
480 public final String getAdditionalStreetInfo() {
481 return this.additionalStreetInfo;
482 }
483
484
491 public final AddressBuilder setAdditionalStreetInfo(final String asi) {
492 this.additionalStreetInfo = asi;
493 return this;
494 }
495
496
501 public final String getPostalCode() {
502 return this.postalCode;
503 }
504
505
512 public final AddressBuilder setPostalCode(final String pc) {
513 this.postalCode = pc;
514 return this;
515 }
516
517
522 public final String getCity() {
523 return this.city;
524 }
525
526
533 public final AddressBuilder setCity(final String c) {
534 this.city = c;
535 return this;
536 }
537
538
543 public final String getRegion() {
544 return this.region;
545 }
546
547
554 public final AddressBuilder setRegion(final String r) {
555 this.region = r;
556 return this;
557 }
558
559
564 public final String getCountry() {
565 return this.country;
566 }
567
568
575 public final AddressBuilder setCountry(final String c) {
576 this.country = c;
577 return this;
578 }
579
580
585 public final Address build() {
586 return new Address(this); }
588
589 }
590
591 }
592