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