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