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 Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
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            case NULL: return null;
294            default: return "?";
295          }
296        }
297        public String getSystem() {
298          switch (this) {
299            case DOCUMENTATION: return "http://hl7.org/fhir/related-artifact-type";
300            case JUSTIFICATION: return "http://hl7.org/fhir/related-artifact-type";
301            case CITATION: return "http://hl7.org/fhir/related-artifact-type";
302            case PREDECESSOR: return "http://hl7.org/fhir/related-artifact-type";
303            case SUCCESSOR: return "http://hl7.org/fhir/related-artifact-type";
304            case DERIVEDFROM: return "http://hl7.org/fhir/related-artifact-type";
305            case DEPENDSON: return "http://hl7.org/fhir/related-artifact-type";
306            case COMPOSEDOF: return "http://hl7.org/fhir/related-artifact-type";
307            case PARTOF: return "http://hl7.org/fhir/related-artifact-type";
308            case AMENDS: return "http://hl7.org/fhir/related-artifact-type";
309            case AMENDEDWITH: return "http://hl7.org/fhir/related-artifact-type";
310            case APPENDS: return "http://hl7.org/fhir/related-artifact-type";
311            case APPENDEDWITH: return "http://hl7.org/fhir/related-artifact-type";
312            case CITES: return "http://hl7.org/fhir/related-artifact-type";
313            case CITEDBY: return "http://hl7.org/fhir/related-artifact-type";
314            case COMMENTSON: return "http://hl7.org/fhir/related-artifact-type";
315            case COMMENTIN: return "http://hl7.org/fhir/related-artifact-type";
316            case CONTAINS: return "http://hl7.org/fhir/related-artifact-type";
317            case CONTAINEDIN: return "http://hl7.org/fhir/related-artifact-type";
318            case CORRECTS: return "http://hl7.org/fhir/related-artifact-type";
319            case CORRECTIONIN: return "http://hl7.org/fhir/related-artifact-type";
320            case REPLACES: return "http://hl7.org/fhir/related-artifact-type";
321            case REPLACEDWITH: return "http://hl7.org/fhir/related-artifact-type";
322            case RETRACTS: return "http://hl7.org/fhir/related-artifact-type";
323            case RETRACTEDBY: return "http://hl7.org/fhir/related-artifact-type";
324            case SIGNS: return "http://hl7.org/fhir/related-artifact-type";
325            case SIMILARTO: return "http://hl7.org/fhir/related-artifact-type";
326            case SUPPORTS: return "http://hl7.org/fhir/related-artifact-type";
327            case SUPPORTEDWITH: return "http://hl7.org/fhir/related-artifact-type";
328            case TRANSFORMS: return "http://hl7.org/fhir/related-artifact-type";
329            case TRANSFORMEDINTO: return "http://hl7.org/fhir/related-artifact-type";
330            case TRANSFORMEDWITH: return "http://hl7.org/fhir/related-artifact-type";
331            case NULL: return null;
332            default: return "?";
333          }
334        }
335        public String getDefinition() {
336          switch (this) {
337            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.";
338            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.";
339            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.";
340            case PREDECESSOR: return "The previous version of the knowledge resource.";
341            case SUCCESSOR: return "The next version of the knowledge resource.";
342            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.";
343            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.";
344            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.).";
345            case PARTOF: return "This artifact is a part of the target artifact. The target artifact is composed of this artifact (and possibly other artifacts).";
346            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.";
347            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.";
348            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.";
349            case APPENDEDWITH: return "This artifact has additional information in the target artifact.";
350            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.";
351            case CITEDBY: return "This artifact is cited by the target artifact.";
352            case COMMENTSON: return "This artifact contains comments about the target artifact.";
353            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.";
354            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.).";
355            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.";
356            case CORRECTS: return "This artifact identifies errors and replacement content for the target artifact.";
357            case CORRECTIONIN: return "This artifact has corrections to it in the target artifact. The target artifact identifies errors and replacement content for this artifact.";
358            case REPLACES: return "This artifact replaces or supersedes the target artifact. The target artifact may be considered deprecated.";
359            case REPLACEDWITH: return "This artifact is replaced with or superseded by the target artifact. This artifact may be considered deprecated.";
360            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.";
361            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.";
362            case SIGNS: return "This artifact is a signature of the target artifact.";
363            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?.";
364            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.";
365            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.";
366            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.";
367            case TRANSFORMEDINTO: return "This artifact was transformed into the target artifact (e.g., by format or language conversion).";
368            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.";
369            case NULL: return null;
370            default: return "?";
371          }
372        }
373        public String getDisplay() {
374          switch (this) {
375            case DOCUMENTATION: return "Documentation";
376            case JUSTIFICATION: return "Justification";
377            case CITATION: return "Citation";
378            case PREDECESSOR: return "Predecessor";
379            case SUCCESSOR: return "Successor";
380            case DERIVEDFROM: return "Derived From";
381            case DEPENDSON: return "Depends On";
382            case COMPOSEDOF: return "Composed Of";
383            case PARTOF: return "Part Of";
384            case AMENDS: return "Amends";
385            case AMENDEDWITH: return "Amended With";
386            case APPENDS: return "Appends";
387            case APPENDEDWITH: return "Appended With";
388            case CITES: return "Cites";
389            case CITEDBY: return "Cited By";
390            case COMMENTSON: return "Is Comment On";
391            case COMMENTIN: return "Has Comment In";
392            case CONTAINS: return "Contains";
393            case CONTAINEDIN: return "Contained In";
394            case CORRECTS: return "Corrects";
395            case CORRECTIONIN: return "Correction In";
396            case REPLACES: return "Replaces";
397            case REPLACEDWITH: return "Replaced With";
398            case RETRACTS: return "Retracts";
399            case RETRACTEDBY: return "Retracted By";
400            case SIGNS: return "Signs";
401            case SIMILARTO: return "Similar To";
402            case SUPPORTS: return "Supports";
403            case SUPPORTEDWITH: return "Supported With";
404            case TRANSFORMS: return "Transforms";
405            case TRANSFORMEDINTO: return "Transformed Into";
406            case TRANSFORMEDWITH: return "Transformed With";
407            case NULL: return null;
408            default: return "?";
409          }
410        }
411    }
412
413  public static class RelatedArtifactTypeEnumFactory implements EnumFactory<RelatedArtifactType> {
414    public RelatedArtifactType fromCode(String codeString) throws IllegalArgumentException {
415      if (codeString == null || "".equals(codeString))
416            if (codeString == null || "".equals(codeString))
417                return null;
418        if ("documentation".equals(codeString))
419          return RelatedArtifactType.DOCUMENTATION;
420        if ("justification".equals(codeString))
421          return RelatedArtifactType.JUSTIFICATION;
422        if ("citation".equals(codeString))
423          return RelatedArtifactType.CITATION;
424        if ("predecessor".equals(codeString))
425          return RelatedArtifactType.PREDECESSOR;
426        if ("successor".equals(codeString))
427          return RelatedArtifactType.SUCCESSOR;
428        if ("derived-from".equals(codeString))
429          return RelatedArtifactType.DERIVEDFROM;
430        if ("depends-on".equals(codeString))
431          return RelatedArtifactType.DEPENDSON;
432        if ("composed-of".equals(codeString))
433          return RelatedArtifactType.COMPOSEDOF;
434        if ("part-of".equals(codeString))
435          return RelatedArtifactType.PARTOF;
436        if ("amends".equals(codeString))
437          return RelatedArtifactType.AMENDS;
438        if ("amended-with".equals(codeString))
439          return RelatedArtifactType.AMENDEDWITH;
440        if ("appends".equals(codeString))
441          return RelatedArtifactType.APPENDS;
442        if ("appended-with".equals(codeString))
443          return RelatedArtifactType.APPENDEDWITH;
444        if ("cites".equals(codeString))
445          return RelatedArtifactType.CITES;
446        if ("cited-by".equals(codeString))
447          return RelatedArtifactType.CITEDBY;
448        if ("comments-on".equals(codeString))
449          return RelatedArtifactType.COMMENTSON;
450        if ("comment-in".equals(codeString))
451          return RelatedArtifactType.COMMENTIN;
452        if ("contains".equals(codeString))
453          return RelatedArtifactType.CONTAINS;
454        if ("contained-in".equals(codeString))
455          return RelatedArtifactType.CONTAINEDIN;
456        if ("corrects".equals(codeString))
457          return RelatedArtifactType.CORRECTS;
458        if ("correction-in".equals(codeString))
459          return RelatedArtifactType.CORRECTIONIN;
460        if ("replaces".equals(codeString))
461          return RelatedArtifactType.REPLACES;
462        if ("replaced-with".equals(codeString))
463          return RelatedArtifactType.REPLACEDWITH;
464        if ("retracts".equals(codeString))
465          return RelatedArtifactType.RETRACTS;
466        if ("retracted-by".equals(codeString))
467          return RelatedArtifactType.RETRACTEDBY;
468        if ("signs".equals(codeString))
469          return RelatedArtifactType.SIGNS;
470        if ("similar-to".equals(codeString))
471          return RelatedArtifactType.SIMILARTO;
472        if ("supports".equals(codeString))
473          return RelatedArtifactType.SUPPORTS;
474        if ("supported-with".equals(codeString))
475          return RelatedArtifactType.SUPPORTEDWITH;
476        if ("transforms".equals(codeString))
477          return RelatedArtifactType.TRANSFORMS;
478        if ("transformed-into".equals(codeString))
479          return RelatedArtifactType.TRANSFORMEDINTO;
480        if ("transformed-with".equals(codeString))
481          return RelatedArtifactType.TRANSFORMEDWITH;
482        throw new IllegalArgumentException("Unknown RelatedArtifactType code '"+codeString+"'");
483        }
484        public Enumeration<RelatedArtifactType> fromType(Base code) throws FHIRException {
485          if (code == null)
486            return null;
487          if (code.isEmpty())
488            return new Enumeration<RelatedArtifactType>(this);
489          String codeString = ((PrimitiveType) code).asStringValue();
490          if (codeString == null || "".equals(codeString))
491            return null;
492        if ("documentation".equals(codeString))
493          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DOCUMENTATION);
494        if ("justification".equals(codeString))
495          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.JUSTIFICATION);
496        if ("citation".equals(codeString))
497          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITATION);
498        if ("predecessor".equals(codeString))
499          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.PREDECESSOR);
500        if ("successor".equals(codeString))
501          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUCCESSOR);
502        if ("derived-from".equals(codeString))
503          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DERIVEDFROM);
504        if ("depends-on".equals(codeString))
505          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DEPENDSON);
506        if ("composed-of".equals(codeString))
507          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMPOSEDOF);
508        if ("part-of".equals(codeString))
509          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.PARTOF);
510        if ("amends".equals(codeString))
511          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.AMENDS);
512        if ("amended-with".equals(codeString))
513          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.AMENDEDWITH);
514        if ("appends".equals(codeString))
515          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.APPENDS);
516        if ("appended-with".equals(codeString))
517          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.APPENDEDWITH);
518        if ("cites".equals(codeString))
519          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITES);
520        if ("cited-by".equals(codeString))
521          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITEDBY);
522        if ("comments-on".equals(codeString))
523          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMMENTSON);
524        if ("comment-in".equals(codeString))
525          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMMENTIN);
526        if ("contains".equals(codeString))
527          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CONTAINS);
528        if ("contained-in".equals(codeString))
529          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CONTAINEDIN);
530        if ("corrects".equals(codeString))
531          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CORRECTS);
532        if ("correction-in".equals(codeString))
533          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CORRECTIONIN);
534        if ("replaces".equals(codeString))
535          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.REPLACES);
536        if ("replaced-with".equals(codeString))
537          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.REPLACEDWITH);
538        if ("retracts".equals(codeString))
539          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.RETRACTS);
540        if ("retracted-by".equals(codeString))
541          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.RETRACTEDBY);
542        if ("signs".equals(codeString))
543          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SIGNS);
544        if ("similar-to".equals(codeString))
545          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SIMILARTO);
546        if ("supports".equals(codeString))
547          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUPPORTS);
548        if ("supported-with".equals(codeString))
549          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUPPORTEDWITH);
550        if ("transforms".equals(codeString))
551          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.TRANSFORMS);
552        if ("transformed-into".equals(codeString))
553          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.TRANSFORMEDINTO);
554        if ("transformed-with".equals(codeString))
555          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.TRANSFORMEDWITH);
556        throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'");
557        }
558    public String toCode(RelatedArtifactType code) {
559      if (code == RelatedArtifactType.DOCUMENTATION)
560        return "documentation";
561      if (code == RelatedArtifactType.JUSTIFICATION)
562        return "justification";
563      if (code == RelatedArtifactType.CITATION)
564        return "citation";
565      if (code == RelatedArtifactType.PREDECESSOR)
566        return "predecessor";
567      if (code == RelatedArtifactType.SUCCESSOR)
568        return "successor";
569      if (code == RelatedArtifactType.DERIVEDFROM)
570        return "derived-from";
571      if (code == RelatedArtifactType.DEPENDSON)
572        return "depends-on";
573      if (code == RelatedArtifactType.COMPOSEDOF)
574        return "composed-of";
575      if (code == RelatedArtifactType.PARTOF)
576        return "part-of";
577      if (code == RelatedArtifactType.AMENDS)
578        return "amends";
579      if (code == RelatedArtifactType.AMENDEDWITH)
580        return "amended-with";
581      if (code == RelatedArtifactType.APPENDS)
582        return "appends";
583      if (code == RelatedArtifactType.APPENDEDWITH)
584        return "appended-with";
585      if (code == RelatedArtifactType.CITES)
586        return "cites";
587      if (code == RelatedArtifactType.CITEDBY)
588        return "cited-by";
589      if (code == RelatedArtifactType.COMMENTSON)
590        return "comments-on";
591      if (code == RelatedArtifactType.COMMENTIN)
592        return "comment-in";
593      if (code == RelatedArtifactType.CONTAINS)
594        return "contains";
595      if (code == RelatedArtifactType.CONTAINEDIN)
596        return "contained-in";
597      if (code == RelatedArtifactType.CORRECTS)
598        return "corrects";
599      if (code == RelatedArtifactType.CORRECTIONIN)
600        return "correction-in";
601      if (code == RelatedArtifactType.REPLACES)
602        return "replaces";
603      if (code == RelatedArtifactType.REPLACEDWITH)
604        return "replaced-with";
605      if (code == RelatedArtifactType.RETRACTS)
606        return "retracts";
607      if (code == RelatedArtifactType.RETRACTEDBY)
608        return "retracted-by";
609      if (code == RelatedArtifactType.SIGNS)
610        return "signs";
611      if (code == RelatedArtifactType.SIMILARTO)
612        return "similar-to";
613      if (code == RelatedArtifactType.SUPPORTS)
614        return "supports";
615      if (code == RelatedArtifactType.SUPPORTEDWITH)
616        return "supported-with";
617      if (code == RelatedArtifactType.TRANSFORMS)
618        return "transforms";
619      if (code == RelatedArtifactType.TRANSFORMEDINTO)
620        return "transformed-into";
621      if (code == RelatedArtifactType.TRANSFORMEDWITH)
622        return "transformed-with";
623      return "?";
624      }
625    public String toSystem(RelatedArtifactType code) {
626      return code.getSystem();
627      }
628    }
629
630    /**
631     * The type of relationship to the related artifact.
632     */
633    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
634    @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." )
635    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-artifact-type")
636    protected Enumeration<RelatedArtifactType> type;
637
638    /**
639     * Provides additional classifiers of the related artifact.
640     */
641    @Child(name = "classifier", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
642    @Description(shortDefinition="Additional classifiers", formalDefinition="Provides additional classifiers of the related artifact." )
643    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/citation-artifact-classifier")
644    protected List<CodeableConcept> classifier;
645
646    /**
647     * A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
648     */
649    @Child(name = "label", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
650    @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." )
651    protected StringType label;
652
653    /**
654     * A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
655     */
656    @Child(name = "display", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
657    @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." )
658    protected StringType display;
659
660    /**
661     * A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
662     */
663    @Child(name = "citation", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=true)
664    @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." )
665    protected MarkdownType citation;
666
667    /**
668     * The document being referenced, represented as an attachment. This is exclusive with the resource element.
669     */
670    @Child(name = "document", type = {Attachment.class}, order=5, min=0, max=1, modifier=false, summary=true)
671    @Description(shortDefinition="What document is being referenced", formalDefinition="The document being referenced, represented as an attachment. This is exclusive with the resource element." )
672    protected Attachment document;
673
674    /**
675     * The related artifact, such as a library, value set, profile, or other knowledge resource.
676     */
677    @Child(name = "resource", type = {CanonicalType.class}, order=6, min=0, max=1, modifier=false, summary=true)
678    @Description(shortDefinition="What artifact is being referenced", formalDefinition="The related artifact, such as a library, value set, profile, or other knowledge resource." )
679    protected CanonicalType resource;
680
681    /**
682     * The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.
683     */
684    @Child(name = "resourceReference", type = {Reference.class}, order=7, min=0, max=1, modifier=false, summary=true)
685    @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." )
686    protected Reference resourceReference;
687
688    private static final long serialVersionUID = 810506564L;
689
690  /**
691   * Constructor
692   */
693    public RelatedArtifact() {
694      super();
695    }
696
697  /**
698   * Constructor
699   */
700    public RelatedArtifact(RelatedArtifactType type) {
701      super();
702      this.setType(type);
703    }
704
705    /**
706     * @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
707     */
708    public Enumeration<RelatedArtifactType> getTypeElement() { 
709      if (this.type == null)
710        if (Configuration.errorOnAutoCreate())
711          throw new Error("Attempt to auto-create RelatedArtifact.type");
712        else if (Configuration.doAutoCreate())
713          this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory()); // bb
714      return this.type;
715    }
716
717    public boolean hasTypeElement() { 
718      return this.type != null && !this.type.isEmpty();
719    }
720
721    public boolean hasType() { 
722      return this.type != null && !this.type.isEmpty();
723    }
724
725    /**
726     * @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
727     */
728    public RelatedArtifact setTypeElement(Enumeration<RelatedArtifactType> value) { 
729      this.type = value;
730      return this;
731    }
732
733    /**
734     * @return The type of relationship to the related artifact.
735     */
736    public RelatedArtifactType getType() { 
737      return this.type == null ? null : this.type.getValue();
738    }
739
740    /**
741     * @param value The type of relationship to the related artifact.
742     */
743    public RelatedArtifact setType(RelatedArtifactType value) { 
744        if (this.type == null)
745          this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory());
746        this.type.setValue(value);
747      return this;
748    }
749
750    /**
751     * @return {@link #classifier} (Provides additional classifiers of the related artifact.)
752     */
753    public List<CodeableConcept> getClassifier() { 
754      if (this.classifier == null)
755        this.classifier = new ArrayList<CodeableConcept>();
756      return this.classifier;
757    }
758
759    /**
760     * @return Returns a reference to <code>this</code> for easy method chaining
761     */
762    public RelatedArtifact setClassifier(List<CodeableConcept> theClassifier) { 
763      this.classifier = theClassifier;
764      return this;
765    }
766
767    public boolean hasClassifier() { 
768      if (this.classifier == null)
769        return false;
770      for (CodeableConcept item : this.classifier)
771        if (!item.isEmpty())
772          return true;
773      return false;
774    }
775
776    public CodeableConcept addClassifier() { //3
777      CodeableConcept t = new CodeableConcept();
778      if (this.classifier == null)
779        this.classifier = new ArrayList<CodeableConcept>();
780      this.classifier.add(t);
781      return t;
782    }
783
784    public RelatedArtifact addClassifier(CodeableConcept t) { //3
785      if (t == null)
786        return this;
787      if (this.classifier == null)
788        this.classifier = new ArrayList<CodeableConcept>();
789      this.classifier.add(t);
790      return this;
791    }
792
793    /**
794     * @return The first repetition of repeating field {@link #classifier}, creating it if it does not already exist {3}
795     */
796    public CodeableConcept getClassifierFirstRep() { 
797      if (getClassifier().isEmpty()) {
798        addClassifier();
799      }
800      return getClassifier().get(0);
801    }
802
803    /**
804     * @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
805     */
806    public StringType getLabelElement() { 
807      if (this.label == null)
808        if (Configuration.errorOnAutoCreate())
809          throw new Error("Attempt to auto-create RelatedArtifact.label");
810        else if (Configuration.doAutoCreate())
811          this.label = new StringType(); // bb
812      return this.label;
813    }
814
815    public boolean hasLabelElement() { 
816      return this.label != null && !this.label.isEmpty();
817    }
818
819    public boolean hasLabel() { 
820      return this.label != null && !this.label.isEmpty();
821    }
822
823    /**
824     * @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
825     */
826    public RelatedArtifact setLabelElement(StringType value) { 
827      this.label = value;
828      return this;
829    }
830
831    /**
832     * @return A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
833     */
834    public String getLabel() { 
835      return this.label == null ? null : this.label.getValue();
836    }
837
838    /**
839     * @param value A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
840     */
841    public RelatedArtifact setLabel(String value) { 
842      if (Utilities.noString(value))
843        this.label = null;
844      else {
845        if (this.label == null)
846          this.label = new StringType();
847        this.label.setValue(value);
848      }
849      return this;
850    }
851
852    /**
853     * @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
854     */
855    public StringType getDisplayElement() { 
856      if (this.display == null)
857        if (Configuration.errorOnAutoCreate())
858          throw new Error("Attempt to auto-create RelatedArtifact.display");
859        else if (Configuration.doAutoCreate())
860          this.display = new StringType(); // bb
861      return this.display;
862    }
863
864    public boolean hasDisplayElement() { 
865      return this.display != null && !this.display.isEmpty();
866    }
867
868    public boolean hasDisplay() { 
869      return this.display != null && !this.display.isEmpty();
870    }
871
872    /**
873     * @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
874     */
875    public RelatedArtifact setDisplayElement(StringType value) { 
876      this.display = value;
877      return this;
878    }
879
880    /**
881     * @return A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
882     */
883    public String getDisplay() { 
884      return this.display == null ? null : this.display.getValue();
885    }
886
887    /**
888     * @param value A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
889     */
890    public RelatedArtifact setDisplay(String value) { 
891      if (Utilities.noString(value))
892        this.display = null;
893      else {
894        if (this.display == null)
895          this.display = new StringType();
896        this.display.setValue(value);
897      }
898      return this;
899    }
900
901    /**
902     * @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
903     */
904    public MarkdownType getCitationElement() { 
905      if (this.citation == null)
906        if (Configuration.errorOnAutoCreate())
907          throw new Error("Attempt to auto-create RelatedArtifact.citation");
908        else if (Configuration.doAutoCreate())
909          this.citation = new MarkdownType(); // bb
910      return this.citation;
911    }
912
913    public boolean hasCitationElement() { 
914      return this.citation != null && !this.citation.isEmpty();
915    }
916
917    public boolean hasCitation() { 
918      return this.citation != null && !this.citation.isEmpty();
919    }
920
921    /**
922     * @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
923     */
924    public RelatedArtifact setCitationElement(MarkdownType value) { 
925      this.citation = value;
926      return this;
927    }
928
929    /**
930     * @return A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
931     */
932    public String getCitation() { 
933      return this.citation == null ? null : this.citation.getValue();
934    }
935
936    /**
937     * @param value A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
938     */
939    public RelatedArtifact setCitation(String value) { 
940      if (value == null)
941        this.citation = null;
942      else {
943        if (this.citation == null)
944          this.citation = new MarkdownType();
945        this.citation.setValue(value);
946      }
947      return this;
948    }
949
950    /**
951     * @return {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.)
952     */
953    public Attachment getDocument() { 
954      if (this.document == null)
955        if (Configuration.errorOnAutoCreate())
956          throw new Error("Attempt to auto-create RelatedArtifact.document");
957        else if (Configuration.doAutoCreate())
958          this.document = new Attachment(); // cc
959      return this.document;
960    }
961
962    public boolean hasDocument() { 
963      return this.document != null && !this.document.isEmpty();
964    }
965
966    /**
967     * @param value {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.)
968     */
969    public RelatedArtifact setDocument(Attachment value) { 
970      this.document = value;
971      return this;
972    }
973
974    /**
975     * @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
976     */
977    public CanonicalType getResourceElement() { 
978      if (this.resource == null)
979        if (Configuration.errorOnAutoCreate())
980          throw new Error("Attempt to auto-create RelatedArtifact.resource");
981        else if (Configuration.doAutoCreate())
982          this.resource = new CanonicalType(); // bb
983      return this.resource;
984    }
985
986    public boolean hasResourceElement() { 
987      return this.resource != null && !this.resource.isEmpty();
988    }
989
990    public boolean hasResource() { 
991      return this.resource != null && !this.resource.isEmpty();
992    }
993
994    /**
995     * @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
996     */
997    public RelatedArtifact setResourceElement(CanonicalType value) { 
998      this.resource = value;
999      return this;
1000    }
1001
1002    /**
1003     * @return The related artifact, such as a library, value set, profile, or other knowledge resource.
1004     */
1005    public String getResource() { 
1006      return this.resource == null ? null : this.resource.getValue();
1007    }
1008
1009    /**
1010     * @param value The related artifact, such as a library, value set, profile, or other knowledge resource.
1011     */
1012    public RelatedArtifact setResource(String value) { 
1013      if (Utilities.noString(value))
1014        this.resource = null;
1015      else {
1016        if (this.resource == null)
1017          this.resource = new CanonicalType();
1018        this.resource.setValue(value);
1019      }
1020      return this;
1021    }
1022
1023    /**
1024     * @return {@link #resourceReference} (The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.)
1025     */
1026    public Reference getResourceReference() { 
1027      if (this.resourceReference == null)
1028        if (Configuration.errorOnAutoCreate())
1029          throw new Error("Attempt to auto-create RelatedArtifact.resourceReference");
1030        else if (Configuration.doAutoCreate())
1031          this.resourceReference = new Reference(); // cc
1032      return this.resourceReference;
1033    }
1034
1035    public boolean hasResourceReference() { 
1036      return this.resourceReference != null && !this.resourceReference.isEmpty();
1037    }
1038
1039    /**
1040     * @param value {@link #resourceReference} (The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.)
1041     */
1042    public RelatedArtifact setResourceReference(Reference value) { 
1043      this.resourceReference = value;
1044      return this;
1045    }
1046
1047      protected void listChildren(List<Property> children) {
1048        super.listChildren(children);
1049        children.add(new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type));
1050        children.add(new Property("classifier", "CodeableConcept", "Provides additional classifiers of the related artifact.", 0, java.lang.Integer.MAX_VALUE, classifier));
1051        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));
1052        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));
1053        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));
1054        children.add(new Property("document", "Attachment", "The document being referenced, represented as an attachment. This is exclusive with the resource element.", 0, 1, document));
1055        children.add(new Property("resource", "canonical(Any)", "The related artifact, such as a library, value set, profile, or other knowledge resource.", 0, 1, resource));
1056        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));
1057      }
1058
1059      @Override
1060      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1061        switch (_hash) {
1062        case 3575610: /*type*/  return new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type);
1063        case -281470431: /*classifier*/  return new Property("classifier", "CodeableConcept", "Provides additional classifiers of the related artifact.", 0, java.lang.Integer.MAX_VALUE, classifier);
1064        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);
1065        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);
1066        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);
1067        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);
1068        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);
1069        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);
1070        default: return super.getNamedProperty(_hash, _name, _checkValid);
1071        }
1072
1073      }
1074
1075      @Override
1076      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1077        switch (hash) {
1078        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<RelatedArtifactType>
1079        case -281470431: /*classifier*/ return this.classifier == null ? new Base[0] : this.classifier.toArray(new Base[this.classifier.size()]); // CodeableConcept
1080        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
1081        case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType
1082        case -1442706713: /*citation*/ return this.citation == null ? new Base[0] : new Base[] {this.citation}; // MarkdownType
1083        case 861720859: /*document*/ return this.document == null ? new Base[0] : new Base[] {this.document}; // Attachment
1084        case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // CanonicalType
1085        case -610120995: /*resourceReference*/ return this.resourceReference == null ? new Base[0] : new Base[] {this.resourceReference}; // Reference
1086        default: return super.getProperty(hash, name, checkValid);
1087        }
1088
1089      }
1090
1091      @Override
1092      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1093        switch (hash) {
1094        case 3575610: // type
1095          value = new RelatedArtifactTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1096          this.type = (Enumeration) value; // Enumeration<RelatedArtifactType>
1097          return value;
1098        case -281470431: // classifier
1099          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1100          return value;
1101        case 102727412: // label
1102          this.label = TypeConvertor.castToString(value); // StringType
1103          return value;
1104        case 1671764162: // display
1105          this.display = TypeConvertor.castToString(value); // StringType
1106          return value;
1107        case -1442706713: // citation
1108          this.citation = TypeConvertor.castToMarkdown(value); // MarkdownType
1109          return value;
1110        case 861720859: // document
1111          this.document = TypeConvertor.castToAttachment(value); // Attachment
1112          return value;
1113        case -341064690: // resource
1114          this.resource = TypeConvertor.castToCanonical(value); // CanonicalType
1115          return value;
1116        case -610120995: // resourceReference
1117          this.resourceReference = TypeConvertor.castToReference(value); // Reference
1118          return value;
1119        default: return super.setProperty(hash, name, value);
1120        }
1121
1122      }
1123
1124      @Override
1125      public Base setProperty(String name, Base value) throws FHIRException {
1126        if (name.equals("type")) {
1127          value = new RelatedArtifactTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1128          this.type = (Enumeration) value; // Enumeration<RelatedArtifactType>
1129        } else if (name.equals("classifier")) {
1130          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value));
1131        } else if (name.equals("label")) {
1132          this.label = TypeConvertor.castToString(value); // StringType
1133        } else if (name.equals("display")) {
1134          this.display = TypeConvertor.castToString(value); // StringType
1135        } else if (name.equals("citation")) {
1136          this.citation = TypeConvertor.castToMarkdown(value); // MarkdownType
1137        } else if (name.equals("document")) {
1138          this.document = TypeConvertor.castToAttachment(value); // Attachment
1139        } else if (name.equals("resource")) {
1140          this.resource = TypeConvertor.castToCanonical(value); // CanonicalType
1141        } else if (name.equals("resourceReference")) {
1142          this.resourceReference = TypeConvertor.castToReference(value); // Reference
1143        } else
1144          return super.setProperty(name, value);
1145        return value;
1146      }
1147
1148      @Override
1149      public Base makeProperty(int hash, String name) throws FHIRException {
1150        switch (hash) {
1151        case 3575610:  return getTypeElement();
1152        case -281470431:  return addClassifier(); 
1153        case 102727412:  return getLabelElement();
1154        case 1671764162:  return getDisplayElement();
1155        case -1442706713:  return getCitationElement();
1156        case 861720859:  return getDocument();
1157        case -341064690:  return getResourceElement();
1158        case -610120995:  return getResourceReference();
1159        default: return super.makeProperty(hash, name);
1160        }
1161
1162      }
1163
1164      @Override
1165      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1166        switch (hash) {
1167        case 3575610: /*type*/ return new String[] {"code"};
1168        case -281470431: /*classifier*/ return new String[] {"CodeableConcept"};
1169        case 102727412: /*label*/ return new String[] {"string"};
1170        case 1671764162: /*display*/ return new String[] {"string"};
1171        case -1442706713: /*citation*/ return new String[] {"markdown"};
1172        case 861720859: /*document*/ return new String[] {"Attachment"};
1173        case -341064690: /*resource*/ return new String[] {"canonical"};
1174        case -610120995: /*resourceReference*/ return new String[] {"Reference"};
1175        default: return super.getTypesForProperty(hash, name);
1176        }
1177
1178      }
1179
1180      @Override
1181      public Base addChild(String name) throws FHIRException {
1182        if (name.equals("type")) {
1183          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.type");
1184        }
1185        else if (name.equals("classifier")) {
1186          return addClassifier();
1187        }
1188        else if (name.equals("label")) {
1189          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.label");
1190        }
1191        else if (name.equals("display")) {
1192          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.display");
1193        }
1194        else if (name.equals("citation")) {
1195          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.citation");
1196        }
1197        else if (name.equals("document")) {
1198          this.document = new Attachment();
1199          return this.document;
1200        }
1201        else if (name.equals("resource")) {
1202          throw new FHIRException("Cannot call addChild on a primitive type RelatedArtifact.resource");
1203        }
1204        else if (name.equals("resourceReference")) {
1205          this.resourceReference = new Reference();
1206          return this.resourceReference;
1207        }
1208        else
1209          return super.addChild(name);
1210      }
1211
1212  public String fhirType() {
1213    return "RelatedArtifact";
1214
1215  }
1216
1217      public RelatedArtifact copy() {
1218        RelatedArtifact dst = new RelatedArtifact();
1219        copyValues(dst);
1220        return dst;
1221      }
1222
1223      public void copyValues(RelatedArtifact dst) {
1224        super.copyValues(dst);
1225        dst.type = type == null ? null : type.copy();
1226        if (classifier != null) {
1227          dst.classifier = new ArrayList<CodeableConcept>();
1228          for (CodeableConcept i : classifier)
1229            dst.classifier.add(i.copy());
1230        };
1231        dst.label = label == null ? null : label.copy();
1232        dst.display = display == null ? null : display.copy();
1233        dst.citation = citation == null ? null : citation.copy();
1234        dst.document = document == null ? null : document.copy();
1235        dst.resource = resource == null ? null : resource.copy();
1236        dst.resourceReference = resourceReference == null ? null : resourceReference.copy();
1237      }
1238
1239      protected RelatedArtifact typedCopy() {
1240        return copy();
1241      }
1242
1243      @Override
1244      public boolean equalsDeep(Base other_) {
1245        if (!super.equalsDeep(other_))
1246          return false;
1247        if (!(other_ instanceof RelatedArtifact))
1248          return false;
1249        RelatedArtifact o = (RelatedArtifact) other_;
1250        return compareDeep(type, o.type, true) && compareDeep(classifier, o.classifier, true) && compareDeep(label, o.label, true)
1251           && compareDeep(display, o.display, true) && compareDeep(citation, o.citation, true) && compareDeep(document, o.document, true)
1252           && compareDeep(resource, o.resource, true) && compareDeep(resourceReference, o.resourceReference, true)
1253          ;
1254      }
1255
1256      @Override
1257      public boolean equalsShallow(Base other_) {
1258        if (!super.equalsShallow(other_))
1259          return false;
1260        if (!(other_ instanceof RelatedArtifact))
1261          return false;
1262        RelatedArtifact o = (RelatedArtifact) other_;
1263        return compareValues(type, o.type, true) && compareValues(label, o.label, true) && compareValues(display, o.display, true)
1264           && compareValues(citation, o.citation, true) && compareValues(resource, o.resource, true);
1265      }
1266
1267      public boolean isEmpty() {
1268        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, classifier, label
1269          , display, citation, document, resource, resourceReference);
1270      }
1271
1272
1273}
1274