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