001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import ca.uhn.fhir.model.api.annotation.Child; 038import ca.uhn.fhir.model.api.annotation.ChildOrder; 039import ca.uhn.fhir.model.api.annotation.Description; 040import ca.uhn.fhir.model.api.annotation.DatatypeDef; 041import ca.uhn.fhir.model.api.annotation.Block; 042import org.hl7.fhir.instance.model.api.*; 043import org.hl7.fhir.exceptions.FHIRException; 044/** 045 * Details for all kinds of technology mediated contact points for a person or organization, including telephone, email, etc. 046 */ 047@DatatypeDef(name="ContactPoint") 048public class ContactPoint extends Type implements ICompositeType { 049 050 public enum ContactPointSystem { 051 /** 052 * The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required. 053 */ 054 PHONE, 055 /** 056 * The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required. 057 */ 058 FAX, 059 /** 060 * The value is an email address. 061 */ 062 EMAIL, 063 /** 064 * The value is a pager number. These may be local pager numbers that are only usable on a particular pager system. 065 */ 066 PAGER, 067 /** 068 * A contact that is not a phone, fax, pager or email address and is expressed as a URL. This is intended for various personal contacts including blogs, Skype, Twitter, Facebook, etc. Do not use for email addresses. 069 */ 070 URL, 071 /** 072 * A contact that can be used for sending an sms message (e.g. mobile phones, some landlines) 073 */ 074 SMS, 075 /** 076 * A contact that is not a phone, fax, page or email address and is not expressible as a URL. E.g. Internal mail address. This SHOULD NOT be used for contacts that are expressible as a URL (e.g. Skype, Twitter, Facebook, etc.) Extensions may be used to distinguish "other" contact types. 077 */ 078 OTHER, 079 /** 080 * added to help the parsers with the generic types 081 */ 082 NULL; 083 public static ContactPointSystem fromCode(String codeString) throws FHIRException { 084 if (codeString == null || "".equals(codeString)) 085 return null; 086 if ("phone".equals(codeString)) 087 return PHONE; 088 if ("fax".equals(codeString)) 089 return FAX; 090 if ("email".equals(codeString)) 091 return EMAIL; 092 if ("pager".equals(codeString)) 093 return PAGER; 094 if ("url".equals(codeString)) 095 return URL; 096 if ("sms".equals(codeString)) 097 return SMS; 098 if ("other".equals(codeString)) 099 return OTHER; 100 if (Configuration.isAcceptInvalidEnums()) 101 return null; 102 else 103 throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'"); 104 } 105 public String toCode() { 106 switch (this) { 107 case PHONE: return "phone"; 108 case FAX: return "fax"; 109 case EMAIL: return "email"; 110 case PAGER: return "pager"; 111 case URL: return "url"; 112 case SMS: return "sms"; 113 case OTHER: return "other"; 114 default: return "?"; 115 } 116 } 117 public String getSystem() { 118 switch (this) { 119 case PHONE: return "http://hl7.org/fhir/contact-point-system"; 120 case FAX: return "http://hl7.org/fhir/contact-point-system"; 121 case EMAIL: return "http://hl7.org/fhir/contact-point-system"; 122 case PAGER: return "http://hl7.org/fhir/contact-point-system"; 123 case URL: return "http://hl7.org/fhir/contact-point-system"; 124 case SMS: return "http://hl7.org/fhir/contact-point-system"; 125 case OTHER: return "http://hl7.org/fhir/contact-point-system"; 126 default: return "?"; 127 } 128 } 129 public String getDefinition() { 130 switch (this) { 131 case PHONE: return "The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required."; 132 case FAX: return "The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required."; 133 case EMAIL: return "The value is an email address."; 134 case PAGER: return "The value is a pager number. These may be local pager numbers that are only usable on a particular pager system."; 135 case URL: return "A contact that is not a phone, fax, pager or email address and is expressed as a URL. This is intended for various personal contacts including blogs, Skype, Twitter, Facebook, etc. Do not use for email addresses."; 136 case SMS: return "A contact that can be used for sending an sms message (e.g. mobile phones, some landlines)"; 137 case OTHER: return "A contact that is not a phone, fax, page or email address and is not expressible as a URL. E.g. Internal mail address. This SHOULD NOT be used for contacts that are expressible as a URL (e.g. Skype, Twitter, Facebook, etc.) Extensions may be used to distinguish \"other\" contact types."; 138 default: return "?"; 139 } 140 } 141 public String getDisplay() { 142 switch (this) { 143 case PHONE: return "Phone"; 144 case FAX: return "Fax"; 145 case EMAIL: return "Email"; 146 case PAGER: return "Pager"; 147 case URL: return "URL"; 148 case SMS: return "SMS"; 149 case OTHER: return "Other"; 150 default: return "?"; 151 } 152 } 153 } 154 155 public static class ContactPointSystemEnumFactory implements EnumFactory<ContactPointSystem> { 156 public ContactPointSystem fromCode(String codeString) throws IllegalArgumentException { 157 if (codeString == null || "".equals(codeString)) 158 if (codeString == null || "".equals(codeString)) 159 return null; 160 if ("phone".equals(codeString)) 161 return ContactPointSystem.PHONE; 162 if ("fax".equals(codeString)) 163 return ContactPointSystem.FAX; 164 if ("email".equals(codeString)) 165 return ContactPointSystem.EMAIL; 166 if ("pager".equals(codeString)) 167 return ContactPointSystem.PAGER; 168 if ("url".equals(codeString)) 169 return ContactPointSystem.URL; 170 if ("sms".equals(codeString)) 171 return ContactPointSystem.SMS; 172 if ("other".equals(codeString)) 173 return ContactPointSystem.OTHER; 174 throw new IllegalArgumentException("Unknown ContactPointSystem code '"+codeString+"'"); 175 } 176 public Enumeration<ContactPointSystem> fromType(Base code) throws FHIRException { 177 if (code == null) 178 return null; 179 if (code.isEmpty()) 180 return new Enumeration<ContactPointSystem>(this); 181 String codeString = ((PrimitiveType) code).asStringValue(); 182 if (codeString == null || "".equals(codeString)) 183 return null; 184 if ("phone".equals(codeString)) 185 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PHONE); 186 if ("fax".equals(codeString)) 187 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.FAX); 188 if ("email".equals(codeString)) 189 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.EMAIL); 190 if ("pager".equals(codeString)) 191 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PAGER); 192 if ("url".equals(codeString)) 193 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.URL); 194 if ("sms".equals(codeString)) 195 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.SMS); 196 if ("other".equals(codeString)) 197 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.OTHER); 198 throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'"); 199 } 200 public String toCode(ContactPointSystem code) { 201 if (code == ContactPointSystem.PHONE) 202 return "phone"; 203 if (code == ContactPointSystem.FAX) 204 return "fax"; 205 if (code == ContactPointSystem.EMAIL) 206 return "email"; 207 if (code == ContactPointSystem.PAGER) 208 return "pager"; 209 if (code == ContactPointSystem.URL) 210 return "url"; 211 if (code == ContactPointSystem.SMS) 212 return "sms"; 213 if (code == ContactPointSystem.OTHER) 214 return "other"; 215 return "?"; 216 } 217 public String toSystem(ContactPointSystem code) { 218 return code.getSystem(); 219 } 220 } 221 222 public enum ContactPointUse { 223 /** 224 * A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available. 225 */ 226 HOME, 227 /** 228 * An office contact point. First choice for business related contacts during business hours. 229 */ 230 WORK, 231 /** 232 * A temporary contact point. The period can provide more detailed information. 233 */ 234 TEMP, 235 /** 236 * This contact point is no longer in use (or was never correct, but retained for records). 237 */ 238 OLD, 239 /** 240 * A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business. 241 */ 242 MOBILE, 243 /** 244 * added to help the parsers with the generic types 245 */ 246 NULL; 247 public static ContactPointUse fromCode(String codeString) throws FHIRException { 248 if (codeString == null || "".equals(codeString)) 249 return null; 250 if ("home".equals(codeString)) 251 return HOME; 252 if ("work".equals(codeString)) 253 return WORK; 254 if ("temp".equals(codeString)) 255 return TEMP; 256 if ("old".equals(codeString)) 257 return OLD; 258 if ("mobile".equals(codeString)) 259 return MOBILE; 260 if (Configuration.isAcceptInvalidEnums()) 261 return null; 262 else 263 throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'"); 264 } 265 public String toCode() { 266 switch (this) { 267 case HOME: return "home"; 268 case WORK: return "work"; 269 case TEMP: return "temp"; 270 case OLD: return "old"; 271 case MOBILE: return "mobile"; 272 default: return "?"; 273 } 274 } 275 public String getSystem() { 276 switch (this) { 277 case HOME: return "http://hl7.org/fhir/contact-point-use"; 278 case WORK: return "http://hl7.org/fhir/contact-point-use"; 279 case TEMP: return "http://hl7.org/fhir/contact-point-use"; 280 case OLD: return "http://hl7.org/fhir/contact-point-use"; 281 case MOBILE: return "http://hl7.org/fhir/contact-point-use"; 282 default: return "?"; 283 } 284 } 285 public String getDefinition() { 286 switch (this) { 287 case HOME: return "A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available."; 288 case WORK: return "An office contact point. First choice for business related contacts during business hours."; 289 case TEMP: return "A temporary contact point. The period can provide more detailed information."; 290 case OLD: return "This contact point is no longer in use (or was never correct, but retained for records)."; 291 case MOBILE: return "A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business."; 292 default: return "?"; 293 } 294 } 295 public String getDisplay() { 296 switch (this) { 297 case HOME: return "Home"; 298 case WORK: return "Work"; 299 case TEMP: return "Temp"; 300 case OLD: return "Old"; 301 case MOBILE: return "Mobile"; 302 default: return "?"; 303 } 304 } 305 } 306 307 public static class ContactPointUseEnumFactory implements EnumFactory<ContactPointUse> { 308 public ContactPointUse fromCode(String codeString) throws IllegalArgumentException { 309 if (codeString == null || "".equals(codeString)) 310 if (codeString == null || "".equals(codeString)) 311 return null; 312 if ("home".equals(codeString)) 313 return ContactPointUse.HOME; 314 if ("work".equals(codeString)) 315 return ContactPointUse.WORK; 316 if ("temp".equals(codeString)) 317 return ContactPointUse.TEMP; 318 if ("old".equals(codeString)) 319 return ContactPointUse.OLD; 320 if ("mobile".equals(codeString)) 321 return ContactPointUse.MOBILE; 322 throw new IllegalArgumentException("Unknown ContactPointUse code '"+codeString+"'"); 323 } 324 public Enumeration<ContactPointUse> fromType(Base code) throws FHIRException { 325 if (code == null) 326 return null; 327 if (code.isEmpty()) 328 return new Enumeration<ContactPointUse>(this); 329 String codeString = ((PrimitiveType) code).asStringValue(); 330 if (codeString == null || "".equals(codeString)) 331 return null; 332 if ("home".equals(codeString)) 333 return new Enumeration<ContactPointUse>(this, ContactPointUse.HOME); 334 if ("work".equals(codeString)) 335 return new Enumeration<ContactPointUse>(this, ContactPointUse.WORK); 336 if ("temp".equals(codeString)) 337 return new Enumeration<ContactPointUse>(this, ContactPointUse.TEMP); 338 if ("old".equals(codeString)) 339 return new Enumeration<ContactPointUse>(this, ContactPointUse.OLD); 340 if ("mobile".equals(codeString)) 341 return new Enumeration<ContactPointUse>(this, ContactPointUse.MOBILE); 342 throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'"); 343 } 344 public String toCode(ContactPointUse code) { 345 if (code == ContactPointUse.HOME) 346 return "home"; 347 if (code == ContactPointUse.WORK) 348 return "work"; 349 if (code == ContactPointUse.TEMP) 350 return "temp"; 351 if (code == ContactPointUse.OLD) 352 return "old"; 353 if (code == ContactPointUse.MOBILE) 354 return "mobile"; 355 return "?"; 356 } 357 public String toSystem(ContactPointUse code) { 358 return code.getSystem(); 359 } 360 } 361 362 /** 363 * Telecommunications form for contact point - what communications system is required to make use of the contact. 364 */ 365 @Child(name = "system", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true) 366 @Description(shortDefinition="phone | fax | email | pager | url | sms | other", formalDefinition="Telecommunications form for contact point - what communications system is required to make use of the contact." ) 367 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contact-point-system") 368 protected Enumeration<ContactPointSystem> system; 369 370 /** 371 * The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address). 372 */ 373 @Child(name = "value", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 374 @Description(shortDefinition="The actual contact point details", formalDefinition="The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address)." ) 375 protected StringType value; 376 377 /** 378 * Identifies the purpose for the contact point. 379 */ 380 @Child(name = "use", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true) 381 @Description(shortDefinition="home | work | temp | old | mobile - purpose of this contact point", formalDefinition="Identifies the purpose for the contact point." ) 382 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/contact-point-use") 383 protected Enumeration<ContactPointUse> use; 384 385 /** 386 * Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values. 387 */ 388 @Child(name = "rank", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=true) 389 @Description(shortDefinition="Specify preferred order of use (1 = highest)", formalDefinition="Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values." ) 390 protected PositiveIntType rank; 391 392 /** 393 * Time period when the contact point was/is in use. 394 */ 395 @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true) 396 @Description(shortDefinition="Time period when the contact point was/is in use", formalDefinition="Time period when the contact point was/is in use." ) 397 protected Period period; 398 399 private static final long serialVersionUID = 1509610874L; 400 401 /** 402 * Constructor 403 */ 404 public ContactPoint() { 405 super(); 406 } 407 408 /** 409 * @return {@link #system} (Telecommunications form for contact point - what communications system is required to make use of the contact.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 410 */ 411 public Enumeration<ContactPointSystem> getSystemElement() { 412 if (this.system == null) 413 if (Configuration.errorOnAutoCreate()) 414 throw new Error("Attempt to auto-create ContactPoint.system"); 415 else if (Configuration.doAutoCreate()) 416 this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory()); // bb 417 return this.system; 418 } 419 420 public boolean hasSystemElement() { 421 return this.system != null && !this.system.isEmpty(); 422 } 423 424 public boolean hasSystem() { 425 return this.system != null && !this.system.isEmpty(); 426 } 427 428 /** 429 * @param value {@link #system} (Telecommunications form for contact point - what communications system is required to make use of the contact.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 430 */ 431 public ContactPoint setSystemElement(Enumeration<ContactPointSystem> value) { 432 this.system = value; 433 return this; 434 } 435 436 /** 437 * @return Telecommunications form for contact point - what communications system is required to make use of the contact. 438 */ 439 public ContactPointSystem getSystem() { 440 return this.system == null ? null : this.system.getValue(); 441 } 442 443 /** 444 * @param value Telecommunications form for contact point - what communications system is required to make use of the contact. 445 */ 446 public ContactPoint setSystem(ContactPointSystem value) { 447 if (value == null) 448 this.system = null; 449 else { 450 if (this.system == null) 451 this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory()); 452 this.system.setValue(value); 453 } 454 return this; 455 } 456 457 /** 458 * @return {@link #value} (The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 459 */ 460 public StringType getValueElement() { 461 if (this.value == null) 462 if (Configuration.errorOnAutoCreate()) 463 throw new Error("Attempt to auto-create ContactPoint.value"); 464 else if (Configuration.doAutoCreate()) 465 this.value = new StringType(); // bb 466 return this.value; 467 } 468 469 public boolean hasValueElement() { 470 return this.value != null && !this.value.isEmpty(); 471 } 472 473 public boolean hasValue() { 474 return this.value != null && !this.value.isEmpty(); 475 } 476 477 /** 478 * @param value {@link #value} (The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 479 */ 480 public ContactPoint setValueElement(StringType value) { 481 this.value = value; 482 return this; 483 } 484 485 /** 486 * @return The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address). 487 */ 488 public String getValue() { 489 return this.value == null ? null : this.value.getValue(); 490 } 491 492 /** 493 * @param value The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address). 494 */ 495 public ContactPoint setValue(String value) { 496 if (Utilities.noString(value)) 497 this.value = null; 498 else { 499 if (this.value == null) 500 this.value = new StringType(); 501 this.value.setValue(value); 502 } 503 return this; 504 } 505 506 /** 507 * @return {@link #use} (Identifies the purpose for the contact point.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 508 */ 509 public Enumeration<ContactPointUse> getUseElement() { 510 if (this.use == null) 511 if (Configuration.errorOnAutoCreate()) 512 throw new Error("Attempt to auto-create ContactPoint.use"); 513 else if (Configuration.doAutoCreate()) 514 this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory()); // bb 515 return this.use; 516 } 517 518 public boolean hasUseElement() { 519 return this.use != null && !this.use.isEmpty(); 520 } 521 522 public boolean hasUse() { 523 return this.use != null && !this.use.isEmpty(); 524 } 525 526 /** 527 * @param value {@link #use} (Identifies the purpose for the contact point.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 528 */ 529 public ContactPoint setUseElement(Enumeration<ContactPointUse> value) { 530 this.use = value; 531 return this; 532 } 533 534 /** 535 * @return Identifies the purpose for the contact point. 536 */ 537 public ContactPointUse getUse() { 538 return this.use == null ? null : this.use.getValue(); 539 } 540 541 /** 542 * @param value Identifies the purpose for the contact point. 543 */ 544 public ContactPoint setUse(ContactPointUse value) { 545 if (value == null) 546 this.use = null; 547 else { 548 if (this.use == null) 549 this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory()); 550 this.use.setValue(value); 551 } 552 return this; 553 } 554 555 /** 556 * @return {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value 557 */ 558 public PositiveIntType getRankElement() { 559 if (this.rank == null) 560 if (Configuration.errorOnAutoCreate()) 561 throw new Error("Attempt to auto-create ContactPoint.rank"); 562 else if (Configuration.doAutoCreate()) 563 this.rank = new PositiveIntType(); // bb 564 return this.rank; 565 } 566 567 public boolean hasRankElement() { 568 return this.rank != null && !this.rank.isEmpty(); 569 } 570 571 public boolean hasRank() { 572 return this.rank != null && !this.rank.isEmpty(); 573 } 574 575 /** 576 * @param value {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value 577 */ 578 public ContactPoint setRankElement(PositiveIntType value) { 579 this.rank = value; 580 return this; 581 } 582 583 /** 584 * @return Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values. 585 */ 586 public int getRank() { 587 return this.rank == null || this.rank.isEmpty() ? 0 : this.rank.getValue(); 588 } 589 590 /** 591 * @param value Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values. 592 */ 593 public ContactPoint setRank(int value) { 594 if (this.rank == null) 595 this.rank = new PositiveIntType(); 596 this.rank.setValue(value); 597 return this; 598 } 599 600 /** 601 * @return {@link #period} (Time period when the contact point was/is in use.) 602 */ 603 public Period getPeriod() { 604 if (this.period == null) 605 if (Configuration.errorOnAutoCreate()) 606 throw new Error("Attempt to auto-create ContactPoint.period"); 607 else if (Configuration.doAutoCreate()) 608 this.period = new Period(); // cc 609 return this.period; 610 } 611 612 public boolean hasPeriod() { 613 return this.period != null && !this.period.isEmpty(); 614 } 615 616 /** 617 * @param value {@link #period} (Time period when the contact point was/is in use.) 618 */ 619 public ContactPoint setPeriod(Period value) { 620 this.period = value; 621 return this; 622 } 623 624 protected void listChildren(List<Property> children) { 625 super.listChildren(children); 626 children.add(new Property("system", "code", "Telecommunications form for contact point - what communications system is required to make use of the contact.", 0, 1, system)); 627 children.add(new Property("value", "string", "The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).", 0, 1, value)); 628 children.add(new Property("use", "code", "Identifies the purpose for the contact point.", 0, 1, use)); 629 children.add(new Property("rank", "positiveInt", "Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.", 0, 1, rank)); 630 children.add(new Property("period", "Period", "Time period when the contact point was/is in use.", 0, 1, period)); 631 } 632 633 @Override 634 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 635 switch (_hash) { 636 case -887328209: /*system*/ return new Property("system", "code", "Telecommunications form for contact point - what communications system is required to make use of the contact.", 0, 1, system); 637 case 111972721: /*value*/ return new Property("value", "string", "The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).", 0, 1, value); 638 case 116103: /*use*/ return new Property("use", "code", "Identifies the purpose for the contact point.", 0, 1, use); 639 case 3492908: /*rank*/ return new Property("rank", "positiveInt", "Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.", 0, 1, rank); 640 case -991726143: /*period*/ return new Property("period", "Period", "Time period when the contact point was/is in use.", 0, 1, period); 641 default: return super.getNamedProperty(_hash, _name, _checkValid); 642 } 643 644 } 645 646 @Override 647 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 648 switch (hash) { 649 case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // Enumeration<ContactPointSystem> 650 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType 651 case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<ContactPointUse> 652 case 3492908: /*rank*/ return this.rank == null ? new Base[0] : new Base[] {this.rank}; // PositiveIntType 653 case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period 654 default: return super.getProperty(hash, name, checkValid); 655 } 656 657 } 658 659 @Override 660 public Base setProperty(int hash, String name, Base value) throws FHIRException { 661 switch (hash) { 662 case -887328209: // system 663 value = new ContactPointSystemEnumFactory().fromType(castToCode(value)); 664 this.system = (Enumeration) value; // Enumeration<ContactPointSystem> 665 return value; 666 case 111972721: // value 667 this.value = castToString(value); // StringType 668 return value; 669 case 116103: // use 670 value = new ContactPointUseEnumFactory().fromType(castToCode(value)); 671 this.use = (Enumeration) value; // Enumeration<ContactPointUse> 672 return value; 673 case 3492908: // rank 674 this.rank = castToPositiveInt(value); // PositiveIntType 675 return value; 676 case -991726143: // period 677 this.period = castToPeriod(value); // Period 678 return value; 679 default: return super.setProperty(hash, name, value); 680 } 681 682 } 683 684 @Override 685 public Base setProperty(String name, Base value) throws FHIRException { 686 if (name.equals("system")) { 687 value = new ContactPointSystemEnumFactory().fromType(castToCode(value)); 688 this.system = (Enumeration) value; // Enumeration<ContactPointSystem> 689 } else if (name.equals("value")) { 690 this.value = castToString(value); // StringType 691 } else if (name.equals("use")) { 692 value = new ContactPointUseEnumFactory().fromType(castToCode(value)); 693 this.use = (Enumeration) value; // Enumeration<ContactPointUse> 694 } else if (name.equals("rank")) { 695 this.rank = castToPositiveInt(value); // PositiveIntType 696 } else if (name.equals("period")) { 697 this.period = castToPeriod(value); // Period 698 } else 699 return super.setProperty(name, value); 700 return value; 701 } 702 703 @Override 704 public Base makeProperty(int hash, String name) throws FHIRException { 705 switch (hash) { 706 case -887328209: return getSystemElement(); 707 case 111972721: return getValueElement(); 708 case 116103: return getUseElement(); 709 case 3492908: return getRankElement(); 710 case -991726143: return getPeriod(); 711 default: return super.makeProperty(hash, name); 712 } 713 714 } 715 716 @Override 717 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 718 switch (hash) { 719 case -887328209: /*system*/ return new String[] {"code"}; 720 case 111972721: /*value*/ return new String[] {"string"}; 721 case 116103: /*use*/ return new String[] {"code"}; 722 case 3492908: /*rank*/ return new String[] {"positiveInt"}; 723 case -991726143: /*period*/ return new String[] {"Period"}; 724 default: return super.getTypesForProperty(hash, name); 725 } 726 727 } 728 729 @Override 730 public Base addChild(String name) throws FHIRException { 731 if (name.equals("system")) { 732 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.system"); 733 } 734 else if (name.equals("value")) { 735 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.value"); 736 } 737 else if (name.equals("use")) { 738 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.use"); 739 } 740 else if (name.equals("rank")) { 741 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.rank"); 742 } 743 else if (name.equals("period")) { 744 this.period = new Period(); 745 return this.period; 746 } 747 else 748 return super.addChild(name); 749 } 750 751 public String fhirType() { 752 return "ContactPoint"; 753 754 } 755 756 public ContactPoint copy() { 757 ContactPoint dst = new ContactPoint(); 758 copyValues(dst); 759 dst.system = system == null ? null : system.copy(); 760 dst.value = value == null ? null : value.copy(); 761 dst.use = use == null ? null : use.copy(); 762 dst.rank = rank == null ? null : rank.copy(); 763 dst.period = period == null ? null : period.copy(); 764 return dst; 765 } 766 767 protected ContactPoint typedCopy() { 768 return copy(); 769 } 770 771 @Override 772 public boolean equalsDeep(Base other_) { 773 if (!super.equalsDeep(other_)) 774 return false; 775 if (!(other_ instanceof ContactPoint)) 776 return false; 777 ContactPoint o = (ContactPoint) other_; 778 return compareDeep(system, o.system, true) && compareDeep(value, o.value, true) && compareDeep(use, o.use, true) 779 && compareDeep(rank, o.rank, true) && compareDeep(period, o.period, true); 780 } 781 782 @Override 783 public boolean equalsShallow(Base other_) { 784 if (!super.equalsShallow(other_)) 785 return false; 786 if (!(other_ instanceof ContactPoint)) 787 return false; 788 ContactPoint o = (ContactPoint) other_; 789 return compareValues(system, o.system, true) && compareValues(value, o.value, true) && compareValues(use, o.use, true) 790 && compareValues(rank, o.rank, true); 791 } 792 793 public boolean isEmpty() { 794 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(system, value, use, rank 795 , period); 796 } 797 798 799} 800