001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047
048/**
049 * Base StructureDefinition for RelatedArtifact Type: Related artifacts such as additional documentation, justification, or bibliographic references.
050 */
051@DatatypeDef(name="RelatedArtifact")
052public class RelatedArtifact extends DataType implements ICompositeType {
053
054    public enum RelatedArtifactType {
055        /**
056         * Additional documentation for the knowledge resource. This would include additional instructions on usage as well as additional information on clinical context or appropriateness.
057         */
058        DOCUMENTATION, 
059        /**
060         * The target artifact is 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.
061         */
062        JUSTIFICATION, 
063        /**
064         * 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.
065         */
066        CITATION, 
067        /**
068         * The previous version of the knowledge resource.
069         */
070        PREDECESSOR, 
071        /**
072         * The next version of the knowledge resource.
073         */
074        SUCCESSOR, 
075        /**
076         * This artifact is derived from the target 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. The artifact may be derived from one or more target artifacts.
077         */
078        DERIVEDFROM, 
079        /**
080         * This artifact depends on the target artifact. There is a requirement to use the target artifact in the creation or interpretation of this artifact.
081         */
082        DEPENDSON, 
083        /**
084         * This artifact is composed of the target artifact. This artifact is constructed with the target artifact as a component. The target artifact is a part of this artifact. (A dataset is composed of data.).
085         */
086        COMPOSEDOF, 
087        /**
088         * This artifact is a part of the target artifact. The target artifact is composed of this artifact (and possibly other artifacts).
089         */
090        PARTOF, 
091        /**
092         * This artifact amends or changes the target artifact. This artifact adds additional information that is functionally expected to replace information in the target artifact. This artifact replaces a part but not all of the target artifact.
093         */
094        AMENDS, 
095        /**
096         * This artifact is amended with or changed by the target artifact. There is information in this artifact that should be functionally replaced with information in the target artifact.
097         */
098        AMENDEDWITH, 
099        /**
100         * This artifact adds additional information to the target artifact. The additional information does not replace or change information in the target artifact.
101         */
102        APPENDS, 
103        /**
104         * This artifact has additional information in the target artifact.
105         */
106        APPENDEDWITH, 
107        /**
108         * This artifact cites the target artifact. This may be a 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.
109         */
110        CITES, 
111        /**
112         * This artifact is cited by the target artifact.
113         */
114        CITEDBY, 
115        /**
116         * This artifact contains comments about the target artifact.
117         */
118        COMMENTSON, 
119        /**
120         * This artifact has comments about it in the target artifact.  The type of comments may be expressed in the targetClassifier element such as reply, review, editorial, feedback, solicited, unsolicited, structured, unstructured.
121         */
122        COMMENTIN, 
123        /**
124         * This artifact is a container in which the target artifact is contained. A container is a data structure whose instances are collections of other objects. (A database contains the dataset.).
125         */
126        CONTAINS, 
127        /**
128         * This artifact is contained in the target artifact. The target artifact is a data structure whose instances are collections of other objects.
129         */
130        CONTAINEDIN, 
131        /**
132         * This artifact identifies errors and replacement content for the target artifact.
133         */
134        CORRECTS, 
135        /**
136         * This artifact has corrections to it in the target artifact. The target artifact identifies errors and replacement content for this artifact.
137         */
138        CORRECTIONIN, 
139        /**
140         * This artifact replaces or supersedes the target artifact. The target artifact may be considered deprecated.
141         */
142        REPLACES, 
143        /**
144         * This artifact is replaced with or superseded by the target artifact. This artifact may be considered deprecated.
145         */
146        REPLACEDWITH, 
147        /**
148         * This artifact retracts the target artifact. The content that was published in the target artifact should be considered removed from publication and should no longer be considered part of the public record.
149         */
150        RETRACTS, 
151        /**
152         * This artifact is retracted by the target artifact. The content that was published in this artifact should be considered removed from publication and should no longer be considered part of the public record.
153         */
154        RETRACTEDBY, 
155        /**
156         * This artifact is a signature of the target artifact.
157         */
158        SIGNS, 
159        /**
160         * This artifact has characteristics in common with the target artifact. This relationship may be used in systems to “deduplicate” knowledge artifacts from different sources, or in systems to show “similar items”.
161         */
162        SIMILARTO, 
163        /**
164         * This artifact provides additional documentation for the target artifact. This could include additional instructions on usage as well as additional information on clinical context or appropriateness.
165         */
166        SUPPORTS, 
167        /**
168         * The target artifact contains additional documentation for the knowledge resource. This could include additional instructions on usage as well as additional information on clinical context or appropriateness.
169         */
170        SUPPORTEDWITH, 
171        /**
172         * This artifact was generated by transforming the target artifact (e.g., format or language conversion). This is intended to capture the relationship in which a particular knowledge resource is based on the content of another artifact, but changes are only apparent in form and there is only one target artifact with the “transforms” relationship type.
173         */
174        TRANSFORMS, 
175        /**
176         * This artifact was transformed into the target artifact (e.g., by format or language conversion).
177         */
178        TRANSFORMEDINTO, 
179        /**
180         * This artifact was generated by transforming a related artifact (e.g., format or language conversion), noted separately with the “transforms” relationship type. This transformation used the target artifact to inform the transformation. The target artifact may be a conversion script or translation guide.
181         */
182        TRANSFORMEDWITH, 
183        /**
184         * added to help the parsers with the generic types
185         */
186        NULL;
187        public static RelatedArtifactType fromCode(String codeString) throws FHIRException {
188            if (codeString == null || "".equals(codeString))
189                return null;
190        if ("documentation".equals(codeString))
191          return DOCUMENTATION;
192        if ("justification".equals(codeString))
193          return JUSTIFICATION;
194        if ("citation".equals(codeString))
195          return CITATION;
196        if ("predecessor".equals(codeString))
197          return PREDECESSOR;
198        if ("successor".equals(codeString))
199          return SUCCESSOR;
200        if ("derived-from".equals(codeString))
201          return DERIVEDFROM;
202        if ("depends-on".equals(codeString))
203          return DEPENDSON;
204        if ("composed-of".equals(codeString))
205          return COMPOSEDOF;
206        if ("part-of".equals(codeString))
207          return PARTOF;
208        if ("amends".equals(codeString))
209          return AMENDS;
210        if ("amended-with".equals(codeString))
211          return AMENDEDWITH;
212        if ("appends".equals(codeString))
213          return APPENDS;
214        if ("appended-with".equals(codeString))
215          return APPENDEDWITH;
216        if ("cites".equals(codeString))
217          return CITES;
218        if ("cited-by".equals(codeString))
219          return CITEDBY;
220        if ("comments-on".equals(codeString))
221          return COMMENTSON;
222        if ("comment-in".equals(codeString))
223          return COMMENTIN;
224        if ("contains".equals(codeString))
225          return CONTAINS;
226        if ("contained-in".equals(codeString))
227          return CONTAINEDIN;
228        if ("corrects".equals(codeString))
229          return CORRECTS;
230        if ("correction-in".equals(codeString))
231          return CORRECTIONIN;
232        if ("replaces".equals(codeString))
233          return REPLACES;
234        if ("replaced-with".equals(codeString))
235          return REPLACEDWITH;
236        if ("retracts".equals(codeString))
237          return RETRACTS;
238        if ("retracted-by".equals(codeString))
239          return RETRACTEDBY;
240        if ("signs".equals(codeString))
241          return SIGNS;
242        if ("similar-to".equals(codeString))
243          return SIMILARTO;
244        if ("supports".equals(codeString))
245          return SUPPORTS;
246        if ("supported-with".equals(codeString))
247          return SUPPORTEDWITH;
248        if ("transforms".equals(codeString))
249          return TRANSFORMS;
250        if ("transformed-into".equals(codeString))
251          return TRANSFORMEDINTO;
252        if ("transformed-with".equals(codeString))
253          return TRANSFORMEDWITH;
254        if (Configuration.isAcceptInvalidEnums())
255          return null;
256        else
257          throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'");
258        }
259        public String toCode() {
260          switch (this) {
261            case DOCUMENTATION: return "documentation";
262            case JUSTIFICATION: return "justification";
263            case CITATION: return "citation";
264            case PREDECESSOR: return "predecessor";
265            case SUCCESSOR: return "successor";
266            case DERIVEDFROM: return "derived-from";
267            case DEPENDSON: return "depends-on";
268            case COMPOSEDOF: return "composed-of";
269            case PARTOF: return "part-of";
270            case AMENDS: return "amends";
271            case AMENDEDWITH: return "amended-with";
272            case APPENDS: return "appends";
273            case APPENDEDWITH: return "appended-with";
274            case CITES: return "cites";
275            case CITEDBY: return "cited-by";
276            case COMMENTSON: return "comments-on";
277            case COMMENTIN: return "comment-in";
278            case CONTAINS: return "contains";
279            case CONTAINEDIN: return "contained-in";
280            case CORRECTS: return "corrects";
281            case CORRECTIONIN: return "correction-in";
282            case REPLACES: return "replaces";
283            case REPLACEDWITH: return "replaced-with";
284            case RETRACTS: return "retracts";
285            case RETRACTEDBY: return "retracted-by";
286            case SIGNS: return "signs";
287            case SIMILARTO: return "similar-to";
288            case SUPPORTS: return "supports";
289            case SUPPORTEDWITH: return "supported-with";
290            case TRANSFORMS: return "transforms";
291            case TRANSFORMEDINTO: return "transformed-into";
292            case TRANSFORMEDWITH: return "transformed-with";
293            default: return "?";
294          }
295        }
296        public String getSystem() {
297          switch (this) {
298            case DOCUMENTATION: return "http://hl7.org/fhir/related-artifact-type";
299            case JUSTIFICATION: return "http://hl7.org/fhir/related-artifact-type";
300            case CITATION: return "http://hl7.org/fhir/related-artifact-type";
301            case PREDECESSOR: return "http://hl7.org/fhir/related-artifact-type";
302            case SUCCESSOR: return "http://hl7.org/fhir/related-artifact-type";
303            case DERIVEDFROM: return "http://hl7.org/fhir/related-artifact-type";
304            case DEPENDSON: return "http://hl7.org/fhir/related-artifact-type";
305            case COMPOSEDOF: return "http://hl7.org/fhir/related-artifact-type";
306            case PARTOF: return "http://hl7.org/fhir/related-artifact-type";
307            case AMENDS: return "http://hl7.org/fhir/related-artifact-type";
308            case AMENDEDWITH: return "http://hl7.org/fhir/related-artifact-type";
309            case APPENDS: return "http://hl7.org/fhir/related-artifact-type";
310            case APPENDEDWITH: return "http://hl7.org/fhir/related-artifact-type";
311            case CITES: return "http://hl7.org/fhir/related-artifact-type";
312            case CITEDBY: return "http://hl7.org/fhir/related-artifact-type";
313            case COMMENTSON: return "http://hl7.org/fhir/related-artifact-type";
314            case COMMENTIN: return "http://hl7.org/fhir/related-artifact-type";
315            case CONTAINS: return "http://hl7.org/fhir/related-artifact-type";
316            case CONTAINEDIN: return "http://hl7.org/fhir/related-artifact-type";
317            case CORRECTS: return "http://hl7.org/fhir/related-artifact-type";
318            case CORRECTIONIN: return "http://hl7.org/fhir/related-artifact-type";
319            case REPLACES: return "http://hl7.org/fhir/related-artifact-type";
320            case REPLACEDWITH: return "http://hl7.org/fhir/related-artifact-type";
321            case RETRACTS: return "http://hl7.org/fhir/related-artifact-type";
322            case RETRACTEDBY: return "http://hl7.org/fhir/related-artifact-type";
323            case SIGNS: return "http://hl7.org/fhir/related-artifact-type";
324            case SIMILARTO: return "http://hl7.org/fhir/related-artifact-type";
325            case SUPPORTS: return "http://hl7.org/fhir/related-artifact-type";
326            case SUPPORTEDWITH: return "http://hl7.org/fhir/related-artifact-type";
327            case TRANSFORMS: return "http://hl7.org/fhir/related-artifact-type";
328            case TRANSFORMEDINTO: return "http://hl7.org/fhir/related-artifact-type";
329            case TRANSFORMEDWITH: return "http://hl7.org/fhir/related-artifact-type";
330            default: return "?";
331          }
332        }
333        public String getDefinition() {
334          switch (this) {
335            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.";
336            case JUSTIFICATION: return "The target artifact is 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.";
337            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.";
338            case PREDECESSOR: return "The previous version of the knowledge resource.";
339            case SUCCESSOR: return "The next version of the knowledge resource.";
340            case DERIVEDFROM: return "This artifact is derived from the target 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. The artifact may be derived from one or more target artifacts.";
341            case DEPENDSON: return "This artifact depends on the target artifact. There is a requirement to use the target artifact in the creation or interpretation of this artifact.";
342            case COMPOSEDOF: return "This artifact is composed of the target artifact. This artifact is constructed with the target artifact as a component. The target artifact is a part of this artifact. (A dataset is composed of data.).";
343            case PARTOF: return "This artifact is a part of the target artifact. The target artifact is composed of this artifact (and possibly other artifacts).";
344            case AMENDS: return "This artifact amends or changes the target artifact. This artifact adds additional information that is functionally expected to replace information in the target artifact. This artifact replaces a part but not all of the target artifact.";
345            case AMENDEDWITH: return "This artifact is amended with or changed by the target artifact. There is information in this artifact that should be functionally replaced with information in the target artifact.";
346            case APPENDS: return "This artifact adds additional information to the target artifact. The additional information does not replace or change information in the target artifact.";
347            case APPENDEDWITH: return "This artifact has additional information in the target artifact.";
348            case CITES: return "This artifact cites the target artifact. This may be a 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.";
349            case CITEDBY: return "This artifact is cited by the target artifact.";
350            case COMMENTSON: return "This artifact contains comments about the target artifact.";
351            case COMMENTIN: return "This artifact has comments about it in the target artifact.  The type of comments may be expressed in the targetClassifier element such as reply, review, editorial, feedback, solicited, unsolicited, structured, unstructured.";
352            case CONTAINS: return "This artifact is a container in which the target artifact is contained. A container is a data structure whose instances are collections of other objects. (A database contains the dataset.).";
353            case CONTAINEDIN: return "This artifact is contained in the target artifact. The target artifact is a data structure whose instances are collections of other objects.";
354            case CORRECTS: return "This artifact identifies errors and replacement content for the target artifact.";
355            case CORRECTIONIN: return "This artifact has corrections to it in the target artifact. The target artifact identifies errors and replacement content for this artifact.";
356            case REPLACES: return "This artifact replaces or supersedes the target artifact. The target artifact may be considered deprecated.";
357            case REPLACEDWITH: return "This artifact is replaced with or superseded by the target artifact. This artifact may be considered deprecated.";
358            case RETRACTS: return "This artifact retracts the target artifact. The content that was published in the target artifact should be considered removed from publication and should no longer be considered part of the public record.";
359            case RETRACTEDBY: return "This artifact is retracted by the target artifact. The content that was published in this artifact should be considered removed from publication and should no longer be considered part of the public record.";
360            case SIGNS: return "This artifact is a signature of the target artifact.";
361            case SIMILARTO: return "This artifact has characteristics in common with the target artifact. This relationship may be used in systems to “deduplicate” knowledge artifacts from different sources, or in systems to show “similar items”.";
362            case SUPPORTS: return "This artifact provides additional documentation for the target artifact. This could include additional instructions on usage as well as additional information on clinical context or appropriateness.";
363            case SUPPORTEDWITH: return "The target artifact contains additional documentation for the knowledge resource. This could include additional instructions on usage as well as additional information on clinical context or appropriateness.";
364            case TRANSFORMS: return "This artifact was generated by transforming the target artifact (e.g., format or language conversion). This is intended to capture the relationship in which a particular knowledge resource is based on the content of another artifact, but changes are only apparent in form and there is only one target artifact with the “transforms” relationship type.";
365            case TRANSFORMEDINTO: return "This artifact was transformed into the target artifact (e.g., by format or language conversion).";
366            case TRANSFORMEDWITH: return "This artifact was generated by transforming a related artifact (e.g., format or language conversion), noted separately with the “transforms” relationship type. This transformation used the target artifact to inform the transformation. The target artifact may be a conversion script or translation guide.";
367            default: return "?";
368          }
369        }
370        public String getDisplay() {
371          switch (this) {
372            case DOCUMENTATION: return "Documentation";
373            case JUSTIFICATION: return "Justification";
374            case CITATION: return "Citation";
375            case PREDECESSOR: return "Predecessor";
376            case SUCCESSOR: return "Successor";
377            case DERIVEDFROM: return "Derived From";
378            case DEPENDSON: return "Depends On";
379            case COMPOSEDOF: return "Composed Of";
380            case PARTOF: return "Part Of";
381            case AMENDS: return "Amends";
382            case AMENDEDWITH: return "Amended With";
383            case APPENDS: return "Appends";
384            case APPENDEDWITH: return "Appended With";
385            case CITES: return "Cites";
386            case CITEDBY: return "Cited By";
387            case COMMENTSON: return "Is Comment On";
388            case COMMENTIN: return "Has Comment In";
389            case CONTAINS: return "Contains";
390            case CONTAINEDIN: return "Contained In";
391            case CORRECTS: return "Corrects";
392            case CORRECTIONIN: return "Correction In";
393            case REPLACES: return "Replaces";
394            case REPLACEDWITH: return "Replaced With";
395            case RETRACTS: return "Retracts";
396            case RETRACTEDBY: return "Retracted By";
397            case SIGNS: return "Signs";
398            case SIMILARTO: return "Similar To";
399            case SUPPORTS: return "Supports";
400            case SUPPORTEDWITH: return "Supported With";
401            case TRANSFORMS: return "Transforms";
402            case TRANSFORMEDINTO: return "Transformed Into";
403            case TRANSFORMEDWITH: return "Transformed With";
404            default: return "?";
405          }
406        }
407    }
408
409  public static class RelatedArtifactTypeEnumFactory implements EnumFactory<RelatedArtifactType> {
410    public RelatedArtifactType fromCode(String codeString) throws IllegalArgumentException {
411      if (codeString == null || "".equals(codeString))
412            if (codeString == null || "".equals(codeString))
413                return null;
414        if ("documentation".equals(codeString))
415          return RelatedArtifactType.DOCUMENTATION;
416        if ("justification".equals(codeString))
417          return RelatedArtifactType.JUSTIFICATION;
418        if ("citation".equals(codeString))
419          return RelatedArtifactType.CITATION;
420        if ("predecessor".equals(codeString))
421          return RelatedArtifactType.PREDECESSOR;
422        if ("successor".equals(codeString))
423          return RelatedArtifactType.SUCCESSOR;
424        if ("derived-from".equals(codeString))
425          return RelatedArtifactType.DERIVEDFROM;
426        if ("depends-on".equals(codeString))
427          return RelatedArtifactType.DEPENDSON;
428        if ("composed-of".equals(codeString))
429          return RelatedArtifactType.COMPOSEDOF;
430        if ("part-of".equals(codeString))
431          return RelatedArtifactType.PARTOF;
432        if ("amends".equals(codeString))
433          return RelatedArtifactType.AMENDS;
434        if ("amended-with".equals(codeString))
435          return RelatedArtifactType.AMENDEDWITH;
436        if ("appends".equals(codeString))
437          return RelatedArtifactType.APPENDS;
438        if ("appended-with".equals(codeString))
439          return RelatedArtifactType.APPENDEDWITH;
440        if ("cites".equals(codeString))
441          return RelatedArtifactType.CITES;
442        if ("cited-by".equals(codeString))
443          return RelatedArtifactType.CITEDBY;
444        if ("comments-on".equals(codeString))
445          return RelatedArtifactType.COMMENTSON;
446        if ("comment-in".equals(codeString))
447          return RelatedArtifactType.COMMENTIN;
448        if ("contains".equals(codeString))
449          return RelatedArtifactType.CONTAINS;
450        if ("contained-in".equals(codeString))
451          return RelatedArtifactType.CONTAINEDIN;
452        if ("corrects".equals(codeString))
453          return RelatedArtifactType.CORRECTS;
454        if ("correction-in".equals(codeString))
455          return RelatedArtifactType.CORRECTIONIN;
456        if ("replaces".equals(codeString))
457          return RelatedArtifactType.REPLACES;
458        if ("replaced-with".equals(codeString))
459          return RelatedArtifactType.REPLACEDWITH;
460        if ("retracts".equals(codeString))
461          return RelatedArtifactType.RETRACTS;
462        if ("retracted-by".equals(codeString))
463          return RelatedArtifactType.RETRACTEDBY;
464        if ("signs".equals(codeString))
465          return RelatedArtifactType.SIGNS;
466        if ("similar-to".equals(codeString))
467          return RelatedArtifactType.SIMILARTO;
468        if ("supports".equals(codeString))
469          return RelatedArtifactType.SUPPORTS;
470        if ("supported-with".equals(codeString))
471          return RelatedArtifactType.SUPPORTEDWITH;
472        if ("transforms".equals(codeString))
473          return RelatedArtifactType.TRANSFORMS;
474        if ("transformed-into".equals(codeString))
475          return RelatedArtifactType.TRANSFORMEDINTO;
476        if ("transformed-with".equals(codeString))
477          return RelatedArtifactType.TRANSFORMEDWITH;
478        throw new IllegalArgumentException("Unknown RelatedArtifactType code '"+codeString+"'");
479        }
480        public Enumeration<RelatedArtifactType> fromType(Base code) throws FHIRException {
481          if (code == null)
482            return null;
483          if (code.isEmpty())
484            return new Enumeration<RelatedArtifactType>(this);
485          String codeString = ((PrimitiveType) code).asStringValue();
486          if (codeString == null || "".equals(codeString))
487            return null;
488        if ("documentation".equals(codeString))
489          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DOCUMENTATION);
490        if ("justification".equals(codeString))
491          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.JUSTIFICATION);
492        if ("citation".equals(codeString))
493          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITATION);
494        if ("predecessor".equals(codeString))
495          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.PREDECESSOR);
496        if ("successor".equals(codeString))
497          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUCCESSOR);
498        if ("derived-from".equals(codeString))
499          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DERIVEDFROM);
500        if ("depends-on".equals(codeString))
501          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DEPENDSON);
502        if ("composed-of".equals(codeString))
503          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMPOSEDOF);
504        if ("part-of".equals(codeString))
505          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.PARTOF);
506        if ("amends".equals(codeString))
507          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.AMENDS);
508        if ("amended-with".equals(codeString))
509          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.AMENDEDWITH);
510        if ("appends".equals(codeString))
511          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.APPENDS);
512        if ("appended-with".equals(codeString))
513          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.APPENDEDWITH);
514        if ("cites".equals(codeString))
515          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITES);
516        if ("cited-by".equals(codeString))
517          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITEDBY);
518        if ("comments-on".equals(codeString))
519          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMMENTSON);
520        if ("comment-in".equals(codeString))
521          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMMENTIN);
522        if ("contains".equals(codeString))
523          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CONTAINS);
524        if ("contained-in".equals(codeString))
525          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CONTAINEDIN);
526        if ("corrects".equals(codeString))
527          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CORRECTS);
528        if ("correction-in".equals(codeString))
529          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CORRECTIONIN);
530        if ("replaces".equals(codeString))
531          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.REPLACES);
532        if ("replaced-with".equals(codeString))
533          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.REPLACEDWITH);
534        if ("retracts".equals(codeString))
535          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.RETRACTS);
536        if ("retracted-by".equals(codeString))
537          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.RETRACTEDBY);
538        if ("signs".equals(codeString))
539          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SIGNS);
540        if ("similar-to".equals(codeString))
541          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SIMILARTO);
542        if ("supports".equals(codeString))
543          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUPPORTS);
544        if ("supported-with".equals(codeString))
545          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUPPORTEDWITH);
546        if ("transforms".equals(codeString))
547          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.TRANSFORMS);
548        if ("transformed-into".equals(codeString))
549          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.TRANSFORMEDINTO);
550        if ("transformed-with".equals(codeString))
551          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.TRANSFORMEDWITH);
552        throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'");
553        }
554    public String toCode(RelatedArtifactType code) {
555      if (code == RelatedArtifactType.DOCUMENTATION)
556        return "documentation";
557      if (code == RelatedArtifactType.JUSTIFICATION)
558        return "justification";
559      if (code == RelatedArtifactType.CITATION)
560        return "citation";
561      if (code == RelatedArtifactType.PREDECESSOR)
562        return "predecessor";
563      if (code == RelatedArtifactType.SUCCESSOR)
564        return "successor";
565      if (code == RelatedArtifactType.DERIVEDFROM)
566        return "derived-from";
567      if (code == RelatedArtifactType.DEPENDSON)
568        return "depends-on";
569      if (code == RelatedArtifactType.COMPOSEDOF)
570        return "composed-of";
571      if (code == RelatedArtifactType.PARTOF)
572        return "part-of";
573      if (code == RelatedArtifactType.AMENDS)
574        return "amends";
575      if (code == RelatedArtifactType.AMENDEDWITH)
576        return "amended-with";
577      if (code == RelatedArtifactType.APPENDS)
578        return "appends";
579      if (code == RelatedArtifactType.APPENDEDWITH)
580        return "appended-with";
581      if (code == RelatedArtifactType.CITES)
582        return "cites";
583      if (code == RelatedArtifactType.CITEDBY)
584        return "cited-by";
585      if (code == RelatedArtifactType.COMMENTSON)
586        return "comments-on";
587      if (code == RelatedArtifactType.COMMENTIN)
588        return "comment-in";
589      if (code == RelatedArtifactType.CONTAINS)
590        return "contains";
591      if (code == RelatedArtifactType.CONTAINEDIN)
592        return "contained-in";
593      if (code == RelatedArtifactType.CORRECTS)
594        return "corrects";
595      if (code == RelatedArtifactType.CORRECTIONIN)
596        return "correction-in";
597      if (code == RelatedArtifactType.REPLACES)
598        return "replaces";
599      if (code == RelatedArtifactType.REPLACEDWITH)
600        return "replaced-with";
601      if (code == RelatedArtifactType.RETRACTS)
602        return "retracts";
603      if (code == RelatedArtifactType.RETRACTEDBY)
604        return "retracted-by";
605      if (code == RelatedArtifactType.SIGNS)
606        return "signs";
607      if (code == RelatedArtifactType.SIMILARTO)
608        return "similar-to";
609      if (code == RelatedArtifactType.SUPPORTS)
610        return "supports";
611      if (code == RelatedArtifactType.SUPPORTEDWITH)
612        return "supported-with";
613      if (code == RelatedArtifactType.TRANSFORMS)
614        return "transforms";
615      if (code == RelatedArtifactType.TRANSFORMEDINTO)
616        return "transformed-into";
617      if (code == RelatedArtifactType.TRANSFORMEDWITH)
618        return "transformed-with";
619      return "?";
620      }
621    public String toSystem(RelatedArtifactType code) {
622      return code.getSystem();
623      }
624    }
625
626    /**
627     * The type of relationship to the related artifact.
628     */
629    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
630    @Description(shortDefinition="documentation | justification | citation | predecessor | successor | derived-from | depends-on | composed-of | part-of | amends | amended-with | appends | appended-with | cites | cited-by | comments-on | comment-in | contains | contained-in | corrects | correction-in | replaces | replaced-with | retracts | retracted-by | signs | similar-to | supports | supported-with | transforms | transformed-into | transformed-with", formalDefinition="The type of relationship to the related artifact." )
631    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-artifact-type")
632    protected Enumeration<RelatedArtifactType> type;
633
634    /**
635     * Provides additional classifiers of the related artifact.
636     */
637    @Child(name = "classifier", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
638    @Description(shortDefinition="Additional classifiers", formalDefinition="Provides additional classifiers of the related artifact." )
639    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/citation-artifact-classifier")
640    protected List<CodeableConcept> classifier;
641
642    /**
643     * A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
644     */
645    @Child(name = "label", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
646    @Description(shortDefinition="Short label", formalDefinition="A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index." )
647    protected StringType label;
648
649    /**
650     * A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
651     */
652    @Child(name = "display", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
653    @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." )
654    protected StringType display;
655
656    /**
657     * A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
658     */
659    @Child(name = "citation", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=true)
660    @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." )
661    protected MarkdownType citation;
662
663    /**
664     * The document being referenced, represented as an attachment. This is exclusive with the resource element.
665     */
666    @Child(name = "document", type = {Attachment.class}, order=5, min=0, max=1, modifier=false, summary=true)
667    @Description(shortDefinition="What document is being referenced", formalDefinition="The document being referenced, represented as an attachment. This is exclusive with the resource element." )
668    protected Attachment document;
669
670    /**
671     * The related artifact, such as a library, value set, profile, or other knowledge resource.
672     */
673    @Child(name = "resource", type = {CanonicalType.class}, order=6, min=0, max=1, modifier=false, summary=true)
674    @Description(shortDefinition="What artifact is being referenced", formalDefinition="The related artifact, such as a library, value set, profile, or other knowledge resource." )
675    protected CanonicalType resource;
676
677    /**
678     * The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.
679     */
680    @Child(name = "resourceReference", type = {Reference.class}, order=7, min=0, max=1, modifier=false, summary=true)
681    @Description(shortDefinition="What artifact, if not a conformance resource", formalDefinition="The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource." )
682    protected Reference resourceReference;
683
684    private static final long serialVersionUID = 810506564L;
685
686  /**
687   * Constructor
688   */
689    public RelatedArtifact() {
690      super();
691    }
692
693  /**
694   * Constructor
695   */
696    public RelatedArtifact(RelatedArtifactType type) {
697      super();
698      this.setType(type);
699    }
700
701    /**
702     * @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
703     */
704    public Enumeration<RelatedArtifactType> getTypeElement() { 
705      if (this.type == null)
706        if (Configuration.errorOnAutoCreate())
707          throw new Error("Attempt to auto-create RelatedArtifact.type");
708        else if (Configuration.doAutoCreate())
709          this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory()); // bb
710      return this.type;
711    }
712
713    public boolean hasTypeElement() { 
714      return this.type != null && !this.type.isEmpty();
715    }
716
717    public boolean hasType() { 
718      return this.type != null && !this.type.isEmpty();
719    }
720
721    /**
722     * @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
723     */
724    public RelatedArtifact setTypeElement(Enumeration<RelatedArtifactType> value) { 
725      this.type = value;
726      return this;
727    }
728
729    /**
730     * @return The type of relationship to the related artifact.
731     */
732    public RelatedArtifactType getType() { 
733      return this.type == null ? null : this.type.getValue();
734    }
735
736    /**
737     * @param value The type of relationship to the related artifact.
738     */
739    public RelatedArtifact setType(RelatedArtifactType value) { 
740        if (this.type == null)
741          this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory());
742        this.type.setValue(value);
743      return this;
744    }
745
746    /**
747     * @return {@link #classifier} (Provides additional classifiers of the related artifact.)
748     */
749    public List<CodeableConcept> getClassifier() { 
750      if (this.classifier == null)
751        this.classifier = new ArrayList<CodeableConcept>();
752      return this.classifier;
753    }
754
755    /**
756     * @return Returns a reference to <code>this</code> for easy method chaining
757     */
758    public RelatedArtifact setClassifier(List<CodeableConcept> theClassifier) { 
759      this.classifier = theClassifier;
760      return this;
761    }
762
763    public boolean hasClassifier() { 
764      if (this.classifier == null)
765        return false;
766      for (CodeableConcept item : this.classifier)
767        if (!item.isEmpty())
768          return true;
769      return false;
770    }
771
772    public CodeableConcept addClassifier() { //3
773      CodeableConcept t = new CodeableConcept();
774      if (this.classifier == null)
775        this.classifier = new ArrayList<CodeableConcept>();
776      this.classifier.add(t);
777      return t;
778    }
779
780    public RelatedArtifact addClassifier(CodeableConcept t) { //3
781      if (t == null)
782        return this;
783      if (this.classifier == null)
784        this.classifier = new ArrayList<CodeableConcept>();
785      this.classifier.add(t);
786      return this;
787    }
788
789    /**
790     * @return The first repetition of repeating field {@link #classifier}, creating it if it does not already exist {3}
791     */
792    public CodeableConcept getClassifierFirstRep() { 
793      if (getClassifier().isEmpty()) {
794        addClassifier();
795      }
796      return getClassifier().get(0);
797    }
798
799    /**
800     * @return {@link #label} (A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
801     */
802    public StringType getLabelElement() { 
803      if (this.label == null)
804        if (Configuration.errorOnAutoCreate())
805          throw new Error("Attempt to auto-create RelatedArtifact.label");
806        else if (Configuration.doAutoCreate())
807          this.label = new StringType(); // bb
808      return this.label;
809    }
810
811    public boolean hasLabelElement() { 
812      return this.label != null && !this.label.isEmpty();
813    }
814
815    public boolean hasLabel() { 
816      return this.label != null && !this.label.isEmpty();
817    }
818
819    /**
820     * @param value {@link #label} (A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
821     */
822    public RelatedArtifact setLabelElement(StringType value) { 
823      this.label = value;
824      return this;
825    }
826
827    /**
828     * @return A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
829     */
830    public String getLabel() { 
831      return this.label == null ? null : this.label.getValue();
832    }
833
834    /**
835     * @param value A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
836     */
837    public RelatedArtifact setLabel(String value) { 
838      if (Utilities.noString(value))
839        this.label = null;
840      else {
841        if (this.label == null)
842          this.label = new StringType();
843        this.label.setValue(value);
844      }
845      return this;
846    }
847
848    /**
849     * @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
850     */
851    public StringType getDisplayElement() { 
852      if (this.display == null)
853        if (Configuration.errorOnAutoCreate())
854          throw new Error("Attempt to auto-create RelatedArtifact.display");
855        else if (Configuration.doAutoCreate())
856          this.display = new StringType(); // bb
857      return this.display;
858    }
859
860    public boolean hasDisplayElement() { 
861      return this.display != null && !this.display.isEmpty();
862    }
863
864    public boolean hasDisplay() { 
865      return this.display != null && !this.display.isEmpty();
866    }
867
868    /**
869     * @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
870     */
871    public RelatedArtifact setDisplayElement(StringType value) { 
872      this.display = value;
873      return this;
874    }
875
876    /**
877     * @return A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
878     */
879    public String getDisplay() { 
880      return this.display == null ? null : this.display.getValue();
881    }
882
883    /**
884     * @param value A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
885     */
886    public RelatedArtifact setDisplay(String value) { 
887      if (Utilities.noString(value))
888        this.display = null;
889      else {
890        if (this.display == null)
891          this.display = new StringType();
892        this.display.setValue(value);
893      }
894      return this;
895    }
896
897    /**
898     * @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
899     */
900    public MarkdownType getCitationElement() { 
901      if (this.citation == null)
902        if (Configuration.errorOnAutoCreate())
903          throw new Error("Attempt to auto-create RelatedArtifact.citation");
904        else if (Configuration.doAutoCreate())
905          this.citation = new MarkdownType(); // bb
906      return this.citation;
907    }
908
909    public boolean hasCitationElement() { 
910      return this.citation != null && !this.citation.isEmpty();
911    }
912
913    public boolean hasCitation() { 
914      return this.citation != null && !this.citation.isEmpty();
915    }
916
917    /**
918     * @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
919     */
920    public RelatedArtifact setCitationElement(MarkdownType value) { 
921      this.citation = value;
922      return this;
923    }
924
925    /**
926     * @return A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
927     */
928    public String getCitation() { 
929      return this.citation == null ? null : this.citation.getValue();
930    }
931
932    /**
933     * @param value A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
934     */
935    public RelatedArtifact setCitation(String value) { 
936      if (value == null)
937        this.citation = null;
938      else {
939        if (this.citation == null)
940          this.citation = new MarkdownType();
941        this.citation.setValue(value);
942      }
943      return this;
944    }
945
946    /**
947     * @return {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.)
948     */
949    public Attachment getDocument() { 
950      if (this.document == null)
951        if (Configuration.errorOnAutoCreate())
952          throw new Error("Attempt to auto-create RelatedArtifact.document");
953        else if (Configuration.doAutoCreate())
954          this.document = new Attachment(); // cc
955      return this.document;
956    }
957
958    public boolean hasDocument() { 
959      return this.document != null && !this.document.isEmpty();
960    }
961
962    /**
963     * @param value {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.)
964     */
965    public RelatedArtifact setDocument(Attachment value) { 
966      this.document = value;
967      return this;
968    }
969
970    /**
971     * @return {@link #resource} (The related artifact, such as a library, value set, profile, or other knowledge resource.). This is the underlying object with id, value and extensions. The accessor "getResource" gives direct access to the value
972     */
973    public CanonicalType getResourceElement() { 
974      if (this.resource == null)
975        if (Configuration.errorOnAutoCreate())
976          throw new Error("Attempt to auto-create RelatedArtifact.resource");
977        else if (Configuration.doAutoCreate())
978          this.resource = new CanonicalType(); // bb
979      return this.resource;
980    }
981
982    public boolean hasResourceElement() { 
983      return this.resource != null && !this.resource.isEmpty();
984    }
985
986    public boolean hasResource() { 
987      return this.resource != null && !this.resource.isEmpty();
988    }
989
990    /**
991     * @param value {@link #resource} (The related artifact, such as a library, value set, profile, or other knowledge resource.). This is the underlying object with id, value and extensions. The accessor "getResource" gives direct access to the value
992     */
993    public RelatedArtifact setResourceElement(CanonicalType value) { 
994      this.resource = value;
995      return this;
996    }
997
998    /**
999     * @return The related artifact, such as a library, value set, profile, or other knowledge resource.
1000     */
1001    public String getResource() { 
1002      return this.resource == null ? null : this.resource.getValue();
1003    }
1004
1005    /**
1006     * @param value The related artifact, such as a library, value set, profile, or other knowledge resource.
1007     */
1008    public RelatedArtifact setResource(String value) { 
1009      if (Utilities.noString(value))
1010        this.resource = null;
1011      else {
1012        if (this.resource == null)
1013          this.resource = new CanonicalType();
1014        this.resource.setValue(value);
1015      }
1016      return this;
1017    }
1018
1019    /**
1020     * @return {@link #resourceReference} (The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.)
1021     */
1022    public Reference getResourceReference() { 
1023      if (this.resourceReference == null)
1024        if (Configuration.errorOnAutoCreate())
1025          throw new Error("Attempt to auto-create RelatedArtifact.resourceReference");
1026        else if (Configuration.doAutoCreate())
1027          this.resourceReference = new Reference(); // cc
1028      return this.resourceReference;
1029    }
1030
1031    public boolean hasResourceReference() { 
1032      return this.resourceReference != null && !this.resourceReference.isEmpty();
1033    }
1034
1035    /**
1036     * @param value {@link #resourceReference} (The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.)
1037     */
1038    public RelatedArtifact setResourceReference(Reference value) { 
1039      this.resourceReference = value;
1040      return this;
1041    }
1042
1043      protected void listChildren(List<Property> children) {
1044        super.listChildren(children);
1045        children.add(new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type));
1046        children.add(new Property("classifier", "CodeableConcept", "Provides additional classifiers of the related artifact.", 0, java.lang.Integer.MAX_VALUE, classifier));
1047        children.add(new Property("label", "string", "A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.", 0, 1, label));
1048        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));
1049        children.add(new Property("citation", "markdown", "A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.", 0, 1, citation));
1050        children.add(new Property("document", "Attachment", "The document being referenced, represented as an attachment. This is exclusive with the resource element.", 0, 1, document));
1051        children.add(new Property("resource", "canonical(Any)", "The related artifact, such as a library, value set, profile, or other knowledge resource.", 0, 1, resource));
1052        children.add(new Property("resourceReference", "Reference(Any)", "The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.", 0, 1, resourceReference));
1053      }
1054
1055      @Override
1056      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1057        switch (_hash) {
1058        case 3575610: /*type*/  return new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type);
1059        case -281470431: /*classifier*/  return new Property("classifier", "CodeableConcept", "Provides additional classifiers of the related artifact.", 0, java.lang.Integer.MAX_VALUE, classifier);
1060        case 102727412: /*label*/  return new Property("label", "string", "A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.", 0, 1, label);
1061        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);
1062        case -1442706713: /*citation*/  return new Property("citation", "markdown", "A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.", 0, 1, citation);
1063        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);
1064        case -341064690: /*resource*/  return new Property("resource", "canonical(Any)", "The related artifact, such as a library, value set, profile, or other knowledge resource.", 0, 1, resource);
1065        case -610120995: /*resourceReference*/  return new Property("resourceReference", "Reference(Any)", "The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.", 0, 1, resourceReference);
1066        default: return super.getNamedProperty(_hash, _name, _checkValid);
1067        }
1068
1069      }
1070
1071      @Override
1072      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1073        switch (hash) {
1074        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<RelatedArtifactType>
1075        case -281470431: /*classifier*/ return this.classifier == null ? new Base[0] : this.classifier.toArray(new Base[this.classifier.size()]); // CodeableConcept
1076        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
1077        case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType
1078        case -1442706713: /*citation*/ return this.citation == null ? new Base[0] : new Base[] {this.citation}; // MarkdownType
1079        case 861720859: /*document*/ return this.document == null ? new Base[0] : new Base[] {this.document}; // Attachment
1080        case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // CanonicalType
1081        case -610120995: /*resourceReference*/ return this.resourceReference == null ? new Base[0] : new Base[] {this.resourceReference}; // Reference
1082        default: return super.getProperty(hash, name, checkValid);
1083        }
1084
1085      }
1086
1087      @Override
1088      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1089        switch (hash) {
1090        case 3575610: // type
1091          value = new RelatedArtifactTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1092          this.type = (Enumeration) value; // Enumeration<RelatedArtifactType>
1093          return value;
1094        case -281470431: // classifier
1095          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1096          return value;
1097        case 102727412: // label
1098          this.label = TypeConvertor.castToString(value); // StringType
1099          return value;
1100        case 1671764162: // display
1101          this.display = TypeConvertor.castToString(value); // StringType
1102          return value;
1103        case -1442706713: // citation
1104          this.citation = TypeConvertor.castToMarkdown(value); // MarkdownType
1105          return value;
1106        case 861720859: // document
1107          this.document = TypeConvertor.castToAttachment(value); // Attachment
1108          return value;
1109        case -341064690: // resource
1110          this.resource = TypeConvertor.castToCanonical(value); // CanonicalType
1111          return value;
1112        case -610120995: // resourceReference
1113          this.resourceReference = TypeConvertor.castToReference(value); // Reference
1114          return value;
1115        default: return super.setProperty(hash, name, value);
1116        }
1117
1118      }
1119
1120      @Override
1121      public Base setProperty(String name, Base value) throws FHIRException {
1122        if (name.equals("type")) {
1123          value = new RelatedArtifactTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1124          this.type = (Enumeration) value; // Enumeration<RelatedArtifactType>
1125        } else if (name.equals("classifier")) {
1126          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value));
1127        } else if (name.equals("label")) {
1128          this.label = TypeConvertor.castToString(value); // StringType
1129        } else if (name.equals("display")) {
1130          this.display = TypeConvertor.castToString(value); // StringType
1131        } else if (name.equals("citation")) {
1132          this.citation = TypeConvertor.castToMarkdown(value); // MarkdownType
1133        } else if (name.equals("document")) {
1134          this.document = TypeConvertor.castToAttachment(value); // Attachment
1135        } else if (name.equals("resource")) {
1136          this.resource = TypeConvertor.castToCanonical(value); // CanonicalType
1137        } else if (name.equals("resourceReference")) {
1138          this.resourceReference = TypeConvertor.castToReference(value); // Reference
1139        } else
1140          return super.setProperty(name, value);
1141        return value;
1142      }
1143
1144      @Override
1145      public Base makeProperty(int hash, String name) throws FHIRException {
1146        switch (hash) {
1147        case 3575610:  return getTypeElement();
1148        case -281470431:  return addClassifier(); 
1149        case 102727412:  return getLabelElement();
1150        case 1671764162:  return getDisplayElement();
1151        case -1442706713:  return getCitationElement();
1152        case 861720859:  return getDocument();
1153        case -341064690:  return getResourceElement();
1154        case -610120995:  return getResourceReference();
1155        default: return super.makeProperty(hash, name);
1156        }
1157
1158      }
1159
1160      @Override
1161      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1162        switch (hash) {
1163        case 3575610: /*type*/ return new String[] {"code"};
1164        case -281470431: /*classifier*/ return new String[] {"CodeableConcept"};
1165        case 102727412: /*label*/ return new String[] {"string"};
1166        case 1671764162: /*display*/ return new String[] {"string"};
1167        case -1442706713: /*citation*/ return new String[] {"markdown"};
1168        case 861720859: /*document*/ return new String[] {"Attachment"};
1169        case -341064690: /*resource*/ return new String[] {"canonical"};
1170        case -610120995: /*resourceReference*/ return new String[] {"Reference"};
1171        default: return super.getTypesForProperty(hash, name);
1172        }
1173
1174      }
1175
1176      @Override
1177      public Base addChild(String name) throws FHIRException {
1178        if (name.equals("type")) {
1179          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.type");
1180        }
1181        else if (name.equals("classifier")) {
1182          return addClassifier();
1183        }
1184        else if (name.equals("label")) {
1185          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.label");
1186        }
1187        else if (name.equals("display")) {
1188          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.display");
1189        }
1190        else if (name.equals("citation")) {
1191          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.citation");
1192        }
1193        else if (name.equals("document")) {
1194          this.document = new Attachment();
1195          return this.document;
1196        }
1197        else if (name.equals("resource")) {
1198          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.resource");
1199        }
1200        else if (name.equals("resourceReference")) {
1201          this.resourceReference = new Reference();
1202          return this.resourceReference;
1203        }
1204        else
1205          return super.addChild(name);
1206      }
1207
1208  public String fhirType() {
1209    return "RelatedArtifact";
1210
1211  }
1212
1213      public RelatedArtifact copy() {
1214        RelatedArtifact dst = new RelatedArtifact();
1215        copyValues(dst);
1216        return dst;
1217      }
1218
1219      public void copyValues(RelatedArtifact dst) {
1220        super.copyValues(dst);
1221        dst.type = type == null ? null : type.copy();
1222        if (classifier != null) {
1223          dst.classifier = new ArrayList<CodeableConcept>();
1224          for (CodeableConcept i : classifier)
1225            dst.classifier.add(i.copy());
1226        };
1227        dst.label = label == null ? null : label.copy();
1228        dst.display = display == null ? null : display.copy();
1229        dst.citation = citation == null ? null : citation.copy();
1230        dst.document = document == null ? null : document.copy();
1231        dst.resource = resource == null ? null : resource.copy();
1232        dst.resourceReference = resourceReference == null ? null : resourceReference.copy();
1233      }
1234
1235      protected RelatedArtifact typedCopy() {
1236        return copy();
1237      }
1238
1239      @Override
1240      public boolean equalsDeep(Base other_) {
1241        if (!super.equalsDeep(other_))
1242          return false;
1243        if (!(other_ instanceof RelatedArtifact))
1244          return false;
1245        RelatedArtifact o = (RelatedArtifact) other_;
1246        return compareDeep(type, o.type, true) && compareDeep(classifier, o.classifier, true) && compareDeep(label, o.label, true)
1247           && compareDeep(display, o.display, true) && compareDeep(citation, o.citation, true) && compareDeep(document, o.document, true)
1248           && compareDeep(resource, o.resource, true) && compareDeep(resourceReference, o.resourceReference, true)
1249          ;
1250      }
1251
1252      @Override
1253      public boolean equalsShallow(Base other_) {
1254        if (!super.equalsShallow(other_))
1255          return false;
1256        if (!(other_ instanceof RelatedArtifact))
1257          return false;
1258        RelatedArtifact o = (RelatedArtifact) other_;
1259        return compareValues(type, o.type, true) && compareValues(label, o.label, true) && compareValues(display, o.display, true)
1260           && compareValues(citation, o.citation, true) && compareValues(resource, o.resource, true);
1261      }
1262
1263      public boolean isEmpty() {
1264        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, classifier, label
1265          , display, citation, document, resource, resourceReference);
1266      }
1267
1268
1269}
1270