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