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