001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017package ca.uhn.fhir.model.dstu2.composite; 018 019import java.net.URI; 020import java.math.BigDecimal; 021import org.apache.commons.lang3.StringUtils; 022import java.util.*; 023import ca.uhn.fhir.model.api.*; 024import ca.uhn.fhir.model.primitive.*; 025import ca.uhn.fhir.model.api.annotation.*; 026import ca.uhn.fhir.model.base.composite.*; 027 028import ca.uhn.fhir.model.dstu2.valueset.AddressTypeEnum; 029import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum; 030import ca.uhn.fhir.model.dstu2.valueset.AggregationModeEnum; 031import ca.uhn.fhir.model.dstu2.valueset.BindingStrengthEnum; 032import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; 033import ca.uhn.fhir.model.dstu2.composite.CodingDt; 034import ca.uhn.fhir.model.dstu2.valueset.ConstraintSeverityEnum; 035import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum; 036import ca.uhn.fhir.model.dstu2.valueset.ContactPointUseEnum; 037import ca.uhn.fhir.model.dstu2.resource.Device; 038import ca.uhn.fhir.model.dstu2.valueset.EventTimingEnum; 039import ca.uhn.fhir.model.dstu2.valueset.IdentifierTypeCodesEnum; 040import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum; 041import ca.uhn.fhir.model.dstu2.valueset.NameUseEnum; 042import ca.uhn.fhir.model.dstu2.resource.Organization; 043import ca.uhn.fhir.model.dstu2.resource.Patient; 044import ca.uhn.fhir.model.dstu2.composite.PeriodDt; 045import ca.uhn.fhir.model.dstu2.resource.Practitioner; 046import ca.uhn.fhir.model.dstu2.valueset.PropertyRepresentationEnum; 047import ca.uhn.fhir.model.dstu2.valueset.QuantityComparatorEnum; 048import ca.uhn.fhir.model.dstu2.composite.QuantityDt; 049import ca.uhn.fhir.model.dstu2.composite.RangeDt; 050import ca.uhn.fhir.model.dstu2.resource.RelatedPerson; 051import ca.uhn.fhir.model.dstu2.valueset.SignatureTypeCodesEnum; 052import ca.uhn.fhir.model.dstu2.valueset.SlicingRulesEnum; 053import ca.uhn.fhir.model.api.TemporalPrecisionEnum; 054import ca.uhn.fhir.model.dstu2.valueset.TimingAbbreviationEnum; 055import ca.uhn.fhir.model.dstu2.valueset.UnitsOfTimeEnum; 056import ca.uhn.fhir.model.dstu2.resource.ValueSet; 057import ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt; 058import ca.uhn.fhir.model.dstu2.composite.DurationDt; 059import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; 060import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt; 061import ca.uhn.fhir.model.primitive.Base64BinaryDt; 062import ca.uhn.fhir.model.primitive.BooleanDt; 063import ca.uhn.fhir.model.primitive.BoundCodeDt; 064import ca.uhn.fhir.model.primitive.CodeDt; 065import ca.uhn.fhir.model.primitive.DateTimeDt; 066import ca.uhn.fhir.model.primitive.DecimalDt; 067import ca.uhn.fhir.model.primitive.IdDt; 068import ca.uhn.fhir.model.primitive.InstantDt; 069import ca.uhn.fhir.model.primitive.IntegerDt; 070import ca.uhn.fhir.model.primitive.MarkdownDt; 071import ca.uhn.fhir.model.primitive.PositiveIntDt; 072import ca.uhn.fhir.model.primitive.StringDt; 073import ca.uhn.fhir.model.primitive.UnsignedIntDt; 074import ca.uhn.fhir.model.primitive.UriDt; 075 076/** 077 * HAPI/FHIR <b>AddressDt</b> Datatype 078 * () 079 * 080 * <p> 081 * <b>Definition:</b> 082 * There is a variety of postal address formats defined around the world. This format defines a superset that is the basis for all addresses around the world 083 * </p> 084 * 085 * <p> 086 * <b>Requirements:</b> 087 * Need to be able to record postal addresses, along with notes about their use 088 * </p> 089 */ 090@DatatypeDef(name="AddressDt") 091public class AddressDt 092 extends BaseIdentifiableElement implements ICompositeDatatype{ 093 094 /** 095 * Constructor 096 */ 097 public AddressDt() { 098 // nothing 099 } 100 101 102 @Child(name="use", type=CodeDt.class, order=0, min=0, max=1, summary=true, modifier=true) 103 @Description( 104 shortDefinition="", 105 formalDefinition="The purpose of this address" 106 ) 107 private BoundCodeDt<AddressUseEnum> myUse; 108 109 @Child(name="type", type=CodeDt.class, order=1, min=0, max=1, summary=true, modifier=false) 110 @Description( 111 shortDefinition="", 112 formalDefinition="Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both" 113 ) 114 private BoundCodeDt<AddressTypeEnum> myType; 115 116 @Child(name="text", type=StringDt.class, order=2, min=0, max=1, summary=true, modifier=false) 117 @Description( 118 shortDefinition="", 119 formalDefinition="A full text representation of the address" 120 ) 121 private StringDt myText; 122 123 @Child(name="line", type=StringDt.class, order=3, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) 124 @Description( 125 shortDefinition="", 126 formalDefinition="This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information" 127 ) 128 private java.util.List<StringDt> myLine; 129 130 @Child(name="city", type=StringDt.class, order=4, min=0, max=1, summary=true, modifier=false) 131 @Description( 132 shortDefinition="", 133 formalDefinition="The name of the city, town, village or other community or delivery center" 134 ) 135 private StringDt myCity; 136 137 @Child(name="district", type=StringDt.class, order=5, min=0, max=1, summary=true, modifier=false) 138 @Description( 139 shortDefinition="", 140 formalDefinition="The name of the administrative area (county)" 141 ) 142 private StringDt myDistrict; 143 144 @Child(name="state", type=StringDt.class, order=6, min=0, max=1, summary=true, modifier=false) 145 @Description( 146 shortDefinition="", 147 formalDefinition="Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes)" 148 ) 149 private StringDt myState; 150 151 @Child(name="postalCode", type=StringDt.class, order=7, min=0, max=1, summary=true, modifier=false) 152 @Description( 153 shortDefinition="", 154 formalDefinition="A postal code designating a region defined by the postal service" 155 ) 156 private StringDt myPostalCode; 157 158 @Child(name="country", type=StringDt.class, order=8, min=0, max=1, summary=true, modifier=false) 159 @Description( 160 shortDefinition="", 161 formalDefinition="Country - a nation as commonly understood or generally accepted" 162 ) 163 private StringDt myCountry; 164 165 @Child(name="period", type=PeriodDt.class, order=9, min=0, max=1, summary=true, modifier=false) 166 @Description( 167 shortDefinition="", 168 formalDefinition="Time period when address was/is in use" 169 ) 170 private PeriodDt myPeriod; 171 172 173 @Override 174 public boolean isEmpty() { 175 return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myUse, myType, myText, myLine, myCity, myDistrict, myState, myPostalCode, myCountry, myPeriod); 176 } 177 178 @Override 179 public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) { 180 return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myUse, myType, myText, myLine, myCity, myDistrict, myState, myPostalCode, myCountry, myPeriod); 181 } 182 183 /** 184 * Gets the value(s) for <b>use</b> (). 185 * creating it if it does 186 * not exist. Will not return <code>null</code>. 187 * 188 * <p> 189 * <b>Definition:</b> 190 * The purpose of this address 191 * </p> 192 */ 193 public BoundCodeDt<AddressUseEnum> getUseElement() { 194 if (myUse == null) { 195 myUse = new BoundCodeDt<AddressUseEnum>(AddressUseEnum.VALUESET_BINDER); 196 } 197 return myUse; 198 } 199 200 201 /** 202 * Gets the value(s) for <b>use</b> (). 203 * creating it if it does 204 * not exist. Will not return <code>null</code>. 205 * 206 * <p> 207 * <b>Definition:</b> 208 * The purpose of this address 209 * </p> 210 */ 211 public String getUse() { 212 return getUseElement().getValue(); 213 } 214 215 /** 216 * Sets the value(s) for <b>use</b> () 217 * 218 * <p> 219 * <b>Definition:</b> 220 * The purpose of this address 221 * </p> 222 */ 223 public AddressDt setUse(BoundCodeDt<AddressUseEnum> theValue) { 224 myUse = theValue; 225 return this; 226 } 227 228 229 230 /** 231 * Sets the value(s) for <b>use</b> () 232 * 233 * <p> 234 * <b>Definition:</b> 235 * The purpose of this address 236 * </p> 237 */ 238 public AddressDt setUse(AddressUseEnum theValue) { 239 setUse(new BoundCodeDt<AddressUseEnum>(AddressUseEnum.VALUESET_BINDER, theValue)); 240 241/* 242 getUseElement().setValueAsEnum(theValue); 243*/ 244 return this; 245 } 246 247 248 /** 249 * Gets the value(s) for <b>type</b> (). 250 * creating it if it does 251 * not exist. Will not return <code>null</code>. 252 * 253 * <p> 254 * <b>Definition:</b> 255 * Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both 256 * </p> 257 */ 258 public BoundCodeDt<AddressTypeEnum> getTypeElement() { 259 if (myType == null) { 260 myType = new BoundCodeDt<AddressTypeEnum>(AddressTypeEnum.VALUESET_BINDER); 261 } 262 return myType; 263 } 264 265 266 /** 267 * Gets the value(s) for <b>type</b> (). 268 * creating it if it does 269 * not exist. Will not return <code>null</code>. 270 * 271 * <p> 272 * <b>Definition:</b> 273 * Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both 274 * </p> 275 */ 276 public String getType() { 277 return getTypeElement().getValue(); 278 } 279 280 /** 281 * Sets the value(s) for <b>type</b> () 282 * 283 * <p> 284 * <b>Definition:</b> 285 * Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both 286 * </p> 287 */ 288 public AddressDt setType(BoundCodeDt<AddressTypeEnum> theValue) { 289 myType = theValue; 290 return this; 291 } 292 293 294 295 /** 296 * Sets the value(s) for <b>type</b> () 297 * 298 * <p> 299 * <b>Definition:</b> 300 * Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both 301 * </p> 302 */ 303 public AddressDt setType(AddressTypeEnum theValue) { 304 setType(new BoundCodeDt<AddressTypeEnum>(AddressTypeEnum.VALUESET_BINDER, theValue)); 305 306/* 307 getTypeElement().setValueAsEnum(theValue); 308*/ 309 return this; 310 } 311 312 313 /** 314 * Gets the value(s) for <b>text</b> (). 315 * creating it if it does 316 * not exist. Will not return <code>null</code>. 317 * 318 * <p> 319 * <b>Definition:</b> 320 * A full text representation of the address 321 * </p> 322 */ 323 public StringDt getTextElement() { 324 if (myText == null) { 325 myText = new StringDt(); 326 } 327 return myText; 328 } 329 330 331 /** 332 * Gets the value(s) for <b>text</b> (). 333 * creating it if it does 334 * not exist. Will not return <code>null</code>. 335 * 336 * <p> 337 * <b>Definition:</b> 338 * A full text representation of the address 339 * </p> 340 */ 341 public String getText() { 342 return getTextElement().getValue(); 343 } 344 345 /** 346 * Sets the value(s) for <b>text</b> () 347 * 348 * <p> 349 * <b>Definition:</b> 350 * A full text representation of the address 351 * </p> 352 */ 353 public AddressDt setText(StringDt theValue) { 354 myText = theValue; 355 return this; 356 } 357 358 359 360 /** 361 * Sets the value for <b>text</b> () 362 * 363 * <p> 364 * <b>Definition:</b> 365 * A full text representation of the address 366 * </p> 367 */ 368 public AddressDt setText( String theString) { 369 myText = new StringDt(theString); 370 return this; 371 } 372 373 374 /** 375 * Gets the value(s) for <b>line</b> (). 376 * creating it if it does 377 * not exist. Will not return <code>null</code>. 378 * 379 * <p> 380 * <b>Definition:</b> 381 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information 382 * </p> 383 */ 384 public java.util.List<StringDt> getLine() { 385 if (myLine == null) { 386 myLine = new java.util.ArrayList<StringDt>(); 387 } 388 return myLine; 389 } 390 391 /** 392 * Sets the value(s) for <b>line</b> () 393 * 394 * <p> 395 * <b>Definition:</b> 396 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information 397 * </p> 398 */ 399 public AddressDt setLine(java.util.List<StringDt> theValue) { 400 myLine = theValue; 401 return this; 402 } 403 404 405 406 /** 407 * Adds and returns a new value for <b>line</b> () 408 * 409 * <p> 410 * <b>Definition:</b> 411 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information 412 * </p> 413 */ 414 public StringDt addLine() { 415 StringDt newType = new StringDt(); 416 getLine().add(newType); 417 return newType; 418 } 419 420 /** 421 * Adds a given new value for <b>line</b> () 422 * 423 * <p> 424 * <b>Definition:</b> 425 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information 426 * </p> 427 * @param theValue The line to add (must not be <code>null</code>) 428 */ 429 public AddressDt addLine(StringDt theValue) { 430 if (theValue == null) { 431 throw new NullPointerException("theValue must not be null"); 432 } 433 getLine().add(theValue); 434 return this; 435 } 436 437 /** 438 * Gets the first repetition for <b>line</b> (), 439 * creating it if it does not already exist. 440 * 441 * <p> 442 * <b>Definition:</b> 443 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information 444 * </p> 445 */ 446 public StringDt getLineFirstRep() { 447 if (getLine().isEmpty()) { 448 return addLine(); 449 } 450 return getLine().get(0); 451 } 452 /** 453 * Adds a new value for <b>line</b> () 454 * 455 * <p> 456 * <b>Definition:</b> 457 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information 458 * </p> 459 * 460 * @return Returns a reference to this object, to allow for simple chaining. 461 */ 462 public AddressDt addLine( String theString) { 463 if (myLine == null) { 464 myLine = new java.util.ArrayList<StringDt>(); 465 } 466 myLine.add(new StringDt(theString)); 467 return this; 468 } 469 470 471 /** 472 * Gets the value(s) for <b>city</b> (). 473 * creating it if it does 474 * not exist. Will not return <code>null</code>. 475 * 476 * <p> 477 * <b>Definition:</b> 478 * The name of the city, town, village or other community or delivery center 479 * </p> 480 */ 481 public StringDt getCityElement() { 482 if (myCity == null) { 483 myCity = new StringDt(); 484 } 485 return myCity; 486 } 487 488 489 /** 490 * Gets the value(s) for <b>city</b> (). 491 * creating it if it does 492 * not exist. Will not return <code>null</code>. 493 * 494 * <p> 495 * <b>Definition:</b> 496 * The name of the city, town, village or other community or delivery center 497 * </p> 498 */ 499 public String getCity() { 500 return getCityElement().getValue(); 501 } 502 503 /** 504 * Sets the value(s) for <b>city</b> () 505 * 506 * <p> 507 * <b>Definition:</b> 508 * The name of the city, town, village or other community or delivery center 509 * </p> 510 */ 511 public AddressDt setCity(StringDt theValue) { 512 myCity = theValue; 513 return this; 514 } 515 516 517 518 /** 519 * Sets the value for <b>city</b> () 520 * 521 * <p> 522 * <b>Definition:</b> 523 * The name of the city, town, village or other community or delivery center 524 * </p> 525 */ 526 public AddressDt setCity( String theString) { 527 myCity = new StringDt(theString); 528 return this; 529 } 530 531 532 /** 533 * Gets the value(s) for <b>district</b> (). 534 * creating it if it does 535 * not exist. Will not return <code>null</code>. 536 * 537 * <p> 538 * <b>Definition:</b> 539 * The name of the administrative area (county) 540 * </p> 541 */ 542 public StringDt getDistrictElement() { 543 if (myDistrict == null) { 544 myDistrict = new StringDt(); 545 } 546 return myDistrict; 547 } 548 549 550 /** 551 * Gets the value(s) for <b>district</b> (). 552 * creating it if it does 553 * not exist. Will not return <code>null</code>. 554 * 555 * <p> 556 * <b>Definition:</b> 557 * The name of the administrative area (county) 558 * </p> 559 */ 560 public String getDistrict() { 561 return getDistrictElement().getValue(); 562 } 563 564 /** 565 * Sets the value(s) for <b>district</b> () 566 * 567 * <p> 568 * <b>Definition:</b> 569 * The name of the administrative area (county) 570 * </p> 571 */ 572 public AddressDt setDistrict(StringDt theValue) { 573 myDistrict = theValue; 574 return this; 575 } 576 577 578 579 /** 580 * Sets the value for <b>district</b> () 581 * 582 * <p> 583 * <b>Definition:</b> 584 * The name of the administrative area (county) 585 * </p> 586 */ 587 public AddressDt setDistrict( String theString) { 588 myDistrict = new StringDt(theString); 589 return this; 590 } 591 592 593 /** 594 * Gets the value(s) for <b>state</b> (). 595 * creating it if it does 596 * not exist. Will not return <code>null</code>. 597 * 598 * <p> 599 * <b>Definition:</b> 600 * Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes) 601 * </p> 602 */ 603 public StringDt getStateElement() { 604 if (myState == null) { 605 myState = new StringDt(); 606 } 607 return myState; 608 } 609 610 611 /** 612 * Gets the value(s) for <b>state</b> (). 613 * creating it if it does 614 * not exist. Will not return <code>null</code>. 615 * 616 * <p> 617 * <b>Definition:</b> 618 * Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes) 619 * </p> 620 */ 621 public String getState() { 622 return getStateElement().getValue(); 623 } 624 625 /** 626 * Sets the value(s) for <b>state</b> () 627 * 628 * <p> 629 * <b>Definition:</b> 630 * Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes) 631 * </p> 632 */ 633 public AddressDt setState(StringDt theValue) { 634 myState = theValue; 635 return this; 636 } 637 638 639 640 /** 641 * Sets the value for <b>state</b> () 642 * 643 * <p> 644 * <b>Definition:</b> 645 * Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes) 646 * </p> 647 */ 648 public AddressDt setState( String theString) { 649 myState = new StringDt(theString); 650 return this; 651 } 652 653 654 /** 655 * Gets the value(s) for <b>postalCode</b> (). 656 * creating it if it does 657 * not exist. Will not return <code>null</code>. 658 * 659 * <p> 660 * <b>Definition:</b> 661 * A postal code designating a region defined by the postal service 662 * </p> 663 */ 664 public StringDt getPostalCodeElement() { 665 if (myPostalCode == null) { 666 myPostalCode = new StringDt(); 667 } 668 return myPostalCode; 669 } 670 671 672 /** 673 * Gets the value(s) for <b>postalCode</b> (). 674 * creating it if it does 675 * not exist. Will not return <code>null</code>. 676 * 677 * <p> 678 * <b>Definition:</b> 679 * A postal code designating a region defined by the postal service 680 * </p> 681 */ 682 public String getPostalCode() { 683 return getPostalCodeElement().getValue(); 684 } 685 686 /** 687 * Sets the value(s) for <b>postalCode</b> () 688 * 689 * <p> 690 * <b>Definition:</b> 691 * A postal code designating a region defined by the postal service 692 * </p> 693 */ 694 public AddressDt setPostalCode(StringDt theValue) { 695 myPostalCode = theValue; 696 return this; 697 } 698 699 700 701 /** 702 * Sets the value for <b>postalCode</b> () 703 * 704 * <p> 705 * <b>Definition:</b> 706 * A postal code designating a region defined by the postal service 707 * </p> 708 */ 709 public AddressDt setPostalCode( String theString) { 710 myPostalCode = new StringDt(theString); 711 return this; 712 } 713 714 715 /** 716 * Gets the value(s) for <b>country</b> (). 717 * creating it if it does 718 * not exist. Will not return <code>null</code>. 719 * 720 * <p> 721 * <b>Definition:</b> 722 * Country - a nation as commonly understood or generally accepted 723 * </p> 724 */ 725 public StringDt getCountryElement() { 726 if (myCountry == null) { 727 myCountry = new StringDt(); 728 } 729 return myCountry; 730 } 731 732 733 /** 734 * Gets the value(s) for <b>country</b> (). 735 * creating it if it does 736 * not exist. Will not return <code>null</code>. 737 * 738 * <p> 739 * <b>Definition:</b> 740 * Country - a nation as commonly understood or generally accepted 741 * </p> 742 */ 743 public String getCountry() { 744 return getCountryElement().getValue(); 745 } 746 747 /** 748 * Sets the value(s) for <b>country</b> () 749 * 750 * <p> 751 * <b>Definition:</b> 752 * Country - a nation as commonly understood or generally accepted 753 * </p> 754 */ 755 public AddressDt setCountry(StringDt theValue) { 756 myCountry = theValue; 757 return this; 758 } 759 760 761 762 /** 763 * Sets the value for <b>country</b> () 764 * 765 * <p> 766 * <b>Definition:</b> 767 * Country - a nation as commonly understood or generally accepted 768 * </p> 769 */ 770 public AddressDt setCountry( String theString) { 771 myCountry = new StringDt(theString); 772 return this; 773 } 774 775 776 /** 777 * Gets the value(s) for <b>period</b> (). 778 * creating it if it does 779 * not exist. Will not return <code>null</code>. 780 * 781 * <p> 782 * <b>Definition:</b> 783 * Time period when address was/is in use 784 * </p> 785 */ 786 public PeriodDt getPeriod() { 787 if (myPeriod == null) { 788 myPeriod = new PeriodDt(); 789 } 790 return myPeriod; 791 } 792 793 /** 794 * Sets the value(s) for <b>period</b> () 795 * 796 * <p> 797 * <b>Definition:</b> 798 * Time period when address was/is in use 799 * </p> 800 */ 801 public AddressDt setPeriod(PeriodDt theValue) { 802 myPeriod = theValue; 803 return this; 804 } 805 806 807 808 809 810 811}