001package org.hl7.fhir.dstu3.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.dstu3 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 Copyright (c) 2011+, HL7, Inc. 025 All rights reserved. 026 027 Redistribution and use in source and binary forms, with or without modification, 028 are permitted provided that the following conditions are met: 029 030 * Redistributions of source code must retain the above copyright notice, this 031 list of conditions and the following disclaimer. 032 * Redistributions in binary form must reproduce the above copyright notice, 033 this list of conditions and the following disclaimer in the documentation 034 and/or other materials provided with the distribution. 035 * Neither the name of HL7 nor the names of its contributors may be used to 036 endorse or promote products derived from this software without specific 037 prior written permission. 038 039 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 040 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 041 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 042 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 043 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 044 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 045 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 046 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 047 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 048 POSSIBILITY OF SUCH DAMAGE. 049 050*/ 051 052// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x 053import java.util.List; 054 055import org.hl7.fhir.exceptions.FHIRException; 056import org.hl7.fhir.instance.model.api.ICompositeType; 057import org.hl7.fhir.utilities.Utilities; 058 059import ca.uhn.fhir.model.api.annotation.Child; 060import ca.uhn.fhir.model.api.annotation.DatatypeDef; 061import ca.uhn.fhir.model.api.annotation.Description; 062/** 063 * Related artifacts such as additional documentation, justification, or bibliographic references. 064 */ 065@DatatypeDef(name="RelatedArtifact") 066public class RelatedArtifact extends Type implements ICompositeType { 067 068 public enum RelatedArtifactType { 069 /** 070 * Additional documentation for the knowledge resource. This would include additional instructions on usage as well as additional information on clinical context or appropriateness 071 */ 072 DOCUMENTATION, 073 /** 074 * A summary of the justification for the knowledge resource including supporting evidence, relevant guidelines, or other clinically important information. This information is intended to provide a way to make the justification for the knowledge resource available to the consumer of interventions or results produced by the knowledge resource 075 */ 076 JUSTIFICATION, 077 /** 078 * Bibliographic citation for papers, references, or other relevant material for the knowledge resource. This is intended to allow for citation of related material, but that was not necessarily specifically prepared in connection with this knowledge resource 079 */ 080 CITATION, 081 /** 082 * The previous version of the knowledge resource 083 */ 084 PREDECESSOR, 085 /** 086 * The next version of the knowledge resource 087 */ 088 SUCCESSOR, 089 /** 090 * The knowledge resource is derived from the related artifact. This is intended to capture the relationship in which a particular knowledge resource is based on the content of another artifact, but is modified to capture either a different set of overall requirements, or a more specific set of requirements such as those involved in a particular institution or clinical setting 091 */ 092 DERIVEDFROM, 093 /** 094 * The knowledge resource depends on the given related artifact 095 */ 096 DEPENDSON, 097 /** 098 * The knowledge resource is composed of the given related artifact 099 */ 100 COMPOSEDOF, 101 /** 102 * added to help the parsers with the generic types 103 */ 104 NULL; 105 public static RelatedArtifactType fromCode(String codeString) throws FHIRException { 106 if (codeString == null || "".equals(codeString)) 107 return null; 108 if ("documentation".equals(codeString)) 109 return DOCUMENTATION; 110 if ("justification".equals(codeString)) 111 return JUSTIFICATION; 112 if ("citation".equals(codeString)) 113 return CITATION; 114 if ("predecessor".equals(codeString)) 115 return PREDECESSOR; 116 if ("successor".equals(codeString)) 117 return SUCCESSOR; 118 if ("derived-from".equals(codeString)) 119 return DERIVEDFROM; 120 if ("depends-on".equals(codeString)) 121 return DEPENDSON; 122 if ("composed-of".equals(codeString)) 123 return COMPOSEDOF; 124 if (Configuration.isAcceptInvalidEnums()) 125 return null; 126 else 127 throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'"); 128 } 129 public String toCode() { 130 switch (this) { 131 case DOCUMENTATION: return "documentation"; 132 case JUSTIFICATION: return "justification"; 133 case CITATION: return "citation"; 134 case PREDECESSOR: return "predecessor"; 135 case SUCCESSOR: return "successor"; 136 case DERIVEDFROM: return "derived-from"; 137 case DEPENDSON: return "depends-on"; 138 case COMPOSEDOF: return "composed-of"; 139 default: return "?"; 140 } 141 } 142 public String getSystem() { 143 switch (this) { 144 case DOCUMENTATION: return "http://hl7.org/fhir/related-artifact-type"; 145 case JUSTIFICATION: return "http://hl7.org/fhir/related-artifact-type"; 146 case CITATION: return "http://hl7.org/fhir/related-artifact-type"; 147 case PREDECESSOR: return "http://hl7.org/fhir/related-artifact-type"; 148 case SUCCESSOR: return "http://hl7.org/fhir/related-artifact-type"; 149 case DERIVEDFROM: return "http://hl7.org/fhir/related-artifact-type"; 150 case DEPENDSON: return "http://hl7.org/fhir/related-artifact-type"; 151 case COMPOSEDOF: return "http://hl7.org/fhir/related-artifact-type"; 152 default: return "?"; 153 } 154 } 155 public String getDefinition() { 156 switch (this) { 157 case DOCUMENTATION: return "Additional documentation for the knowledge resource. This would include additional instructions on usage as well as additional information on clinical context or appropriateness"; 158 case JUSTIFICATION: return "A summary of the justification for the knowledge resource including supporting evidence, relevant guidelines, or other clinically important information. This information is intended to provide a way to make the justification for the knowledge resource available to the consumer of interventions or results produced by the knowledge resource"; 159 case CITATION: return "Bibliographic citation for papers, references, or other relevant material for the knowledge resource. This is intended to allow for citation of related material, but that was not necessarily specifically prepared in connection with this knowledge resource"; 160 case PREDECESSOR: return "The previous version of the knowledge resource"; 161 case SUCCESSOR: return "The next version of the knowledge resource"; 162 case DERIVEDFROM: return "The knowledge resource is derived from the related artifact. This is intended to capture the relationship in which a particular knowledge resource is based on the content of another artifact, but is modified to capture either a different set of overall requirements, or a more specific set of requirements such as those involved in a particular institution or clinical setting"; 163 case DEPENDSON: return "The knowledge resource depends on the given related artifact"; 164 case COMPOSEDOF: return "The knowledge resource is composed of the given related artifact"; 165 default: return "?"; 166 } 167 } 168 public String getDisplay() { 169 switch (this) { 170 case DOCUMENTATION: return "Documentation"; 171 case JUSTIFICATION: return "Justification"; 172 case CITATION: return "Citation"; 173 case PREDECESSOR: return "Predecessor"; 174 case SUCCESSOR: return "Successor"; 175 case DERIVEDFROM: return "Derived From"; 176 case DEPENDSON: return "Depends On"; 177 case COMPOSEDOF: return "Composed Of"; 178 default: return "?"; 179 } 180 } 181 } 182 183 public static class RelatedArtifactTypeEnumFactory implements EnumFactory<RelatedArtifactType> { 184 public RelatedArtifactType fromCode(String codeString) throws IllegalArgumentException { 185 if (codeString == null || "".equals(codeString)) 186 if (codeString == null || "".equals(codeString)) 187 return null; 188 if ("documentation".equals(codeString)) 189 return RelatedArtifactType.DOCUMENTATION; 190 if ("justification".equals(codeString)) 191 return RelatedArtifactType.JUSTIFICATION; 192 if ("citation".equals(codeString)) 193 return RelatedArtifactType.CITATION; 194 if ("predecessor".equals(codeString)) 195 return RelatedArtifactType.PREDECESSOR; 196 if ("successor".equals(codeString)) 197 return RelatedArtifactType.SUCCESSOR; 198 if ("derived-from".equals(codeString)) 199 return RelatedArtifactType.DERIVEDFROM; 200 if ("depends-on".equals(codeString)) 201 return RelatedArtifactType.DEPENDSON; 202 if ("composed-of".equals(codeString)) 203 return RelatedArtifactType.COMPOSEDOF; 204 throw new IllegalArgumentException("Unknown RelatedArtifactType code '"+codeString+"'"); 205 } 206 public Enumeration<RelatedArtifactType> fromType(Base code) throws FHIRException { 207 if (code == null) 208 return null; 209 if (code.isEmpty()) 210 return new Enumeration<RelatedArtifactType>(this); 211 String codeString = ((PrimitiveType) code).asStringValue(); 212 if (codeString == null || "".equals(codeString)) 213 return null; 214 if ("documentation".equals(codeString)) 215 return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DOCUMENTATION); 216 if ("justification".equals(codeString)) 217 return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.JUSTIFICATION); 218 if ("citation".equals(codeString)) 219 return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITATION); 220 if ("predecessor".equals(codeString)) 221 return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.PREDECESSOR); 222 if ("successor".equals(codeString)) 223 return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUCCESSOR); 224 if ("derived-from".equals(codeString)) 225 return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DERIVEDFROM); 226 if ("depends-on".equals(codeString)) 227 return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DEPENDSON); 228 if ("composed-of".equals(codeString)) 229 return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMPOSEDOF); 230 throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'"); 231 } 232 public String toCode(RelatedArtifactType code) { 233 if (code == RelatedArtifactType.DOCUMENTATION) 234 return "documentation"; 235 if (code == RelatedArtifactType.JUSTIFICATION) 236 return "justification"; 237 if (code == RelatedArtifactType.CITATION) 238 return "citation"; 239 if (code == RelatedArtifactType.PREDECESSOR) 240 return "predecessor"; 241 if (code == RelatedArtifactType.SUCCESSOR) 242 return "successor"; 243 if (code == RelatedArtifactType.DERIVEDFROM) 244 return "derived-from"; 245 if (code == RelatedArtifactType.DEPENDSON) 246 return "depends-on"; 247 if (code == RelatedArtifactType.COMPOSEDOF) 248 return "composed-of"; 249 return "?"; 250 } 251 public String toSystem(RelatedArtifactType code) { 252 return code.getSystem(); 253 } 254 } 255 256 /** 257 * The type of relationship to the related artifact. 258 */ 259 @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true) 260 @Description(shortDefinition="documentation | justification | citation | predecessor | successor | derived-from | depends-on | composed-of", formalDefinition="The type of relationship to the related artifact." ) 261 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-artifact-type") 262 protected Enumeration<RelatedArtifactType> type; 263 264 /** 265 * A brief description of the document or knowledge resource being referenced, suitable for display to a consumer. 266 */ 267 @Child(name = "display", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 268 @Description(shortDefinition="Brief description of the related artifact", formalDefinition="A brief description of the document or knowledge resource being referenced, suitable for display to a consumer." ) 269 protected StringType display; 270 271 /** 272 * A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format. 273 */ 274 @Child(name = "citation", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 275 @Description(shortDefinition="Bibliographic citation for the artifact", formalDefinition="A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format." ) 276 protected StringType citation; 277 278 /** 279 * A url for the artifact that can be followed to access the actual content. 280 */ 281 @Child(name = "url", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=true) 282 @Description(shortDefinition="Where the artifact can be accessed", formalDefinition="A url for the artifact that can be followed to access the actual content." ) 283 protected UriType url; 284 285 /** 286 * The document being referenced, represented as an attachment. This is exclusive with the resource element. 287 */ 288 @Child(name = "document", type = {Attachment.class}, order=4, min=0, max=1, modifier=false, summary=true) 289 @Description(shortDefinition="What document is being referenced", formalDefinition="The document being referenced, represented as an attachment. This is exclusive with the resource element." ) 290 protected Attachment document; 291 292 /** 293 * The related resource, such as a library, value set, profile, or other knowledge resource. 294 */ 295 @Child(name = "resource", type = {Reference.class}, order=5, min=0, max=1, modifier=false, summary=true) 296 @Description(shortDefinition="What resource is being referenced", formalDefinition="The related resource, such as a library, value set, profile, or other knowledge resource." ) 297 protected Reference resource; 298 299 /** 300 * The actual object that is the target of the reference (The related resource, such as a library, value set, profile, or other knowledge resource.) 301 */ 302 protected Resource resourceTarget; 303 304 private static final long serialVersionUID = -660871462L; 305 306 /** 307 * Constructor 308 */ 309 public RelatedArtifact() { 310 super(); 311 } 312 313 /** 314 * Constructor 315 */ 316 public RelatedArtifact(Enumeration<RelatedArtifactType> type) { 317 super(); 318 this.type = type; 319 } 320 321 /** 322 * @return {@link #type} (The type of relationship to the related artifact.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 323 */ 324 public Enumeration<RelatedArtifactType> getTypeElement() { 325 if (this.type == null) 326 if (Configuration.errorOnAutoCreate()) 327 throw new Error("Attempt to auto-create RelatedArtifact.type"); 328 else if (Configuration.doAutoCreate()) 329 this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory()); // bb 330 return this.type; 331 } 332 333 public boolean hasTypeElement() { 334 return this.type != null && !this.type.isEmpty(); 335 } 336 337 public boolean hasType() { 338 return this.type != null && !this.type.isEmpty(); 339 } 340 341 /** 342 * @param value {@link #type} (The type of relationship to the related artifact.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 343 */ 344 public RelatedArtifact setTypeElement(Enumeration<RelatedArtifactType> value) { 345 this.type = value; 346 return this; 347 } 348 349 /** 350 * @return The type of relationship to the related artifact. 351 */ 352 public RelatedArtifactType getType() { 353 return this.type == null ? null : this.type.getValue(); 354 } 355 356 /** 357 * @param value The type of relationship to the related artifact. 358 */ 359 public RelatedArtifact setType(RelatedArtifactType value) { 360 if (this.type == null) 361 this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory()); 362 this.type.setValue(value); 363 return this; 364 } 365 366 /** 367 * @return {@link #display} (A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value 368 */ 369 public StringType getDisplayElement() { 370 if (this.display == null) 371 if (Configuration.errorOnAutoCreate()) 372 throw new Error("Attempt to auto-create RelatedArtifact.display"); 373 else if (Configuration.doAutoCreate()) 374 this.display = new StringType(); // bb 375 return this.display; 376 } 377 378 public boolean hasDisplayElement() { 379 return this.display != null && !this.display.isEmpty(); 380 } 381 382 public boolean hasDisplay() { 383 return this.display != null && !this.display.isEmpty(); 384 } 385 386 /** 387 * @param value {@link #display} (A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value 388 */ 389 public RelatedArtifact setDisplayElement(StringType value) { 390 this.display = value; 391 return this; 392 } 393 394 /** 395 * @return A brief description of the document or knowledge resource being referenced, suitable for display to a consumer. 396 */ 397 public String getDisplay() { 398 return this.display == null ? null : this.display.getValue(); 399 } 400 401 /** 402 * @param value A brief description of the document or knowledge resource being referenced, suitable for display to a consumer. 403 */ 404 public RelatedArtifact setDisplay(String value) { 405 if (Utilities.noString(value)) 406 this.display = null; 407 else { 408 if (this.display == null) 409 this.display = new StringType(); 410 this.display.setValue(value); 411 } 412 return this; 413 } 414 415 /** 416 * @return {@link #citation} (A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.). This is the underlying object with id, value and extensions. The accessor "getCitation" gives direct access to the value 417 */ 418 public StringType getCitationElement() { 419 if (this.citation == null) 420 if (Configuration.errorOnAutoCreate()) 421 throw new Error("Attempt to auto-create RelatedArtifact.citation"); 422 else if (Configuration.doAutoCreate()) 423 this.citation = new StringType(); // bb 424 return this.citation; 425 } 426 427 public boolean hasCitationElement() { 428 return this.citation != null && !this.citation.isEmpty(); 429 } 430 431 public boolean hasCitation() { 432 return this.citation != null && !this.citation.isEmpty(); 433 } 434 435 /** 436 * @param value {@link #citation} (A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.). This is the underlying object with id, value and extensions. The accessor "getCitation" gives direct access to the value 437 */ 438 public RelatedArtifact setCitationElement(StringType value) { 439 this.citation = value; 440 return this; 441 } 442 443 /** 444 * @return A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format. 445 */ 446 public String getCitation() { 447 return this.citation == null ? null : this.citation.getValue(); 448 } 449 450 /** 451 * @param value A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format. 452 */ 453 public RelatedArtifact setCitation(String value) { 454 if (Utilities.noString(value)) 455 this.citation = null; 456 else { 457 if (this.citation == null) 458 this.citation = new StringType(); 459 this.citation.setValue(value); 460 } 461 return this; 462 } 463 464 /** 465 * @return {@link #url} (A url for the artifact that can be followed to access the actual content.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value 466 */ 467 public UriType getUrlElement() { 468 if (this.url == null) 469 if (Configuration.errorOnAutoCreate()) 470 throw new Error("Attempt to auto-create RelatedArtifact.url"); 471 else if (Configuration.doAutoCreate()) 472 this.url = new UriType(); // bb 473 return this.url; 474 } 475 476 public boolean hasUrlElement() { 477 return this.url != null && !this.url.isEmpty(); 478 } 479 480 public boolean hasUrl() { 481 return this.url != null && !this.url.isEmpty(); 482 } 483 484 /** 485 * @param value {@link #url} (A url for the artifact that can be followed to access the actual content.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value 486 */ 487 public RelatedArtifact setUrlElement(UriType value) { 488 this.url = value; 489 return this; 490 } 491 492 /** 493 * @return A url for the artifact that can be followed to access the actual content. 494 */ 495 public String getUrl() { 496 return this.url == null ? null : this.url.getValue(); 497 } 498 499 /** 500 * @param value A url for the artifact that can be followed to access the actual content. 501 */ 502 public RelatedArtifact setUrl(String value) { 503 if (Utilities.noString(value)) 504 this.url = null; 505 else { 506 if (this.url == null) 507 this.url = new UriType(); 508 this.url.setValue(value); 509 } 510 return this; 511 } 512 513 /** 514 * @return {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.) 515 */ 516 public Attachment getDocument() { 517 if (this.document == null) 518 if (Configuration.errorOnAutoCreate()) 519 throw new Error("Attempt to auto-create RelatedArtifact.document"); 520 else if (Configuration.doAutoCreate()) 521 this.document = new Attachment(); // cc 522 return this.document; 523 } 524 525 public boolean hasDocument() { 526 return this.document != null && !this.document.isEmpty(); 527 } 528 529 /** 530 * @param value {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.) 531 */ 532 public RelatedArtifact setDocument(Attachment value) { 533 this.document = value; 534 return this; 535 } 536 537 /** 538 * @return {@link #resource} (The related resource, such as a library, value set, profile, or other knowledge resource.) 539 */ 540 public Reference getResource() { 541 if (this.resource == null) 542 if (Configuration.errorOnAutoCreate()) 543 throw new Error("Attempt to auto-create RelatedArtifact.resource"); 544 else if (Configuration.doAutoCreate()) 545 this.resource = new Reference(); // cc 546 return this.resource; 547 } 548 549 public boolean hasResource() { 550 return this.resource != null && !this.resource.isEmpty(); 551 } 552 553 /** 554 * @param value {@link #resource} (The related resource, such as a library, value set, profile, or other knowledge resource.) 555 */ 556 public RelatedArtifact setResource(Reference value) { 557 this.resource = value; 558 return this; 559 } 560 561 /** 562 * @return {@link #resource} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The related resource, such as a library, value set, profile, or other knowledge resource.) 563 */ 564 public Resource getResourceTarget() { 565 return this.resourceTarget; 566 } 567 568 /** 569 * @param value {@link #resource} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The related resource, such as a library, value set, profile, or other knowledge resource.) 570 */ 571 public RelatedArtifact setResourceTarget(Resource value) { 572 this.resourceTarget = value; 573 return this; 574 } 575 576 protected void listChildren(List<Property> children) { 577 super.listChildren(children); 578 children.add(new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type)); 579 children.add(new Property("display", "string", "A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.", 0, 1, display)); 580 children.add(new Property("citation", "string", "A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.", 0, 1, citation)); 581 children.add(new Property("url", "uri", "A url for the artifact that can be followed to access the actual content.", 0, 1, url)); 582 children.add(new Property("document", "Attachment", "The document being referenced, represented as an attachment. This is exclusive with the resource element.", 0, 1, document)); 583 children.add(new Property("resource", "Reference(Any)", "The related resource, such as a library, value set, profile, or other knowledge resource.", 0, 1, resource)); 584 } 585 586 @Override 587 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 588 switch (_hash) { 589 case 3575610: /*type*/ return new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type); 590 case 1671764162: /*display*/ return new Property("display", "string", "A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.", 0, 1, display); 591 case -1442706713: /*citation*/ return new Property("citation", "string", "A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.", 0, 1, citation); 592 case 116079: /*url*/ return new Property("url", "uri", "A url for the artifact that can be followed to access the actual content.", 0, 1, url); 593 case 861720859: /*document*/ return new Property("document", "Attachment", "The document being referenced, represented as an attachment. This is exclusive with the resource element.", 0, 1, document); 594 case -341064690: /*resource*/ return new Property("resource", "Reference(Any)", "The related resource, such as a library, value set, profile, or other knowledge resource.", 0, 1, resource); 595 default: return super.getNamedProperty(_hash, _name, _checkValid); 596 } 597 598 } 599 600 @Override 601 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 602 switch (hash) { 603 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<RelatedArtifactType> 604 case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType 605 case -1442706713: /*citation*/ return this.citation == null ? new Base[0] : new Base[] {this.citation}; // StringType 606 case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType 607 case 861720859: /*document*/ return this.document == null ? new Base[0] : new Base[] {this.document}; // Attachment 608 case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Reference 609 default: return super.getProperty(hash, name, checkValid); 610 } 611 612 } 613 614 @Override 615 public Base setProperty(int hash, String name, Base value) throws FHIRException { 616 switch (hash) { 617 case 3575610: // type 618 value = new RelatedArtifactTypeEnumFactory().fromType(castToCode(value)); 619 this.type = (Enumeration) value; // Enumeration<RelatedArtifactType> 620 return value; 621 case 1671764162: // display 622 this.display = castToString(value); // StringType 623 return value; 624 case -1442706713: // citation 625 this.citation = castToString(value); // StringType 626 return value; 627 case 116079: // url 628 this.url = castToUri(value); // UriType 629 return value; 630 case 861720859: // document 631 this.document = castToAttachment(value); // Attachment 632 return value; 633 case -341064690: // resource 634 this.resource = castToReference(value); // Reference 635 return value; 636 default: return super.setProperty(hash, name, value); 637 } 638 639 } 640 641 @Override 642 public Base setProperty(String name, Base value) throws FHIRException { 643 if (name.equals("type")) { 644 value = new RelatedArtifactTypeEnumFactory().fromType(castToCode(value)); 645 this.type = (Enumeration) value; // Enumeration<RelatedArtifactType> 646 } else if (name.equals("display")) { 647 this.display = castToString(value); // StringType 648 } else if (name.equals("citation")) { 649 this.citation = castToString(value); // StringType 650 } else if (name.equals("url")) { 651 this.url = castToUri(value); // UriType 652 } else if (name.equals("document")) { 653 this.document = castToAttachment(value); // Attachment 654 } else if (name.equals("resource")) { 655 this.resource = castToReference(value); // Reference 656 } else 657 return super.setProperty(name, value); 658 return value; 659 } 660 661 @Override 662 public Base makeProperty(int hash, String name) throws FHIRException { 663 switch (hash) { 664 case 3575610: return getTypeElement(); 665 case 1671764162: return getDisplayElement(); 666 case -1442706713: return getCitationElement(); 667 case 116079: return getUrlElement(); 668 case 861720859: return getDocument(); 669 case -341064690: return getResource(); 670 default: return super.makeProperty(hash, name); 671 } 672 673 } 674 675 @Override 676 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 677 switch (hash) { 678 case 3575610: /*type*/ return new String[] {"code"}; 679 case 1671764162: /*display*/ return new String[] {"string"}; 680 case -1442706713: /*citation*/ return new String[] {"string"}; 681 case 116079: /*url*/ return new String[] {"uri"}; 682 case 861720859: /*document*/ return new String[] {"Attachment"}; 683 case -341064690: /*resource*/ return new String[] {"Reference"}; 684 default: return super.getTypesForProperty(hash, name); 685 } 686 687 } 688 689 @Override 690 public Base addChild(String name) throws FHIRException { 691 if (name.equals("type")) { 692 throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.type"); 693 } 694 else if (name.equals("display")) { 695 throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.display"); 696 } 697 else if (name.equals("citation")) { 698 throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.citation"); 699 } 700 else if (name.equals("url")) { 701 throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.url"); 702 } 703 else if (name.equals("document")) { 704 this.document = new Attachment(); 705 return this.document; 706 } 707 else if (name.equals("resource")) { 708 this.resource = new Reference(); 709 return this.resource; 710 } 711 else 712 return super.addChild(name); 713 } 714 715 public String fhirType() { 716 return "RelatedArtifact"; 717 718 } 719 720 public RelatedArtifact copy() { 721 RelatedArtifact dst = new RelatedArtifact(); 722 copyValues(dst); 723 dst.type = type == null ? null : type.copy(); 724 dst.display = display == null ? null : display.copy(); 725 dst.citation = citation == null ? null : citation.copy(); 726 dst.url = url == null ? null : url.copy(); 727 dst.document = document == null ? null : document.copy(); 728 dst.resource = resource == null ? null : resource.copy(); 729 return dst; 730 } 731 732 protected RelatedArtifact typedCopy() { 733 return copy(); 734 } 735 736 @Override 737 public boolean equalsDeep(Base other_) { 738 if (!super.equalsDeep(other_)) 739 return false; 740 if (!(other_ instanceof RelatedArtifact)) 741 return false; 742 RelatedArtifact o = (RelatedArtifact) other_; 743 return compareDeep(type, o.type, true) && compareDeep(display, o.display, true) && compareDeep(citation, o.citation, true) 744 && compareDeep(url, o.url, true) && compareDeep(document, o.document, true) && compareDeep(resource, o.resource, true) 745 ; 746 } 747 748 @Override 749 public boolean equalsShallow(Base other_) { 750 if (!super.equalsShallow(other_)) 751 return false; 752 if (!(other_ instanceof RelatedArtifact)) 753 return false; 754 RelatedArtifact o = (RelatedArtifact) other_; 755 return compareValues(type, o.type, true) && compareValues(display, o.display, true) && compareValues(citation, o.citation, true) 756 && compareValues(url, o.url, true); 757 } 758 759 public boolean isEmpty() { 760 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, display, citation 761 , url, document, resource); 762 } 763 764 765} 766