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