001package org.hl7.fhir.dstu2.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.dstu2 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 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 053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 054import java.util.List; 055 056import ca.uhn.fhir.model.api.annotation.Child; 057import ca.uhn.fhir.model.api.annotation.DatatypeDef; 058import ca.uhn.fhir.model.api.annotation.Description; 059import org.hl7.fhir.instance.model.api.ICompositeType; 060import org.hl7.fhir.exceptions.FHIRException; 061import org.hl7.fhir.utilities.Utilities; 062/** 063 * Details for all kinds of technology mediated contact points for a person or organization, including telephone, email, etc. 064 */ 065@DatatypeDef(name="ContactPoint") 066public class ContactPoint extends Type implements ICompositeType { 067 068 public enum ContactPointSystem { 069 /** 070 * 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. 071 */ 072 PHONE, 073 /** 074 * The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required. 075 */ 076 FAX, 077 /** 078 * The value is an email address. 079 */ 080 EMAIL, 081 /** 082 * The value is a pager number. These may be local pager numbers that are only usable on a particular pager system. 083 */ 084 PAGER, 085 /** 086 * A contact that is not a phone, fax, or email address. The format of the value SHOULD be a URL. This is intended for various personal contacts including blogs, Twitter, Facebook, etc. Do not use for email addresses. If this is not a URL, then it will require human interpretation. 087 */ 088 OTHER, 089 /** 090 * added to help the parsers 091 */ 092 NULL; 093 public static ContactPointSystem fromCode(String codeString) throws FHIRException { 094 if (codeString == null || "".equals(codeString)) 095 return null; 096 if ("phone".equals(codeString)) 097 return PHONE; 098 if ("fax".equals(codeString)) 099 return FAX; 100 if ("email".equals(codeString)) 101 return EMAIL; 102 if ("pager".equals(codeString)) 103 return PAGER; 104 if ("other".equals(codeString)) 105 return OTHER; 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 OTHER: return "other"; 115 default: return "?"; 116 } 117 } 118 public String getSystem() { 119 switch (this) { 120 case PHONE: return "http://hl7.org/fhir/contact-point-system"; 121 case FAX: return "http://hl7.org/fhir/contact-point-system"; 122 case EMAIL: return "http://hl7.org/fhir/contact-point-system"; 123 case PAGER: return "http://hl7.org/fhir/contact-point-system"; 124 case OTHER: return "http://hl7.org/fhir/contact-point-system"; 125 default: return "?"; 126 } 127 } 128 public String getDefinition() { 129 switch (this) { 130 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."; 131 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."; 132 case EMAIL: return "The value is an email address."; 133 case PAGER: return "The value is a pager number. These may be local pager numbers that are only usable on a particular pager system."; 134 case OTHER: return "A contact that is not a phone, fax, or email address. The format of the value SHOULD be a URL. This is intended for various personal contacts including blogs, Twitter, Facebook, etc. Do not use for email addresses. If this is not a URL, then it will require human interpretation."; 135 default: return "?"; 136 } 137 } 138 public String getDisplay() { 139 switch (this) { 140 case PHONE: return "Phone"; 141 case FAX: return "Fax"; 142 case EMAIL: return "Email"; 143 case PAGER: return "Pager"; 144 case OTHER: return "URL"; 145 default: return "?"; 146 } 147 } 148 } 149 150 public static class ContactPointSystemEnumFactory implements EnumFactory<ContactPointSystem> { 151 public ContactPointSystem fromCode(String codeString) throws IllegalArgumentException { 152 if (codeString == null || "".equals(codeString)) 153 if (codeString == null || "".equals(codeString)) 154 return null; 155 if ("phone".equals(codeString)) 156 return ContactPointSystem.PHONE; 157 if ("fax".equals(codeString)) 158 return ContactPointSystem.FAX; 159 if ("email".equals(codeString)) 160 return ContactPointSystem.EMAIL; 161 if ("pager".equals(codeString)) 162 return ContactPointSystem.PAGER; 163 if ("other".equals(codeString)) 164 return ContactPointSystem.OTHER; 165 throw new IllegalArgumentException("Unknown ContactPointSystem code '"+codeString+"'"); 166 } 167 public Enumeration<ContactPointSystem> fromType(Base code) throws FHIRException { 168 if (code == null || code.isEmpty()) 169 return null; 170 String codeString = ((PrimitiveType) code).asStringValue(); 171 if (codeString == null || "".equals(codeString)) 172 return null; 173 if ("phone".equals(codeString)) 174 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PHONE); 175 if ("fax".equals(codeString)) 176 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.FAX); 177 if ("email".equals(codeString)) 178 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.EMAIL); 179 if ("pager".equals(codeString)) 180 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PAGER); 181 if ("other".equals(codeString)) 182 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.OTHER); 183 throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'"); 184 } 185 public String toCode(ContactPointSystem code) { 186 if (code == ContactPointSystem.PHONE) 187 return "phone"; 188 if (code == ContactPointSystem.FAX) 189 return "fax"; 190 if (code == ContactPointSystem.EMAIL) 191 return "email"; 192 if (code == ContactPointSystem.PAGER) 193 return "pager"; 194 if (code == ContactPointSystem.OTHER) 195 return "other"; 196 return "?"; 197 } 198 } 199 200 public enum ContactPointUse { 201 /** 202 * 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. 203 */ 204 HOME, 205 /** 206 * An office contact point. First choice for business related contacts during business hours. 207 */ 208 WORK, 209 /** 210 * A temporary contact point. The period can provide more detailed information. 211 */ 212 TEMP, 213 /** 214 * This contact point is no longer in use (or was never correct, but retained for records). 215 */ 216 OLD, 217 /** 218 * 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. 219 */ 220 MOBILE, 221 /** 222 * added to help the parsers 223 */ 224 NULL; 225 public static ContactPointUse fromCode(String codeString) throws FHIRException { 226 if (codeString == null || "".equals(codeString)) 227 return null; 228 if ("home".equals(codeString)) 229 return HOME; 230 if ("work".equals(codeString)) 231 return WORK; 232 if ("temp".equals(codeString)) 233 return TEMP; 234 if ("old".equals(codeString)) 235 return OLD; 236 if ("mobile".equals(codeString)) 237 return MOBILE; 238 throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'"); 239 } 240 public String toCode() { 241 switch (this) { 242 case HOME: return "home"; 243 case WORK: return "work"; 244 case TEMP: return "temp"; 245 case OLD: return "old"; 246 case MOBILE: return "mobile"; 247 default: return "?"; 248 } 249 } 250 public String getSystem() { 251 switch (this) { 252 case HOME: return "http://hl7.org/fhir/contact-point-use"; 253 case WORK: return "http://hl7.org/fhir/contact-point-use"; 254 case TEMP: return "http://hl7.org/fhir/contact-point-use"; 255 case OLD: return "http://hl7.org/fhir/contact-point-use"; 256 case MOBILE: return "http://hl7.org/fhir/contact-point-use"; 257 default: return "?"; 258 } 259 } 260 public String getDefinition() { 261 switch (this) { 262 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."; 263 case WORK: return "An office contact point. First choice for business related contacts during business hours."; 264 case TEMP: return "A temporary contact point. The period can provide more detailed information."; 265 case OLD: return "This contact point is no longer in use (or was never correct, but retained for records)."; 266 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."; 267 default: return "?"; 268 } 269 } 270 public String getDisplay() { 271 switch (this) { 272 case HOME: return "Home"; 273 case WORK: return "Work"; 274 case TEMP: return "Temp"; 275 case OLD: return "Old"; 276 case MOBILE: return "Mobile"; 277 default: return "?"; 278 } 279 } 280 } 281 282 public static class ContactPointUseEnumFactory implements EnumFactory<ContactPointUse> { 283 public ContactPointUse fromCode(String codeString) throws IllegalArgumentException { 284 if (codeString == null || "".equals(codeString)) 285 if (codeString == null || "".equals(codeString)) 286 return null; 287 if ("home".equals(codeString)) 288 return ContactPointUse.HOME; 289 if ("work".equals(codeString)) 290 return ContactPointUse.WORK; 291 if ("temp".equals(codeString)) 292 return ContactPointUse.TEMP; 293 if ("old".equals(codeString)) 294 return ContactPointUse.OLD; 295 if ("mobile".equals(codeString)) 296 return ContactPointUse.MOBILE; 297 throw new IllegalArgumentException("Unknown ContactPointUse code '"+codeString+"'"); 298 } 299 public Enumeration<ContactPointUse> fromType(Base code) throws FHIRException { 300 if (code == null || code.isEmpty()) 301 return null; 302 String codeString = ((PrimitiveType) code).asStringValue(); 303 if (codeString == null || "".equals(codeString)) 304 return null; 305 if ("home".equals(codeString)) 306 return new Enumeration<ContactPointUse>(this, ContactPointUse.HOME); 307 if ("work".equals(codeString)) 308 return new Enumeration<ContactPointUse>(this, ContactPointUse.WORK); 309 if ("temp".equals(codeString)) 310 return new Enumeration<ContactPointUse>(this, ContactPointUse.TEMP); 311 if ("old".equals(codeString)) 312 return new Enumeration<ContactPointUse>(this, ContactPointUse.OLD); 313 if ("mobile".equals(codeString)) 314 return new Enumeration<ContactPointUse>(this, ContactPointUse.MOBILE); 315 throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'"); 316 } 317 public String toCode(ContactPointUse code) { 318 if (code == ContactPointUse.HOME) 319 return "home"; 320 if (code == ContactPointUse.WORK) 321 return "work"; 322 if (code == ContactPointUse.TEMP) 323 return "temp"; 324 if (code == ContactPointUse.OLD) 325 return "old"; 326 if (code == ContactPointUse.MOBILE) 327 return "mobile"; 328 return "?"; 329 } 330 } 331 332 /** 333 * Telecommunications form for contact point - what communications system is required to make use of the contact. 334 */ 335 @Child(name = "system", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true) 336 @Description(shortDefinition="phone | fax | email | pager | other", formalDefinition="Telecommunications form for contact point - what communications system is required to make use of the contact." ) 337 protected Enumeration<ContactPointSystem> system; 338 339 /** 340 * The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address). 341 */ 342 @Child(name = "value", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 343 @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)." ) 344 protected StringType value; 345 346 /** 347 * Identifies the purpose for the contact point. 348 */ 349 @Child(name = "use", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true) 350 @Description(shortDefinition="home | work | temp | old | mobile - purpose of this contact point", formalDefinition="Identifies the purpose for the contact point." ) 351 protected Enumeration<ContactPointUse> use; 352 353 /** 354 * Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values. 355 */ 356 @Child(name = "rank", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=true) 357 @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." ) 358 protected PositiveIntType rank; 359 360 /** 361 * Time period when the contact point was/is in use. 362 */ 363 @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true) 364 @Description(shortDefinition="Time period when the contact point was/is in use", formalDefinition="Time period when the contact point was/is in use." ) 365 protected Period period; 366 367 private static final long serialVersionUID = 1509610874L; 368 369 /* 370 * Constructor 371 */ 372 public ContactPoint() { 373 super(); 374 } 375 376 /** 377 * @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 378 */ 379 public Enumeration<ContactPointSystem> getSystemElement() { 380 if (this.system == null) 381 if (Configuration.errorOnAutoCreate()) 382 throw new Error("Attempt to auto-create ContactPoint.system"); 383 else if (Configuration.doAutoCreate()) 384 this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory()); // bb 385 return this.system; 386 } 387 388 public boolean hasSystemElement() { 389 return this.system != null && !this.system.isEmpty(); 390 } 391 392 public boolean hasSystem() { 393 return this.system != null && !this.system.isEmpty(); 394 } 395 396 /** 397 * @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 398 */ 399 public ContactPoint setSystemElement(Enumeration<ContactPointSystem> value) { 400 this.system = value; 401 return this; 402 } 403 404 /** 405 * @return Telecommunications form for contact point - what communications system is required to make use of the contact. 406 */ 407 public ContactPointSystem getSystem() { 408 return this.system == null ? null : this.system.getValue(); 409 } 410 411 /** 412 * @param value Telecommunications form for contact point - what communications system is required to make use of the contact. 413 */ 414 public ContactPoint setSystem(ContactPointSystem value) { 415 if (value == null) 416 this.system = null; 417 else { 418 if (this.system == null) 419 this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory()); 420 this.system.setValue(value); 421 } 422 return this; 423 } 424 425 /** 426 * @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 427 */ 428 public StringType getValueElement() { 429 if (this.value == null) 430 if (Configuration.errorOnAutoCreate()) 431 throw new Error("Attempt to auto-create ContactPoint.value"); 432 else if (Configuration.doAutoCreate()) 433 this.value = new StringType(); // bb 434 return this.value; 435 } 436 437 public boolean hasValueElement() { 438 return this.value != null && !this.value.isEmpty(); 439 } 440 441 public boolean hasValue() { 442 return this.value != null && !this.value.isEmpty(); 443 } 444 445 /** 446 * @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 447 */ 448 public ContactPoint setValueElement(StringType value) { 449 this.value = value; 450 return this; 451 } 452 453 /** 454 * @return The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address). 455 */ 456 public String getValue() { 457 return this.value == null ? null : this.value.getValue(); 458 } 459 460 /** 461 * @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). 462 */ 463 public ContactPoint setValue(String value) { 464 if (Utilities.noString(value)) 465 this.value = null; 466 else { 467 if (this.value == null) 468 this.value = new StringType(); 469 this.value.setValue(value); 470 } 471 return this; 472 } 473 474 /** 475 * @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 476 */ 477 public Enumeration<ContactPointUse> getUseElement() { 478 if (this.use == null) 479 if (Configuration.errorOnAutoCreate()) 480 throw new Error("Attempt to auto-create ContactPoint.use"); 481 else if (Configuration.doAutoCreate()) 482 this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory()); // bb 483 return this.use; 484 } 485 486 public boolean hasUseElement() { 487 return this.use != null && !this.use.isEmpty(); 488 } 489 490 public boolean hasUse() { 491 return this.use != null && !this.use.isEmpty(); 492 } 493 494 /** 495 * @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 496 */ 497 public ContactPoint setUseElement(Enumeration<ContactPointUse> value) { 498 this.use = value; 499 return this; 500 } 501 502 /** 503 * @return Identifies the purpose for the contact point. 504 */ 505 public ContactPointUse getUse() { 506 return this.use == null ? null : this.use.getValue(); 507 } 508 509 /** 510 * @param value Identifies the purpose for the contact point. 511 */ 512 public ContactPoint setUse(ContactPointUse value) { 513 if (value == null) 514 this.use = null; 515 else { 516 if (this.use == null) 517 this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory()); 518 this.use.setValue(value); 519 } 520 return this; 521 } 522 523 /** 524 * @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 525 */ 526 public PositiveIntType getRankElement() { 527 if (this.rank == null) 528 if (Configuration.errorOnAutoCreate()) 529 throw new Error("Attempt to auto-create ContactPoint.rank"); 530 else if (Configuration.doAutoCreate()) 531 this.rank = new PositiveIntType(); // bb 532 return this.rank; 533 } 534 535 public boolean hasRankElement() { 536 return this.rank != null && !this.rank.isEmpty(); 537 } 538 539 public boolean hasRank() { 540 return this.rank != null && !this.rank.isEmpty(); 541 } 542 543 /** 544 * @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 545 */ 546 public ContactPoint setRankElement(PositiveIntType value) { 547 this.rank = value; 548 return this; 549 } 550 551 /** 552 * @return Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values. 553 */ 554 public int getRank() { 555 return this.rank == null || this.rank.isEmpty() ? 0 : this.rank.getValue(); 556 } 557 558 /** 559 * @param value Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values. 560 */ 561 public ContactPoint setRank(int value) { 562 if (this.rank == null) 563 this.rank = new PositiveIntType(); 564 this.rank.setValue(value); 565 return this; 566 } 567 568 /** 569 * @return {@link #period} (Time period when the contact point was/is in use.) 570 */ 571 public Period getPeriod() { 572 if (this.period == null) 573 if (Configuration.errorOnAutoCreate()) 574 throw new Error("Attempt to auto-create ContactPoint.period"); 575 else if (Configuration.doAutoCreate()) 576 this.period = new Period(); // cc 577 return this.period; 578 } 579 580 public boolean hasPeriod() { 581 return this.period != null && !this.period.isEmpty(); 582 } 583 584 /** 585 * @param value {@link #period} (Time period when the contact point was/is in use.) 586 */ 587 public ContactPoint setPeriod(Period value) { 588 this.period = value; 589 return this; 590 } 591 592 protected void listChildren(List<Property> childrenList) { 593 super.listChildren(childrenList); 594 childrenList.add(new Property("system", "code", "Telecommunications form for contact point - what communications system is required to make use of the contact.", 0, java.lang.Integer.MAX_VALUE, system)); 595 childrenList.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, java.lang.Integer.MAX_VALUE, value)); 596 childrenList.add(new Property("use", "code", "Identifies the purpose for the contact point.", 0, java.lang.Integer.MAX_VALUE, use)); 597 childrenList.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, java.lang.Integer.MAX_VALUE, rank)); 598 childrenList.add(new Property("period", "Period", "Time period when the contact point was/is in use.", 0, java.lang.Integer.MAX_VALUE, period)); 599 } 600 601 @Override 602 public void setProperty(String name, Base value) throws FHIRException { 603 if (name.equals("system")) 604 this.system = new ContactPointSystemEnumFactory().fromType(value); // Enumeration<ContactPointSystem> 605 else if (name.equals("value")) 606 this.value = castToString(value); // StringType 607 else if (name.equals("use")) 608 this.use = new ContactPointUseEnumFactory().fromType(value); // Enumeration<ContactPointUse> 609 else if (name.equals("rank")) 610 this.rank = castToPositiveInt(value); // PositiveIntType 611 else if (name.equals("period")) 612 this.period = castToPeriod(value); // Period 613 else 614 super.setProperty(name, value); 615 } 616 617 @Override 618 public Base addChild(String name) throws FHIRException { 619 if (name.equals("system")) { 620 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.system"); 621 } 622 else if (name.equals("value")) { 623 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.value"); 624 } 625 else if (name.equals("use")) { 626 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.use"); 627 } 628 else if (name.equals("rank")) { 629 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.rank"); 630 } 631 else if (name.equals("period")) { 632 this.period = new Period(); 633 return this.period; 634 } 635 else 636 return super.addChild(name); 637 } 638 639 public String fhirType() { 640 return "ContactPoint"; 641 642 } 643 644 public ContactPoint copy() { 645 ContactPoint dst = new ContactPoint(); 646 copyValues(dst); 647 dst.system = system == null ? null : system.copy(); 648 dst.value = value == null ? null : value.copy(); 649 dst.use = use == null ? null : use.copy(); 650 dst.rank = rank == null ? null : rank.copy(); 651 dst.period = period == null ? null : period.copy(); 652 return dst; 653 } 654 655 protected ContactPoint typedCopy() { 656 return copy(); 657 } 658 659 @Override 660 public boolean equalsDeep(Base other) { 661 if (!super.equalsDeep(other)) 662 return false; 663 if (!(other instanceof ContactPoint)) 664 return false; 665 ContactPoint o = (ContactPoint) other; 666 return compareDeep(system, o.system, true) && compareDeep(value, o.value, true) && compareDeep(use, o.use, true) 667 && compareDeep(rank, o.rank, true) && compareDeep(period, o.period, true); 668 } 669 670 @Override 671 public boolean equalsShallow(Base other) { 672 if (!super.equalsShallow(other)) 673 return false; 674 if (!(other instanceof ContactPoint)) 675 return false; 676 ContactPoint o = (ContactPoint) other; 677 return compareValues(system, o.system, true) && compareValues(value, o.value, true) && compareValues(use, o.use, true) 678 && compareValues(rank, o.rank, true); 679 } 680 681 public boolean isEmpty() { 682 return super.isEmpty() && (system == null || system.isEmpty()) && (value == null || value.isEmpty()) 683 && (use == null || use.isEmpty()) && (rank == null || rank.isEmpty()) && (period == null || period.isEmpty()) 684 ; 685 } 686 687 688} 689