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