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