001package org.hl7.fhir.dstu3.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// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.ICompositeType;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.DatatypeDef;
043import ca.uhn.fhir.model.api.annotation.Description;
044/**
045 * Related artifacts such as additional documentation, justification, or bibliographic references.
046 */
047@DatatypeDef(name="RelatedArtifact")
048public class RelatedArtifact extends Type implements ICompositeType {
049
050    public enum RelatedArtifactType {
051        /**
052         * Additional documentation for the knowledge resource. This would include additional instructions on usage as well as additional information on clinical context or appropriateness
053         */
054        DOCUMENTATION, 
055        /**
056         * A summary of the justification for the knowledge resource including supporting evidence, relevant guidelines, or other clinically important information. This information is intended to provide a way to make the justification for the knowledge resource available to the consumer of interventions or results produced by the knowledge resource
057         */
058        JUSTIFICATION, 
059        /**
060         * Bibliographic citation for papers, references, or other relevant material for the knowledge resource. This is intended to allow for citation of related material, but that was not necessarily specifically prepared in connection with this knowledge resource
061         */
062        CITATION, 
063        /**
064         * The previous version of the knowledge resource
065         */
066        PREDECESSOR, 
067        /**
068         * The next version of the knowledge resource
069         */
070        SUCCESSOR, 
071        /**
072         * The knowledge resource is derived from the related artifact. This is intended to capture the relationship in which a particular knowledge resource is based on the content of another artifact, but is modified to capture either a different set of overall requirements, or a more specific set of requirements such as those involved in a particular institution or clinical setting
073         */
074        DERIVEDFROM, 
075        /**
076         * The knowledge resource depends on the given related artifact
077         */
078        DEPENDSON, 
079        /**
080         * The knowledge resource is composed of the given related artifact
081         */
082        COMPOSEDOF, 
083        /**
084         * added to help the parsers with the generic types
085         */
086        NULL;
087        public static RelatedArtifactType fromCode(String codeString) throws FHIRException {
088            if (codeString == null || "".equals(codeString))
089                return null;
090        if ("documentation".equals(codeString))
091          return DOCUMENTATION;
092        if ("justification".equals(codeString))
093          return JUSTIFICATION;
094        if ("citation".equals(codeString))
095          return CITATION;
096        if ("predecessor".equals(codeString))
097          return PREDECESSOR;
098        if ("successor".equals(codeString))
099          return SUCCESSOR;
100        if ("derived-from".equals(codeString))
101          return DERIVEDFROM;
102        if ("depends-on".equals(codeString))
103          return DEPENDSON;
104        if ("composed-of".equals(codeString))
105          return COMPOSEDOF;
106        if (Configuration.isAcceptInvalidEnums())
107          return null;
108        else
109          throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'");
110        }
111        public String toCode() {
112          switch (this) {
113            case DOCUMENTATION: return "documentation";
114            case JUSTIFICATION: return "justification";
115            case CITATION: return "citation";
116            case PREDECESSOR: return "predecessor";
117            case SUCCESSOR: return "successor";
118            case DERIVEDFROM: return "derived-from";
119            case DEPENDSON: return "depends-on";
120            case COMPOSEDOF: return "composed-of";
121            case NULL: return null;
122            default: return "?";
123          }
124        }
125        public String getSystem() {
126          switch (this) {
127            case DOCUMENTATION: return "http://hl7.org/fhir/related-artifact-type";
128            case JUSTIFICATION: return "http://hl7.org/fhir/related-artifact-type";
129            case CITATION: return "http://hl7.org/fhir/related-artifact-type";
130            case PREDECESSOR: return "http://hl7.org/fhir/related-artifact-type";
131            case SUCCESSOR: return "http://hl7.org/fhir/related-artifact-type";
132            case DERIVEDFROM: return "http://hl7.org/fhir/related-artifact-type";
133            case DEPENDSON: return "http://hl7.org/fhir/related-artifact-type";
134            case COMPOSEDOF: return "http://hl7.org/fhir/related-artifact-type";
135            case NULL: return null;
136            default: return "?";
137          }
138        }
139        public String getDefinition() {
140          switch (this) {
141            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";
142            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";
143            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";
144            case PREDECESSOR: return "The previous version of the knowledge resource";
145            case SUCCESSOR: return "The next version of the knowledge resource";
146            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";
147            case DEPENDSON: return "The knowledge resource depends on the given related artifact";
148            case COMPOSEDOF: return "The knowledge resource is composed of the given related artifact";
149            case NULL: return null;
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            case NULL: return null;
164            default: return "?";
165          }
166        }
167    }
168
169  public static class RelatedArtifactTypeEnumFactory implements EnumFactory<RelatedArtifactType> {
170    public RelatedArtifactType fromCode(String codeString) throws IllegalArgumentException {
171      if (codeString == null || "".equals(codeString))
172            if (codeString == null || "".equals(codeString))
173                return null;
174        if ("documentation".equals(codeString))
175          return RelatedArtifactType.DOCUMENTATION;
176        if ("justification".equals(codeString))
177          return RelatedArtifactType.JUSTIFICATION;
178        if ("citation".equals(codeString))
179          return RelatedArtifactType.CITATION;
180        if ("predecessor".equals(codeString))
181          return RelatedArtifactType.PREDECESSOR;
182        if ("successor".equals(codeString))
183          return RelatedArtifactType.SUCCESSOR;
184        if ("derived-from".equals(codeString))
185          return RelatedArtifactType.DERIVEDFROM;
186        if ("depends-on".equals(codeString))
187          return RelatedArtifactType.DEPENDSON;
188        if ("composed-of".equals(codeString))
189          return RelatedArtifactType.COMPOSEDOF;
190        throw new IllegalArgumentException("Unknown RelatedArtifactType code '"+codeString+"'");
191        }
192        public Enumeration<RelatedArtifactType> fromType(PrimitiveType<?> code) throws FHIRException {
193          if (code == null)
194            return null;
195          if (code.isEmpty())
196            return new Enumeration<RelatedArtifactType>(this);
197          String codeString = code.asStringValue();
198          if (codeString == null || "".equals(codeString))
199            return null;
200        if ("documentation".equals(codeString))
201          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DOCUMENTATION);
202        if ("justification".equals(codeString))
203          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.JUSTIFICATION);
204        if ("citation".equals(codeString))
205          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITATION);
206        if ("predecessor".equals(codeString))
207          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.PREDECESSOR);
208        if ("successor".equals(codeString))
209          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUCCESSOR);
210        if ("derived-from".equals(codeString))
211          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DERIVEDFROM);
212        if ("depends-on".equals(codeString))
213          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DEPENDSON);
214        if ("composed-of".equals(codeString))
215          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMPOSEDOF);
216        throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'");
217        }
218    public String toCode(RelatedArtifactType code) {
219      if (code == RelatedArtifactType.DOCUMENTATION)
220        return "documentation";
221      if (code == RelatedArtifactType.JUSTIFICATION)
222        return "justification";
223      if (code == RelatedArtifactType.CITATION)
224        return "citation";
225      if (code == RelatedArtifactType.PREDECESSOR)
226        return "predecessor";
227      if (code == RelatedArtifactType.SUCCESSOR)
228        return "successor";
229      if (code == RelatedArtifactType.DERIVEDFROM)
230        return "derived-from";
231      if (code == RelatedArtifactType.DEPENDSON)
232        return "depends-on";
233      if (code == RelatedArtifactType.COMPOSEDOF)
234        return "composed-of";
235      return "?";
236      }
237    public String toSystem(RelatedArtifactType code) {
238      return code.getSystem();
239      }
240    }
241
242    /**
243     * The type of relationship to the related artifact.
244     */
245    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
246    @Description(shortDefinition="documentation | justification | citation | predecessor | successor | derived-from | depends-on | composed-of", formalDefinition="The type of relationship to the related artifact." )
247    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-artifact-type")
248    protected Enumeration<RelatedArtifactType> type;
249
250    /**
251     * A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
252     */
253    @Child(name = "display", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
254    @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." )
255    protected StringType display;
256
257    /**
258     * A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
259     */
260    @Child(name = "citation", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
261    @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." )
262    protected StringType citation;
263
264    /**
265     * A url for the artifact that can be followed to access the actual content.
266     */
267    @Child(name = "url", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=true)
268    @Description(shortDefinition="Where the artifact can be accessed", formalDefinition="A url for the artifact that can be followed to access the actual content." )
269    protected UriType url;
270
271    /**
272     * The document being referenced, represented as an attachment. This is exclusive with the resource element.
273     */
274    @Child(name = "document", type = {Attachment.class}, order=4, min=0, max=1, modifier=false, summary=true)
275    @Description(shortDefinition="What document is being referenced", formalDefinition="The document being referenced, represented as an attachment. This is exclusive with the resource element." )
276    protected Attachment document;
277
278    /**
279     * The related resource, such as a library, value set, profile, or other knowledge resource.
280     */
281    @Child(name = "resource", type = {Reference.class}, order=5, min=0, max=1, modifier=false, summary=true)
282    @Description(shortDefinition="What resource is being referenced", formalDefinition="The related resource, such as a library, value set, profile, or other knowledge resource." )
283    protected Reference resource;
284
285    /**
286     * The actual object that is the target of the reference (The related resource, such as a library, value set, profile, or other knowledge resource.)
287     */
288    protected Resource resourceTarget;
289
290    private static final long serialVersionUID = -660871462L;
291
292  /**
293   * Constructor
294   */
295    public RelatedArtifact() {
296      super();
297    }
298
299  /**
300   * Constructor
301   */
302    public RelatedArtifact(Enumeration<RelatedArtifactType> type) {
303      super();
304      this.type = type;
305    }
306
307    /**
308     * @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
309     */
310    public Enumeration<RelatedArtifactType> getTypeElement() { 
311      if (this.type == null)
312        if (Configuration.errorOnAutoCreate())
313          throw new Error("Attempt to auto-create RelatedArtifact.type");
314        else if (Configuration.doAutoCreate())
315          this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory()); // bb
316      return this.type;
317    }
318
319    public boolean hasTypeElement() { 
320      return this.type != null && !this.type.isEmpty();
321    }
322
323    public boolean hasType() { 
324      return this.type != null && !this.type.isEmpty();
325    }
326
327    /**
328     * @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
329     */
330    public RelatedArtifact setTypeElement(Enumeration<RelatedArtifactType> value) { 
331      this.type = value;
332      return this;
333    }
334
335    /**
336     * @return The type of relationship to the related artifact.
337     */
338    public RelatedArtifactType getType() { 
339      return this.type == null ? null : this.type.getValue();
340    }
341
342    /**
343     * @param value The type of relationship to the related artifact.
344     */
345    public RelatedArtifact setType(RelatedArtifactType value) { 
346        if (this.type == null)
347          this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory());
348        this.type.setValue(value);
349      return this;
350    }
351
352    /**
353     * @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
354     */
355    public StringType getDisplayElement() { 
356      if (this.display == null)
357        if (Configuration.errorOnAutoCreate())
358          throw new Error("Attempt to auto-create RelatedArtifact.display");
359        else if (Configuration.doAutoCreate())
360          this.display = new StringType(); // bb
361      return this.display;
362    }
363
364    public boolean hasDisplayElement() { 
365      return this.display != null && !this.display.isEmpty();
366    }
367
368    public boolean hasDisplay() { 
369      return this.display != null && !this.display.isEmpty();
370    }
371
372    /**
373     * @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
374     */
375    public RelatedArtifact setDisplayElement(StringType value) { 
376      this.display = value;
377      return this;
378    }
379
380    /**
381     * @return A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
382     */
383    public String getDisplay() { 
384      return this.display == null ? null : this.display.getValue();
385    }
386
387    /**
388     * @param value A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
389     */
390    public RelatedArtifact setDisplay(String value) { 
391      if (Utilities.noString(value))
392        this.display = null;
393      else {
394        if (this.display == null)
395          this.display = new StringType();
396        this.display.setValue(value);
397      }
398      return this;
399    }
400
401    /**
402     * @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
403     */
404    public StringType getCitationElement() { 
405      if (this.citation == null)
406        if (Configuration.errorOnAutoCreate())
407          throw new Error("Attempt to auto-create RelatedArtifact.citation");
408        else if (Configuration.doAutoCreate())
409          this.citation = new StringType(); // bb
410      return this.citation;
411    }
412
413    public boolean hasCitationElement() { 
414      return this.citation != null && !this.citation.isEmpty();
415    }
416
417    public boolean hasCitation() { 
418      return this.citation != null && !this.citation.isEmpty();
419    }
420
421    /**
422     * @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
423     */
424    public RelatedArtifact setCitationElement(StringType value) { 
425      this.citation = value;
426      return this;
427    }
428
429    /**
430     * @return A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
431     */
432    public String getCitation() { 
433      return this.citation == null ? null : this.citation.getValue();
434    }
435
436    /**
437     * @param value A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
438     */
439    public RelatedArtifact setCitation(String value) { 
440      if (Utilities.noString(value))
441        this.citation = null;
442      else {
443        if (this.citation == null)
444          this.citation = new StringType();
445        this.citation.setValue(value);
446      }
447      return this;
448    }
449
450    /**
451     * @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
452     */
453    public UriType getUrlElement() { 
454      if (this.url == null)
455        if (Configuration.errorOnAutoCreate())
456          throw new Error("Attempt to auto-create RelatedArtifact.url");
457        else if (Configuration.doAutoCreate())
458          this.url = new UriType(); // bb
459      return this.url;
460    }
461
462    public boolean hasUrlElement() { 
463      return this.url != null && !this.url.isEmpty();
464    }
465
466    public boolean hasUrl() { 
467      return this.url != null && !this.url.isEmpty();
468    }
469
470    /**
471     * @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
472     */
473    public RelatedArtifact setUrlElement(UriType value) { 
474      this.url = value;
475      return this;
476    }
477
478    /**
479     * @return A url for the artifact that can be followed to access the actual content.
480     */
481    public String getUrl() { 
482      return this.url == null ? null : this.url.getValue();
483    }
484
485    /**
486     * @param value A url for the artifact that can be followed to access the actual content.
487     */
488    public RelatedArtifact setUrl(String value) { 
489      if (Utilities.noString(value))
490        this.url = null;
491      else {
492        if (this.url == null)
493          this.url = new UriType();
494        this.url.setValue(value);
495      }
496      return this;
497    }
498
499    /**
500     * @return {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.)
501     */
502    public Attachment getDocument() { 
503      if (this.document == null)
504        if (Configuration.errorOnAutoCreate())
505          throw new Error("Attempt to auto-create RelatedArtifact.document");
506        else if (Configuration.doAutoCreate())
507          this.document = new Attachment(); // cc
508      return this.document;
509    }
510
511    public boolean hasDocument() { 
512      return this.document != null && !this.document.isEmpty();
513    }
514
515    /**
516     * @param value {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.)
517     */
518    public RelatedArtifact setDocument(Attachment value)  { 
519      this.document = value;
520      return this;
521    }
522
523    /**
524     * @return {@link #resource} (The related resource, such as a library, value set, profile, or other knowledge resource.)
525     */
526    public Reference getResource() { 
527      if (this.resource == null)
528        if (Configuration.errorOnAutoCreate())
529          throw new Error("Attempt to auto-create RelatedArtifact.resource");
530        else if (Configuration.doAutoCreate())
531          this.resource = new Reference(); // cc
532      return this.resource;
533    }
534
535    public boolean hasResource() { 
536      return this.resource != null && !this.resource.isEmpty();
537    }
538
539    /**
540     * @param value {@link #resource} (The related resource, such as a library, value set, profile, or other knowledge resource.)
541     */
542    public RelatedArtifact setResource(Reference value)  { 
543      this.resource = value;
544      return this;
545    }
546
547    /**
548     * @return {@link #resource} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The related resource, such as a library, value set, profile, or other knowledge resource.)
549     */
550    public Resource getResourceTarget() { 
551      return this.resourceTarget;
552    }
553
554    /**
555     * @param value {@link #resource} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The related resource, such as a library, value set, profile, or other knowledge resource.)
556     */
557    public RelatedArtifact setResourceTarget(Resource value) { 
558      this.resourceTarget = value;
559      return this;
560    }
561
562      protected void listChildren(List<Property> children) {
563        super.listChildren(children);
564        children.add(new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type));
565        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));
566        children.add(new Property("citation", "string", "A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.", 0, 1, citation));
567        children.add(new Property("url", "uri", "A url for the artifact that can be followed to access the actual content.", 0, 1, url));
568        children.add(new Property("document", "Attachment", "The document being referenced, represented as an attachment. This is exclusive with the resource element.", 0, 1, document));
569        children.add(new Property("resource", "Reference(Any)", "The related resource, such as a library, value set, profile, or other knowledge resource.", 0, 1, resource));
570      }
571
572      @Override
573      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
574        switch (_hash) {
575        case 3575610: /*type*/  return new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type);
576        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);
577        case -1442706713: /*citation*/  return new Property("citation", "string", "A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.", 0, 1, citation);
578        case 116079: /*url*/  return new Property("url", "uri", "A url for the artifact that can be followed to access the actual content.", 0, 1, url);
579        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);
580        case -341064690: /*resource*/  return new Property("resource", "Reference(Any)", "The related resource, such as a library, value set, profile, or other knowledge resource.", 0, 1, resource);
581        default: return super.getNamedProperty(_hash, _name, _checkValid);
582        }
583
584      }
585
586      @Override
587      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
588        switch (hash) {
589        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<RelatedArtifactType>
590        case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType
591        case -1442706713: /*citation*/ return this.citation == null ? new Base[0] : new Base[] {this.citation}; // StringType
592        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
593        case 861720859: /*document*/ return this.document == null ? new Base[0] : new Base[] {this.document}; // Attachment
594        case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Reference
595        default: return super.getProperty(hash, name, checkValid);
596        }
597
598      }
599
600      @Override
601      public Base setProperty(int hash, String name, Base value) throws FHIRException {
602        switch (hash) {
603        case 3575610: // type
604          value = new RelatedArtifactTypeEnumFactory().fromType(castToCode(value));
605          this.type = (Enumeration) value; // Enumeration<RelatedArtifactType>
606          return value;
607        case 1671764162: // display
608          this.display = castToString(value); // StringType
609          return value;
610        case -1442706713: // citation
611          this.citation = castToString(value); // StringType
612          return value;
613        case 116079: // url
614          this.url = castToUri(value); // UriType
615          return value;
616        case 861720859: // document
617          this.document = castToAttachment(value); // Attachment
618          return value;
619        case -341064690: // resource
620          this.resource = castToReference(value); // Reference
621          return value;
622        default: return super.setProperty(hash, name, value);
623        }
624
625      }
626
627      @Override
628      public Base setProperty(String name, Base value) throws FHIRException {
629        if (name.equals("type")) {
630          value = new RelatedArtifactTypeEnumFactory().fromType(castToCode(value));
631          this.type = (Enumeration) value; // Enumeration<RelatedArtifactType>
632        } else if (name.equals("display")) {
633          this.display = castToString(value); // StringType
634        } else if (name.equals("citation")) {
635          this.citation = castToString(value); // StringType
636        } else if (name.equals("url")) {
637          this.url = castToUri(value); // UriType
638        } else if (name.equals("document")) {
639          this.document = castToAttachment(value); // Attachment
640        } else if (name.equals("resource")) {
641          this.resource = castToReference(value); // Reference
642        } else
643          return super.setProperty(name, value);
644        return value;
645      }
646
647      @Override
648      public Base makeProperty(int hash, String name) throws FHIRException {
649        switch (hash) {
650        case 3575610:  return getTypeElement();
651        case 1671764162:  return getDisplayElement();
652        case -1442706713:  return getCitationElement();
653        case 116079:  return getUrlElement();
654        case 861720859:  return getDocument(); 
655        case -341064690:  return getResource(); 
656        default: return super.makeProperty(hash, name);
657        }
658
659      }
660
661      @Override
662      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
663        switch (hash) {
664        case 3575610: /*type*/ return new String[] {"code"};
665        case 1671764162: /*display*/ return new String[] {"string"};
666        case -1442706713: /*citation*/ return new String[] {"string"};
667        case 116079: /*url*/ return new String[] {"uri"};
668        case 861720859: /*document*/ return new String[] {"Attachment"};
669        case -341064690: /*resource*/ return new String[] {"Reference"};
670        default: return super.getTypesForProperty(hash, name);
671        }
672
673      }
674
675      @Override
676      public Base addChild(String name) throws FHIRException {
677        if (name.equals("type")) {
678          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.type");
679        }
680        else if (name.equals("display")) {
681          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.display");
682        }
683        else if (name.equals("citation")) {
684          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.citation");
685        }
686        else if (name.equals("url")) {
687          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.url");
688        }
689        else if (name.equals("document")) {
690          this.document = new Attachment();
691          return this.document;
692        }
693        else if (name.equals("resource")) {
694          this.resource = new Reference();
695          return this.resource;
696        }
697        else
698          return super.addChild(name);
699      }
700
701  public String fhirType() {
702    return "RelatedArtifact";
703
704  }
705
706      public RelatedArtifact copy() {
707        RelatedArtifact dst = new RelatedArtifact();
708        copyValues(dst);
709        dst.type = type == null ? null : type.copy();
710        dst.display = display == null ? null : display.copy();
711        dst.citation = citation == null ? null : citation.copy();
712        dst.url = url == null ? null : url.copy();
713        dst.document = document == null ? null : document.copy();
714        dst.resource = resource == null ? null : resource.copy();
715        return dst;
716      }
717
718      protected RelatedArtifact typedCopy() {
719        return copy();
720      }
721
722      @Override
723      public boolean equalsDeep(Base other_) {
724        if (!super.equalsDeep(other_))
725          return false;
726        if (!(other_ instanceof RelatedArtifact))
727          return false;
728        RelatedArtifact o = (RelatedArtifact) other_;
729        return compareDeep(type, o.type, true) && compareDeep(display, o.display, true) && compareDeep(citation, o.citation, true)
730           && compareDeep(url, o.url, true) && compareDeep(document, o.document, true) && compareDeep(resource, o.resource, true)
731          ;
732      }
733
734      @Override
735      public boolean equalsShallow(Base other_) {
736        if (!super.equalsShallow(other_))
737          return false;
738        if (!(other_ instanceof RelatedArtifact))
739          return false;
740        RelatedArtifact o = (RelatedArtifact) other_;
741        return compareValues(type, o.type, true) && compareValues(display, o.display, true) && compareValues(citation, o.citation, true)
742           && compareValues(url, o.url, true);
743      }
744
745      public boolean isEmpty() {
746        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, display, citation
747          , url, document, resource);
748      }
749
750
751}