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 Identifier Type: An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers. 070 */ 071@DatatypeDef(name="Identifier") 072public class Identifier extends DataType implements ICompositeType { 073 074 public enum IdentifierUse { 075 /** 076 * The identifier recommended for display and use in real-world interactions. 077 */ 078 USUAL, 079 /** 080 * The identifier considered to be most trusted for the identification of this item. Sometimes also known as \"primary\" and \"main\". The determination of \"official\" is subjective and implementation guides often provide additional guidelines for use. 081 */ 082 OFFICIAL, 083 /** 084 * A temporary identifier. 085 */ 086 TEMP, 087 /** 088 * An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context. 089 */ 090 SECONDARY, 091 /** 092 * The identifier id no longer considered valid, but may be relevant for search purposes. E.g. Changes to identifier schemes, account merges, etc. 093 */ 094 OLD, 095 /** 096 * added to help the parsers with the generic types 097 */ 098 NULL; 099 public static IdentifierUse fromCode(String codeString) throws FHIRException { 100 if (codeString == null || "".equals(codeString)) 101 return null; 102 if ("usual".equals(codeString)) 103 return USUAL; 104 if ("official".equals(codeString)) 105 return OFFICIAL; 106 if ("temp".equals(codeString)) 107 return TEMP; 108 if ("secondary".equals(codeString)) 109 return SECONDARY; 110 if ("old".equals(codeString)) 111 return OLD; 112 if (Configuration.isAcceptInvalidEnums()) 113 return null; 114 else 115 throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'"); 116 } 117 public String toCode() { 118 switch (this) { 119 case USUAL: return "usual"; 120 case OFFICIAL: return "official"; 121 case TEMP: return "temp"; 122 case SECONDARY: return "secondary"; 123 case OLD: return "old"; 124 default: return "?"; 125 } 126 } 127 public String getSystem() { 128 switch (this) { 129 case USUAL: return "http://hl7.org/fhir/identifier-use"; 130 case OFFICIAL: return "http://hl7.org/fhir/identifier-use"; 131 case TEMP: return "http://hl7.org/fhir/identifier-use"; 132 case SECONDARY: return "http://hl7.org/fhir/identifier-use"; 133 case OLD: return "http://hl7.org/fhir/identifier-use"; 134 default: return "?"; 135 } 136 } 137 public String getDefinition() { 138 switch (this) { 139 case USUAL: return "The identifier recommended for display and use in real-world interactions."; 140 case OFFICIAL: return "The identifier considered to be most trusted for the identification of this item. Sometimes also known as \"primary\" and \"main\". The determination of \"official\" is subjective and implementation guides often provide additional guidelines for use."; 141 case TEMP: return "A temporary identifier."; 142 case SECONDARY: return "An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context."; 143 case OLD: return "The identifier id no longer considered valid, but may be relevant for search purposes. E.g. Changes to identifier schemes, account merges, etc."; 144 default: return "?"; 145 } 146 } 147 public String getDisplay() { 148 switch (this) { 149 case USUAL: return "Usual"; 150 case OFFICIAL: return "Official"; 151 case TEMP: return "Temp"; 152 case SECONDARY: return "Secondary"; 153 case OLD: return "Old"; 154 default: return "?"; 155 } 156 } 157 } 158 159 public static class IdentifierUseEnumFactory implements EnumFactory<IdentifierUse> { 160 public IdentifierUse fromCode(String codeString) throws IllegalArgumentException { 161 if (codeString == null || "".equals(codeString)) 162 if (codeString == null || "".equals(codeString)) 163 return null; 164 if ("usual".equals(codeString)) 165 return IdentifierUse.USUAL; 166 if ("official".equals(codeString)) 167 return IdentifierUse.OFFICIAL; 168 if ("temp".equals(codeString)) 169 return IdentifierUse.TEMP; 170 if ("secondary".equals(codeString)) 171 return IdentifierUse.SECONDARY; 172 if ("old".equals(codeString)) 173 return IdentifierUse.OLD; 174 throw new IllegalArgumentException("Unknown IdentifierUse code '"+codeString+"'"); 175 } 176 public Enumeration<IdentifierUse> fromType(Base code) throws FHIRException { 177 if (code == null) 178 return null; 179 if (code.isEmpty()) 180 return new Enumeration<IdentifierUse>(this); 181 String codeString = ((PrimitiveType) code).asStringValue(); 182 if (codeString == null || "".equals(codeString)) 183 return null; 184 if ("usual".equals(codeString)) 185 return new Enumeration<IdentifierUse>(this, IdentifierUse.USUAL); 186 if ("official".equals(codeString)) 187 return new Enumeration<IdentifierUse>(this, IdentifierUse.OFFICIAL); 188 if ("temp".equals(codeString)) 189 return new Enumeration<IdentifierUse>(this, IdentifierUse.TEMP); 190 if ("secondary".equals(codeString)) 191 return new Enumeration<IdentifierUse>(this, IdentifierUse.SECONDARY); 192 if ("old".equals(codeString)) 193 return new Enumeration<IdentifierUse>(this, IdentifierUse.OLD); 194 throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'"); 195 } 196 public String toCode(IdentifierUse code) { 197 if (code == IdentifierUse.USUAL) 198 return "usual"; 199 if (code == IdentifierUse.OFFICIAL) 200 return "official"; 201 if (code == IdentifierUse.TEMP) 202 return "temp"; 203 if (code == IdentifierUse.SECONDARY) 204 return "secondary"; 205 if (code == IdentifierUse.OLD) 206 return "old"; 207 return "?"; 208 } 209 public String toSystem(IdentifierUse code) { 210 return code.getSystem(); 211 } 212 } 213 214 /** 215 * The purpose of this identifier. 216 */ 217 @Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true) 218 @Description(shortDefinition="usual | official | temp | secondary | old (If known)", formalDefinition="The purpose of this identifier." ) 219 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/identifier-use") 220 protected Enumeration<IdentifierUse> use; 221 222 /** 223 * A coded type for the identifier that can be used to determine which identifier to use for a specific purpose. 224 */ 225 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 226 @Description(shortDefinition="Description of identifier", formalDefinition="A coded type for the identifier that can be used to determine which identifier to use for a specific purpose." ) 227 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/identifier-type") 228 protected CodeableConcept type; 229 230 /** 231 * Establishes the namespace for the value - that is, a URL that describes a set values that are unique. 232 */ 233 @Child(name = "system", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true) 234 @Description(shortDefinition="The namespace for the identifier value", formalDefinition="Establishes the namespace for the value - that is, a URL that describes a set values that are unique." ) 235 protected UriType system; 236 237 /** 238 * The portion of the identifier typically relevant to the user and which is unique within the context of the system. 239 */ 240 @Child(name = "value", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 241 @Description(shortDefinition="The value that is unique", formalDefinition="The portion of the identifier typically relevant to the user and which is unique within the context of the system." ) 242 protected StringType value; 243 244 /** 245 * Time period during which identifier is/was valid for use. 246 */ 247 @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true) 248 @Description(shortDefinition="Time period when id is/was valid for use", formalDefinition="Time period during which identifier is/was valid for use." ) 249 protected Period period; 250 251 /** 252 * Organization that issued/manages the identifier. 253 */ 254 @Child(name = "assigner", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true) 255 @Description(shortDefinition="Organization that issued id (may be just text)", formalDefinition="Organization that issued/manages the identifier." ) 256 protected Reference assigner; 257 258 private static final long serialVersionUID = 2098433371L; 259 260 /** 261 * Constructor 262 */ 263 public Identifier() { 264 super(); 265 } 266 267 /** 268 * @return {@link #use} (The purpose of this identifier.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 269 */ 270 public Enumeration<IdentifierUse> getUseElement() { 271 if (this.use == null) 272 if (Configuration.errorOnAutoCreate()) 273 throw new Error("Attempt to auto-create Identifier.use"); 274 else if (Configuration.doAutoCreate()) 275 this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory()); // bb 276 return this.use; 277 } 278 279 public boolean hasUseElement() { 280 return this.use != null && !this.use.isEmpty(); 281 } 282 283 public boolean hasUse() { 284 return this.use != null && !this.use.isEmpty(); 285 } 286 287 /** 288 * @param value {@link #use} (The purpose of this identifier.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 289 */ 290 public Identifier setUseElement(Enumeration<IdentifierUse> value) { 291 this.use = value; 292 return this; 293 } 294 295 /** 296 * @return The purpose of this identifier. 297 */ 298 public IdentifierUse getUse() { 299 return this.use == null ? null : this.use.getValue(); 300 } 301 302 /** 303 * @param value The purpose of this identifier. 304 */ 305 public Identifier setUse(IdentifierUse value) { 306 if (value == null) 307 this.use = null; 308 else { 309 if (this.use == null) 310 this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory()); 311 this.use.setValue(value); 312 } 313 return this; 314 } 315 316 /** 317 * @return {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.) 318 */ 319 public CodeableConcept getType() { 320 if (this.type == null) 321 if (Configuration.errorOnAutoCreate()) 322 throw new Error("Attempt to auto-create Identifier.type"); 323 else if (Configuration.doAutoCreate()) 324 this.type = new CodeableConcept(); // cc 325 return this.type; 326 } 327 328 public boolean hasType() { 329 return this.type != null && !this.type.isEmpty(); 330 } 331 332 /** 333 * @param value {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.) 334 */ 335 public Identifier setType(CodeableConcept value) { 336 this.type = value; 337 return this; 338 } 339 340 /** 341 * @return {@link #system} (Establishes the namespace for the value - that is, a URL that describes a set values that are unique.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 342 */ 343 public UriType getSystemElement() { 344 if (this.system == null) 345 if (Configuration.errorOnAutoCreate()) 346 throw new Error("Attempt to auto-create Identifier.system"); 347 else if (Configuration.doAutoCreate()) 348 this.system = new UriType(); // bb 349 return this.system; 350 } 351 352 public boolean hasSystemElement() { 353 return this.system != null && !this.system.isEmpty(); 354 } 355 356 public boolean hasSystem() { 357 return this.system != null && !this.system.isEmpty(); 358 } 359 360 /** 361 * @param value {@link #system} (Establishes the namespace for the value - that is, a URL that describes a set values that are unique.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 362 */ 363 public Identifier setSystemElement(UriType value) { 364 this.system = value; 365 return this; 366 } 367 368 /** 369 * @return Establishes the namespace for the value - that is, a URL that describes a set values that are unique. 370 */ 371 public String getSystem() { 372 return this.system == null ? null : this.system.getValue(); 373 } 374 375 /** 376 * @param value Establishes the namespace for the value - that is, a URL that describes a set values that are unique. 377 */ 378 public Identifier setSystem(String value) { 379 if (Utilities.noString(value)) 380 this.system = null; 381 else { 382 if (this.system == null) 383 this.system = new UriType(); 384 this.system.setValue(value); 385 } 386 return this; 387 } 388 389 /** 390 * @return {@link #value} (The portion of the identifier typically relevant to the user and which is unique within the context of the system.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 391 */ 392 public StringType getValueElement() { 393 if (this.value == null) 394 if (Configuration.errorOnAutoCreate()) 395 throw new Error("Attempt to auto-create Identifier.value"); 396 else if (Configuration.doAutoCreate()) 397 this.value = new StringType(); // bb 398 return this.value; 399 } 400 401 public boolean hasValueElement() { 402 return this.value != null && !this.value.isEmpty(); 403 } 404 405 public boolean hasValue() { 406 return this.value != null && !this.value.isEmpty(); 407 } 408 409 /** 410 * @param value {@link #value} (The portion of the identifier typically relevant to the user and which is unique within the context of the system.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 411 */ 412 public Identifier setValueElement(StringType value) { 413 this.value = value; 414 return this; 415 } 416 417 /** 418 * @return The portion of the identifier typically relevant to the user and which is unique within the context of the system. 419 */ 420 public String getValue() { 421 return this.value == null ? null : this.value.getValue(); 422 } 423 424 /** 425 * @param value The portion of the identifier typically relevant to the user and which is unique within the context of the system. 426 */ 427 public Identifier setValue(String value) { 428 if (Utilities.noString(value)) 429 this.value = null; 430 else { 431 if (this.value == null) 432 this.value = new StringType(); 433 this.value.setValue(value); 434 } 435 return this; 436 } 437 438 /** 439 * @return {@link #period} (Time period during which identifier is/was valid for use.) 440 */ 441 public Period getPeriod() { 442 if (this.period == null) 443 if (Configuration.errorOnAutoCreate()) 444 throw new Error("Attempt to auto-create Identifier.period"); 445 else if (Configuration.doAutoCreate()) 446 this.period = new Period(); // cc 447 return this.period; 448 } 449 450 public boolean hasPeriod() { 451 return this.period != null && !this.period.isEmpty(); 452 } 453 454 /** 455 * @param value {@link #period} (Time period during which identifier is/was valid for use.) 456 */ 457 public Identifier setPeriod(Period value) { 458 this.period = value; 459 return this; 460 } 461 462 /** 463 * @return {@link #assigner} (Organization that issued/manages the identifier.) 464 */ 465 public Reference getAssigner() { 466 if (this.assigner == null) 467 if (Configuration.errorOnAutoCreate()) 468 throw new Error("Attempt to auto-create Identifier.assigner"); 469 else if (Configuration.doAutoCreate()) 470 this.assigner = new Reference(); // cc 471 return this.assigner; 472 } 473 474 public boolean hasAssigner() { 475 return this.assigner != null && !this.assigner.isEmpty(); 476 } 477 478 /** 479 * @param value {@link #assigner} (Organization that issued/manages the identifier.) 480 */ 481 public Identifier setAssigner(Reference value) { 482 this.assigner = value; 483 return this; 484 } 485 486 protected void listChildren(List<Property> children) { 487 super.listChildren(children); 488 children.add(new Property("use", "code", "The purpose of this identifier.", 0, 1, use)); 489 children.add(new Property("type", "CodeableConcept", "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.", 0, 1, type)); 490 children.add(new Property("system", "uri", "Establishes the namespace for the value - that is, a URL that describes a set values that are unique.", 0, 1, system)); 491 children.add(new Property("value", "string", "The portion of the identifier typically relevant to the user and which is unique within the context of the system.", 0, 1, value)); 492 children.add(new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period)); 493 children.add(new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner)); 494 } 495 496 @Override 497 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 498 switch (_hash) { 499 case 116103: /*use*/ return new Property("use", "code", "The purpose of this identifier.", 0, 1, use); 500 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.", 0, 1, type); 501 case -887328209: /*system*/ return new Property("system", "uri", "Establishes the namespace for the value - that is, a URL that describes a set values that are unique.", 0, 1, system); 502 case 111972721: /*value*/ return new Property("value", "string", "The portion of the identifier typically relevant to the user and which is unique within the context of the system.", 0, 1, value); 503 case -991726143: /*period*/ return new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period); 504 case -369881636: /*assigner*/ return new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner); 505 default: return super.getNamedProperty(_hash, _name, _checkValid); 506 } 507 508 } 509 510 @Override 511 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 512 switch (hash) { 513 case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<IdentifierUse> 514 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 515 case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType 516 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType 517 case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period 518 case -369881636: /*assigner*/ return this.assigner == null ? new Base[0] : new Base[] {this.assigner}; // Reference 519 default: return super.getProperty(hash, name, checkValid); 520 } 521 522 } 523 524 @Override 525 public Base setProperty(int hash, String name, Base value) throws FHIRException { 526 switch (hash) { 527 case 116103: // use 528 value = new IdentifierUseEnumFactory().fromType(TypeConvertor.castToCode(value)); 529 this.use = (Enumeration) value; // Enumeration<IdentifierUse> 530 return value; 531 case 3575610: // type 532 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 533 return value; 534 case -887328209: // system 535 this.system = TypeConvertor.castToUri(value); // UriType 536 return value; 537 case 111972721: // value 538 this.value = TypeConvertor.castToString(value); // StringType 539 return value; 540 case -991726143: // period 541 this.period = TypeConvertor.castToPeriod(value); // Period 542 return value; 543 case -369881636: // assigner 544 this.assigner = TypeConvertor.castToReference(value); // Reference 545 return value; 546 default: return super.setProperty(hash, name, value); 547 } 548 549 } 550 551 @Override 552 public Base setProperty(String name, Base value) throws FHIRException { 553 if (name.equals("use")) { 554 value = new IdentifierUseEnumFactory().fromType(TypeConvertor.castToCode(value)); 555 this.use = (Enumeration) value; // Enumeration<IdentifierUse> 556 } else if (name.equals("type")) { 557 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 558 } else if (name.equals("system")) { 559 this.system = TypeConvertor.castToUri(value); // UriType 560 } else if (name.equals("value")) { 561 this.value = TypeConvertor.castToString(value); // StringType 562 } else if (name.equals("period")) { 563 this.period = TypeConvertor.castToPeriod(value); // Period 564 } else if (name.equals("assigner")) { 565 this.assigner = TypeConvertor.castToReference(value); // Reference 566 } else 567 return super.setProperty(name, value); 568 return value; 569 } 570 571 @Override 572 public Base makeProperty(int hash, String name) throws FHIRException { 573 switch (hash) { 574 case 116103: return getUseElement(); 575 case 3575610: return getType(); 576 case -887328209: return getSystemElement(); 577 case 111972721: return getValueElement(); 578 case -991726143: return getPeriod(); 579 case -369881636: return getAssigner(); 580 default: return super.makeProperty(hash, name); 581 } 582 583 } 584 585 @Override 586 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 587 switch (hash) { 588 case 116103: /*use*/ return new String[] {"code"}; 589 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 590 case -887328209: /*system*/ return new String[] {"uri"}; 591 case 111972721: /*value*/ return new String[] {"string"}; 592 case -991726143: /*period*/ return new String[] {"Period"}; 593 case -369881636: /*assigner*/ return new String[] {"Reference"}; 594 default: return super.getTypesForProperty(hash, name); 595 } 596 597 } 598 599 @Override 600 public Base addChild(String name) throws FHIRException { 601 if (name.equals("use")) { 602 throw new FHIRException("Cannot call addChild on a primitive type Identifier.use"); 603 } 604 else if (name.equals("type")) { 605 this.type = new CodeableConcept(); 606 return this.type; 607 } 608 else if (name.equals("system")) { 609 throw new FHIRException("Cannot call addChild on a primitive type Identifier.system"); 610 } 611 else if (name.equals("value")) { 612 throw new FHIRException("Cannot call addChild on a primitive type Identifier.value"); 613 } 614 else if (name.equals("period")) { 615 this.period = new Period(); 616 return this.period; 617 } 618 else if (name.equals("assigner")) { 619 this.assigner = new Reference(); 620 return this.assigner; 621 } 622 else 623 return super.addChild(name); 624 } 625 626 public String fhirType() { 627 return "Identifier"; 628 629 } 630 631 public Identifier copy() { 632 Identifier dst = new Identifier(); 633 copyValues(dst); 634 return dst; 635 } 636 637 public void copyValues(Identifier dst) { 638 super.copyValues(dst); 639 dst.use = use == null ? null : use.copy(); 640 dst.type = type == null ? null : type.copy(); 641 dst.system = system == null ? null : system.copy(); 642 dst.value = value == null ? null : value.copy(); 643 dst.period = period == null ? null : period.copy(); 644 dst.assigner = assigner == null ? null : assigner.copy(); 645 } 646 647 protected Identifier typedCopy() { 648 return copy(); 649 } 650 651 @Override 652 public boolean equalsDeep(Base other_) { 653 if (!super.equalsDeep(other_)) 654 return false; 655 if (!(other_ instanceof Identifier)) 656 return false; 657 Identifier o = (Identifier) other_; 658 return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(system, o.system, true) 659 && compareDeep(value, o.value, true) && compareDeep(period, o.period, true) && compareDeep(assigner, o.assigner, true) 660 ; 661 } 662 663 @Override 664 public boolean equalsShallow(Base other_) { 665 if (!super.equalsShallow(other_)) 666 return false; 667 if (!(other_ instanceof Identifier)) 668 return false; 669 Identifier o = (Identifier) other_; 670 return compareValues(use, o.use, true) && compareValues(system, o.system, true) && compareValues(value, o.value, true) 671 ; 672 } 673 674 public boolean isEmpty() { 675 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(use, type, system, value 676 , period, assigner); 677 } 678 679 680} 681