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