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 Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
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 * 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 artifact, used to establish an ordering of versions of an artifact, independent of the status of each version.
069         */
070        PREDECESSOR, 
071        /**
072         * The subsequent version of the knowledge artfact, used to establish an ordering of versions of an artifact, independent of the status of each version.
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 support for the target artifact. The type of support  is not documentation as it does not describe, explain, or instruct regarding the target artifact.
165         */
166        SUPPORTS, 
167        /**
168         * The target artifact contains additional information related to the knowledge artifact but is not documentation as the additional information does not describe, explain, or instruct regarding the knowledge artifact content or application. This could include an associated dataset.
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         * 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.
185         */
186        DOCUMENTS, 
187        /**
188         * The target artifact is a precise description of a concept in this artifact. This may be used when the RelatedArtifact datatype is used in elements contained in this artifact.
189         */
190        SPECIFICATIONOF, 
191        /**
192         * This artifact was created with the target artifact. The target artifact is a tool or support material used in the creation of the artifact, and not content that the artifact was derived from.
193         */
194        CREATEDWITH, 
195        /**
196         * The related artifact is the citation for this artifact.
197         */
198        CITEAS, 
199        /**
200         * added to help the parsers with the generic types
201         */
202        NULL;
203        public static RelatedArtifactType fromCode(String codeString) throws FHIRException {
204            if (codeString == null || "".equals(codeString))
205                return null;
206        if ("documentation".equals(codeString))
207          return DOCUMENTATION;
208        if ("justification".equals(codeString))
209          return JUSTIFICATION;
210        if ("citation".equals(codeString))
211          return CITATION;
212        if ("predecessor".equals(codeString))
213          return PREDECESSOR;
214        if ("successor".equals(codeString))
215          return SUCCESSOR;
216        if ("derived-from".equals(codeString))
217          return DERIVEDFROM;
218        if ("depends-on".equals(codeString))
219          return DEPENDSON;
220        if ("composed-of".equals(codeString))
221          return COMPOSEDOF;
222        if ("part-of".equals(codeString))
223          return PARTOF;
224        if ("amends".equals(codeString))
225          return AMENDS;
226        if ("amended-with".equals(codeString))
227          return AMENDEDWITH;
228        if ("appends".equals(codeString))
229          return APPENDS;
230        if ("appended-with".equals(codeString))
231          return APPENDEDWITH;
232        if ("cites".equals(codeString))
233          return CITES;
234        if ("cited-by".equals(codeString))
235          return CITEDBY;
236        if ("comments-on".equals(codeString))
237          return COMMENTSON;
238        if ("comment-in".equals(codeString))
239          return COMMENTIN;
240        if ("contains".equals(codeString))
241          return CONTAINS;
242        if ("contained-in".equals(codeString))
243          return CONTAINEDIN;
244        if ("corrects".equals(codeString))
245          return CORRECTS;
246        if ("correction-in".equals(codeString))
247          return CORRECTIONIN;
248        if ("replaces".equals(codeString))
249          return REPLACES;
250        if ("replaced-with".equals(codeString))
251          return REPLACEDWITH;
252        if ("retracts".equals(codeString))
253          return RETRACTS;
254        if ("retracted-by".equals(codeString))
255          return RETRACTEDBY;
256        if ("signs".equals(codeString))
257          return SIGNS;
258        if ("similar-to".equals(codeString))
259          return SIMILARTO;
260        if ("supports".equals(codeString))
261          return SUPPORTS;
262        if ("supported-with".equals(codeString))
263          return SUPPORTEDWITH;
264        if ("transforms".equals(codeString))
265          return TRANSFORMS;
266        if ("transformed-into".equals(codeString))
267          return TRANSFORMEDINTO;
268        if ("transformed-with".equals(codeString))
269          return TRANSFORMEDWITH;
270        if ("documents".equals(codeString))
271          return DOCUMENTS;
272        if ("specification-of".equals(codeString))
273          return SPECIFICATIONOF;
274        if ("created-with".equals(codeString))
275          return CREATEDWITH;
276        if ("cite-as".equals(codeString))
277          return CITEAS;
278        if (Configuration.isAcceptInvalidEnums())
279          return null;
280        else
281          throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'");
282        }
283        public String toCode() {
284          switch (this) {
285            case DOCUMENTATION: return "documentation";
286            case JUSTIFICATION: return "justification";
287            case CITATION: return "citation";
288            case PREDECESSOR: return "predecessor";
289            case SUCCESSOR: return "successor";
290            case DERIVEDFROM: return "derived-from";
291            case DEPENDSON: return "depends-on";
292            case COMPOSEDOF: return "composed-of";
293            case PARTOF: return "part-of";
294            case AMENDS: return "amends";
295            case AMENDEDWITH: return "amended-with";
296            case APPENDS: return "appends";
297            case APPENDEDWITH: return "appended-with";
298            case CITES: return "cites";
299            case CITEDBY: return "cited-by";
300            case COMMENTSON: return "comments-on";
301            case COMMENTIN: return "comment-in";
302            case CONTAINS: return "contains";
303            case CONTAINEDIN: return "contained-in";
304            case CORRECTS: return "corrects";
305            case CORRECTIONIN: return "correction-in";
306            case REPLACES: return "replaces";
307            case REPLACEDWITH: return "replaced-with";
308            case RETRACTS: return "retracts";
309            case RETRACTEDBY: return "retracted-by";
310            case SIGNS: return "signs";
311            case SIMILARTO: return "similar-to";
312            case SUPPORTS: return "supports";
313            case SUPPORTEDWITH: return "supported-with";
314            case TRANSFORMS: return "transforms";
315            case TRANSFORMEDINTO: return "transformed-into";
316            case TRANSFORMEDWITH: return "transformed-with";
317            case DOCUMENTS: return "documents";
318            case SPECIFICATIONOF: return "specification-of";
319            case CREATEDWITH: return "created-with";
320            case CITEAS: return "cite-as";
321            case NULL: return null;
322            default: return "?";
323          }
324        }
325        public String getSystem() {
326          switch (this) {
327            case DOCUMENTATION: return "http://hl7.org/fhir/related-artifact-type";
328            case JUSTIFICATION: return "http://hl7.org/fhir/related-artifact-type";
329            case CITATION: return "http://hl7.org/fhir/related-artifact-type";
330            case PREDECESSOR: return "http://hl7.org/fhir/related-artifact-type";
331            case SUCCESSOR: return "http://hl7.org/fhir/related-artifact-type";
332            case DERIVEDFROM: return "http://hl7.org/fhir/related-artifact-type";
333            case DEPENDSON: return "http://hl7.org/fhir/related-artifact-type";
334            case COMPOSEDOF: return "http://hl7.org/fhir/related-artifact-type";
335            case PARTOF: return "http://hl7.org/fhir/related-artifact-type";
336            case AMENDS: return "http://hl7.org/fhir/related-artifact-type";
337            case AMENDEDWITH: return "http://hl7.org/fhir/related-artifact-type";
338            case APPENDS: return "http://hl7.org/fhir/related-artifact-type";
339            case APPENDEDWITH: return "http://hl7.org/fhir/related-artifact-type";
340            case CITES: return "http://hl7.org/fhir/related-artifact-type";
341            case CITEDBY: return "http://hl7.org/fhir/related-artifact-type";
342            case COMMENTSON: return "http://hl7.org/fhir/related-artifact-type";
343            case COMMENTIN: return "http://hl7.org/fhir/related-artifact-type";
344            case CONTAINS: return "http://hl7.org/fhir/related-artifact-type";
345            case CONTAINEDIN: return "http://hl7.org/fhir/related-artifact-type";
346            case CORRECTS: return "http://hl7.org/fhir/related-artifact-type";
347            case CORRECTIONIN: return "http://hl7.org/fhir/related-artifact-type";
348            case REPLACES: return "http://hl7.org/fhir/related-artifact-type";
349            case REPLACEDWITH: return "http://hl7.org/fhir/related-artifact-type";
350            case RETRACTS: return "http://hl7.org/fhir/related-artifact-type";
351            case RETRACTEDBY: return "http://hl7.org/fhir/related-artifact-type";
352            case SIGNS: return "http://hl7.org/fhir/related-artifact-type";
353            case SIMILARTO: return "http://hl7.org/fhir/related-artifact-type";
354            case SUPPORTS: return "http://hl7.org/fhir/related-artifact-type";
355            case SUPPORTEDWITH: return "http://hl7.org/fhir/related-artifact-type";
356            case TRANSFORMS: return "http://hl7.org/fhir/related-artifact-type";
357            case TRANSFORMEDINTO: return "http://hl7.org/fhir/related-artifact-type";
358            case TRANSFORMEDWITH: return "http://hl7.org/fhir/related-artifact-type";
359            case DOCUMENTS: return "http://hl7.org/fhir/related-artifact-type";
360            case SPECIFICATIONOF: return "http://hl7.org/fhir/related-artifact-type";
361            case CREATEDWITH: return "http://hl7.org/fhir/related-artifact-type";
362            case CITEAS: return "http://hl7.org/fhir/related-artifact-type";
363            case NULL: return null;
364            default: return "?";
365          }
366        }
367        public String getDefinition() {
368          switch (this) {
369            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.";
370            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.";
371            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.";
372            case PREDECESSOR: return "The previous version of the knowledge artifact, used to establish an ordering of versions of an artifact, independent of the status of each version.";
373            case SUCCESSOR: return "The subsequent version of the knowledge artfact, used to establish an ordering of versions of an artifact, independent of the status of each version.";
374            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.";
375            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.";
376            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.).";
377            case PARTOF: return "This artifact is a part of the target artifact. The target artifact is composed of this artifact (and possibly other artifacts).";
378            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.";
379            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.";
380            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.";
381            case APPENDEDWITH: return "This artifact has additional information in the target artifact.";
382            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.";
383            case CITEDBY: return "This artifact is cited by the target artifact.";
384            case COMMENTSON: return "This artifact contains comments about the target artifact.";
385            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.";
386            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.).";
387            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.";
388            case CORRECTS: return "This artifact identifies errors and replacement content for the target artifact.";
389            case CORRECTIONIN: return "This artifact has corrections to it in the target artifact. The target artifact identifies errors and replacement content for this artifact.";
390            case REPLACES: return "This artifact replaces or supersedes the target artifact. The target artifact may be considered deprecated.";
391            case REPLACEDWITH: return "This artifact is replaced with or superseded by the target artifact. This artifact may be considered deprecated.";
392            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.";
393            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.";
394            case SIGNS: return "This artifact is a signature of the target artifact.";
395            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?.";
396            case SUPPORTS: return "This artifact provides additional support for the target artifact. The type of support  is not documentation as it does not describe, explain, or instruct regarding the target artifact.";
397            case SUPPORTEDWITH: return "The target artifact contains additional information related to the knowledge artifact but is not documentation as the additional information does not describe, explain, or instruct regarding the knowledge artifact content or application. This could include an associated dataset.";
398            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.";
399            case TRANSFORMEDINTO: return "This artifact was transformed into the target artifact (e.g., by format or language conversion).";
400            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.";
401            case DOCUMENTS: 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.";
402            case SPECIFICATIONOF: return "The target artifact is a precise description of a concept in this artifact. This may be used when the RelatedArtifact datatype is used in elements contained in this artifact.";
403            case CREATEDWITH: return "This artifact was created with the target artifact. The target artifact is a tool or support material used in the creation of the artifact, and not content that the artifact was derived from.";
404            case CITEAS: return "The related artifact is the citation for this artifact.";
405            case NULL: return null;
406            default: return "?";
407          }
408        }
409        public String getDisplay() {
410          switch (this) {
411            case DOCUMENTATION: return "Documentation";
412            case JUSTIFICATION: return "Justification";
413            case CITATION: return "Citation";
414            case PREDECESSOR: return "Predecessor";
415            case SUCCESSOR: return "Successor";
416            case DERIVEDFROM: return "Derived From";
417            case DEPENDSON: return "Depends On";
418            case COMPOSEDOF: return "Composed Of";
419            case PARTOF: return "Part Of";
420            case AMENDS: return "Amends";
421            case AMENDEDWITH: return "Amended With";
422            case APPENDS: return "Appends";
423            case APPENDEDWITH: return "Appended With";
424            case CITES: return "Cites";
425            case CITEDBY: return "Cited By";
426            case COMMENTSON: return "Is Comment On";
427            case COMMENTIN: return "Has Comment In";
428            case CONTAINS: return "Contains";
429            case CONTAINEDIN: return "Contained In";
430            case CORRECTS: return "Corrects";
431            case CORRECTIONIN: return "Correction In";
432            case REPLACES: return "Replaces";
433            case REPLACEDWITH: return "Replaced With";
434            case RETRACTS: return "Retracts";
435            case RETRACTEDBY: return "Retracted By";
436            case SIGNS: return "Signs";
437            case SIMILARTO: return "Similar To";
438            case SUPPORTS: return "Supports";
439            case SUPPORTEDWITH: return "Supported With";
440            case TRANSFORMS: return "Transforms";
441            case TRANSFORMEDINTO: return "Transformed Into";
442            case TRANSFORMEDWITH: return "Transformed With";
443            case DOCUMENTS: return "Documents";
444            case SPECIFICATIONOF: return "Specification Of";
445            case CREATEDWITH: return "Created With";
446            case CITEAS: return "Cite As";
447            case NULL: return null;
448            default: return "?";
449          }
450        }
451    }
452
453  public static class RelatedArtifactTypeEnumFactory implements EnumFactory<RelatedArtifactType> {
454    public RelatedArtifactType fromCode(String codeString) throws IllegalArgumentException {
455      if (codeString == null || "".equals(codeString))
456            if (codeString == null || "".equals(codeString))
457                return null;
458        if ("documentation".equals(codeString))
459          return RelatedArtifactType.DOCUMENTATION;
460        if ("justification".equals(codeString))
461          return RelatedArtifactType.JUSTIFICATION;
462        if ("citation".equals(codeString))
463          return RelatedArtifactType.CITATION;
464        if ("predecessor".equals(codeString))
465          return RelatedArtifactType.PREDECESSOR;
466        if ("successor".equals(codeString))
467          return RelatedArtifactType.SUCCESSOR;
468        if ("derived-from".equals(codeString))
469          return RelatedArtifactType.DERIVEDFROM;
470        if ("depends-on".equals(codeString))
471          return RelatedArtifactType.DEPENDSON;
472        if ("composed-of".equals(codeString))
473          return RelatedArtifactType.COMPOSEDOF;
474        if ("part-of".equals(codeString))
475          return RelatedArtifactType.PARTOF;
476        if ("amends".equals(codeString))
477          return RelatedArtifactType.AMENDS;
478        if ("amended-with".equals(codeString))
479          return RelatedArtifactType.AMENDEDWITH;
480        if ("appends".equals(codeString))
481          return RelatedArtifactType.APPENDS;
482        if ("appended-with".equals(codeString))
483          return RelatedArtifactType.APPENDEDWITH;
484        if ("cites".equals(codeString))
485          return RelatedArtifactType.CITES;
486        if ("cited-by".equals(codeString))
487          return RelatedArtifactType.CITEDBY;
488        if ("comments-on".equals(codeString))
489          return RelatedArtifactType.COMMENTSON;
490        if ("comment-in".equals(codeString))
491          return RelatedArtifactType.COMMENTIN;
492        if ("contains".equals(codeString))
493          return RelatedArtifactType.CONTAINS;
494        if ("contained-in".equals(codeString))
495          return RelatedArtifactType.CONTAINEDIN;
496        if ("corrects".equals(codeString))
497          return RelatedArtifactType.CORRECTS;
498        if ("correction-in".equals(codeString))
499          return RelatedArtifactType.CORRECTIONIN;
500        if ("replaces".equals(codeString))
501          return RelatedArtifactType.REPLACES;
502        if ("replaced-with".equals(codeString))
503          return RelatedArtifactType.REPLACEDWITH;
504        if ("retracts".equals(codeString))
505          return RelatedArtifactType.RETRACTS;
506        if ("retracted-by".equals(codeString))
507          return RelatedArtifactType.RETRACTEDBY;
508        if ("signs".equals(codeString))
509          return RelatedArtifactType.SIGNS;
510        if ("similar-to".equals(codeString))
511          return RelatedArtifactType.SIMILARTO;
512        if ("supports".equals(codeString))
513          return RelatedArtifactType.SUPPORTS;
514        if ("supported-with".equals(codeString))
515          return RelatedArtifactType.SUPPORTEDWITH;
516        if ("transforms".equals(codeString))
517          return RelatedArtifactType.TRANSFORMS;
518        if ("transformed-into".equals(codeString))
519          return RelatedArtifactType.TRANSFORMEDINTO;
520        if ("transformed-with".equals(codeString))
521          return RelatedArtifactType.TRANSFORMEDWITH;
522        if ("documents".equals(codeString))
523          return RelatedArtifactType.DOCUMENTS;
524        if ("specification-of".equals(codeString))
525          return RelatedArtifactType.SPECIFICATIONOF;
526        if ("created-with".equals(codeString))
527          return RelatedArtifactType.CREATEDWITH;
528        if ("cite-as".equals(codeString))
529          return RelatedArtifactType.CITEAS;
530        throw new IllegalArgumentException("Unknown RelatedArtifactType code '"+codeString+"'");
531        }
532        public Enumeration<RelatedArtifactType> fromType(PrimitiveType<?> code) throws FHIRException {
533          if (code == null)
534            return null;
535          if (code.isEmpty())
536            return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.NULL, code);
537          String codeString = ((PrimitiveType) code).asStringValue();
538          if (codeString == null || "".equals(codeString))
539            return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.NULL, code);
540        if ("documentation".equals(codeString))
541          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DOCUMENTATION, code);
542        if ("justification".equals(codeString))
543          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.JUSTIFICATION, code);
544        if ("citation".equals(codeString))
545          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITATION, code);
546        if ("predecessor".equals(codeString))
547          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.PREDECESSOR, code);
548        if ("successor".equals(codeString))
549          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUCCESSOR, code);
550        if ("derived-from".equals(codeString))
551          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DERIVEDFROM, code);
552        if ("depends-on".equals(codeString))
553          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DEPENDSON, code);
554        if ("composed-of".equals(codeString))
555          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMPOSEDOF, code);
556        if ("part-of".equals(codeString))
557          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.PARTOF, code);
558        if ("amends".equals(codeString))
559          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.AMENDS, code);
560        if ("amended-with".equals(codeString))
561          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.AMENDEDWITH, code);
562        if ("appends".equals(codeString))
563          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.APPENDS, code);
564        if ("appended-with".equals(codeString))
565          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.APPENDEDWITH, code);
566        if ("cites".equals(codeString))
567          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITES, code);
568        if ("cited-by".equals(codeString))
569          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITEDBY, code);
570        if ("comments-on".equals(codeString))
571          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMMENTSON, code);
572        if ("comment-in".equals(codeString))
573          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.COMMENTIN, code);
574        if ("contains".equals(codeString))
575          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CONTAINS, code);
576        if ("contained-in".equals(codeString))
577          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CONTAINEDIN, code);
578        if ("corrects".equals(codeString))
579          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CORRECTS, code);
580        if ("correction-in".equals(codeString))
581          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CORRECTIONIN, code);
582        if ("replaces".equals(codeString))
583          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.REPLACES, code);
584        if ("replaced-with".equals(codeString))
585          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.REPLACEDWITH, code);
586        if ("retracts".equals(codeString))
587          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.RETRACTS, code);
588        if ("retracted-by".equals(codeString))
589          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.RETRACTEDBY, code);
590        if ("signs".equals(codeString))
591          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SIGNS, code);
592        if ("similar-to".equals(codeString))
593          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SIMILARTO, code);
594        if ("supports".equals(codeString))
595          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUPPORTS, code);
596        if ("supported-with".equals(codeString))
597          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SUPPORTEDWITH, code);
598        if ("transforms".equals(codeString))
599          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.TRANSFORMS, code);
600        if ("transformed-into".equals(codeString))
601          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.TRANSFORMEDINTO, code);
602        if ("transformed-with".equals(codeString))
603          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.TRANSFORMEDWITH, code);
604        if ("documents".equals(codeString))
605          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.DOCUMENTS, code);
606        if ("specification-of".equals(codeString))
607          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.SPECIFICATIONOF, code);
608        if ("created-with".equals(codeString))
609          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CREATEDWITH, code);
610        if ("cite-as".equals(codeString))
611          return new Enumeration<RelatedArtifactType>(this, RelatedArtifactType.CITEAS, code);
612        throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'");
613        }
614    public String toCode(RelatedArtifactType code) {
615      if (code == RelatedArtifactType.DOCUMENTATION)
616        return "documentation";
617      if (code == RelatedArtifactType.JUSTIFICATION)
618        return "justification";
619      if (code == RelatedArtifactType.CITATION)
620        return "citation";
621      if (code == RelatedArtifactType.PREDECESSOR)
622        return "predecessor";
623      if (code == RelatedArtifactType.SUCCESSOR)
624        return "successor";
625      if (code == RelatedArtifactType.DERIVEDFROM)
626        return "derived-from";
627      if (code == RelatedArtifactType.DEPENDSON)
628        return "depends-on";
629      if (code == RelatedArtifactType.COMPOSEDOF)
630        return "composed-of";
631      if (code == RelatedArtifactType.PARTOF)
632        return "part-of";
633      if (code == RelatedArtifactType.AMENDS)
634        return "amends";
635      if (code == RelatedArtifactType.AMENDEDWITH)
636        return "amended-with";
637      if (code == RelatedArtifactType.APPENDS)
638        return "appends";
639      if (code == RelatedArtifactType.APPENDEDWITH)
640        return "appended-with";
641      if (code == RelatedArtifactType.CITES)
642        return "cites";
643      if (code == RelatedArtifactType.CITEDBY)
644        return "cited-by";
645      if (code == RelatedArtifactType.COMMENTSON)
646        return "comments-on";
647      if (code == RelatedArtifactType.COMMENTIN)
648        return "comment-in";
649      if (code == RelatedArtifactType.CONTAINS)
650        return "contains";
651      if (code == RelatedArtifactType.CONTAINEDIN)
652        return "contained-in";
653      if (code == RelatedArtifactType.CORRECTS)
654        return "corrects";
655      if (code == RelatedArtifactType.CORRECTIONIN)
656        return "correction-in";
657      if (code == RelatedArtifactType.REPLACES)
658        return "replaces";
659      if (code == RelatedArtifactType.REPLACEDWITH)
660        return "replaced-with";
661      if (code == RelatedArtifactType.RETRACTS)
662        return "retracts";
663      if (code == RelatedArtifactType.RETRACTEDBY)
664        return "retracted-by";
665      if (code == RelatedArtifactType.SIGNS)
666        return "signs";
667      if (code == RelatedArtifactType.SIMILARTO)
668        return "similar-to";
669      if (code == RelatedArtifactType.SUPPORTS)
670        return "supports";
671      if (code == RelatedArtifactType.SUPPORTEDWITH)
672        return "supported-with";
673      if (code == RelatedArtifactType.TRANSFORMS)
674        return "transforms";
675      if (code == RelatedArtifactType.TRANSFORMEDINTO)
676        return "transformed-into";
677      if (code == RelatedArtifactType.TRANSFORMEDWITH)
678        return "transformed-with";
679      if (code == RelatedArtifactType.DOCUMENTS)
680        return "documents";
681      if (code == RelatedArtifactType.SPECIFICATIONOF)
682        return "specification-of";
683      if (code == RelatedArtifactType.CREATEDWITH)
684        return "created-with";
685      if (code == RelatedArtifactType.CITEAS)
686        return "cite-as";
687      return "?";
688      }
689    public String toSystem(RelatedArtifactType code) {
690      return code.getSystem();
691      }
692    }
693
694    /**
695     * The type of relationship to the related artifact.
696     */
697    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
698    @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 | documents | specification-of | created-with | cite-as", formalDefinition="The type of relationship to the related artifact." )
699    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-artifact-type")
700    protected Enumeration<RelatedArtifactType> type;
701
702    /**
703     * Provides additional classifiers of the related artifact.
704     */
705    @Child(name = "classifier", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
706    @Description(shortDefinition="Additional classifiers", formalDefinition="Provides additional classifiers of the related artifact." )
707    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/citation-artifact-classifier")
708    protected List<CodeableConcept> classifier;
709
710    /**
711     * A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
712     */
713    @Child(name = "label", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
714    @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." )
715    protected StringType label;
716
717    /**
718     * A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
719     */
720    @Child(name = "display", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
721    @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." )
722    protected StringType display;
723
724    /**
725     * A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
726     */
727    @Child(name = "citation", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=true)
728    @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." )
729    protected MarkdownType citation;
730
731    /**
732     * The document being referenced, represented as an attachment. This is exclusive with the resource element.
733     */
734    @Child(name = "document", type = {Attachment.class}, order=5, min=0, max=1, modifier=false, summary=true)
735    @Description(shortDefinition="What document is being referenced", formalDefinition="The document being referenced, represented as an attachment. This is exclusive with the resource element." )
736    protected Attachment document;
737
738    /**
739     * The related artifact, such as a library, value set, profile, or other knowledge resource.
740     */
741    @Child(name = "resource", type = {CanonicalType.class}, order=6, min=0, max=1, modifier=false, summary=true)
742    @Description(shortDefinition="What artifact is being referenced", formalDefinition="The related artifact, such as a library, value set, profile, or other knowledge resource." )
743    protected CanonicalType resource;
744
745    /**
746     * The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.
747     */
748    @Child(name = "resourceReference", type = {Reference.class}, order=7, min=0, max=1, modifier=false, summary=true)
749    @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." )
750    protected Reference resourceReference;
751
752    /**
753     * The publication status of the artifact being referred to.
754     */
755    @Child(name = "publicationStatus", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
756    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The publication status of the artifact being referred to." )
757    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
758    protected Enumeration<PublicationStatus> publicationStatus;
759
760    /**
761     * The date of publication of the artifact being referred to.
762     */
763    @Child(name = "publicationDate", type = {DateType.class}, order=9, min=0, max=1, modifier=false, summary=true)
764    @Description(shortDefinition="Date of publication of the artifact being referred to", formalDefinition="The date of publication of the artifact being referred to." )
765    protected DateType publicationDate;
766
767    private static final long serialVersionUID = 556640693L;
768
769  /**
770   * Constructor
771   */
772    public RelatedArtifact() {
773      super();
774    }
775
776  /**
777   * Constructor
778   */
779    public RelatedArtifact(RelatedArtifactType type) {
780      super();
781      this.setType(type);
782    }
783
784    /**
785     * @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
786     */
787    public Enumeration<RelatedArtifactType> getTypeElement() { 
788      if (this.type == null)
789        if (Configuration.errorOnAutoCreate())
790          throw new Error("Attempt to auto-create RelatedArtifact.type");
791        else if (Configuration.doAutoCreate())
792          this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory()); // bb
793      return this.type;
794    }
795
796    public boolean hasTypeElement() { 
797      return this.type != null && !this.type.isEmpty();
798    }
799
800    public boolean hasType() { 
801      return this.type != null && !this.type.isEmpty();
802    }
803
804    /**
805     * @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
806     */
807    public RelatedArtifact setTypeElement(Enumeration<RelatedArtifactType> value) { 
808      this.type = value;
809      return this;
810    }
811
812    /**
813     * @return The type of relationship to the related artifact.
814     */
815    public RelatedArtifactType getType() { 
816      return this.type == null ? null : this.type.getValue();
817    }
818
819    /**
820     * @param value The type of relationship to the related artifact.
821     */
822    public RelatedArtifact setType(RelatedArtifactType value) { 
823        if (this.type == null)
824          this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory());
825        this.type.setValue(value);
826      return this;
827    }
828
829    /**
830     * @return {@link #classifier} (Provides additional classifiers of the related artifact.)
831     */
832    public List<CodeableConcept> getClassifier() { 
833      if (this.classifier == null)
834        this.classifier = new ArrayList<CodeableConcept>();
835      return this.classifier;
836    }
837
838    /**
839     * @return Returns a reference to <code>this</code> for easy method chaining
840     */
841    public RelatedArtifact setClassifier(List<CodeableConcept> theClassifier) { 
842      this.classifier = theClassifier;
843      return this;
844    }
845
846    public boolean hasClassifier() { 
847      if (this.classifier == null)
848        return false;
849      for (CodeableConcept item : this.classifier)
850        if (!item.isEmpty())
851          return true;
852      return false;
853    }
854
855    public CodeableConcept addClassifier() { //3
856      CodeableConcept t = new CodeableConcept();
857      if (this.classifier == null)
858        this.classifier = new ArrayList<CodeableConcept>();
859      this.classifier.add(t);
860      return t;
861    }
862
863    public RelatedArtifact addClassifier(CodeableConcept t) { //3
864      if (t == null)
865        return this;
866      if (this.classifier == null)
867        this.classifier = new ArrayList<CodeableConcept>();
868      this.classifier.add(t);
869      return this;
870    }
871
872    /**
873     * @return The first repetition of repeating field {@link #classifier}, creating it if it does not already exist {3}
874     */
875    public CodeableConcept getClassifierFirstRep() { 
876      if (getClassifier().isEmpty()) {
877        addClassifier();
878      }
879      return getClassifier().get(0);
880    }
881
882    /**
883     * @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
884     */
885    public StringType getLabelElement() { 
886      if (this.label == null)
887        if (Configuration.errorOnAutoCreate())
888          throw new Error("Attempt to auto-create RelatedArtifact.label");
889        else if (Configuration.doAutoCreate())
890          this.label = new StringType(); // bb
891      return this.label;
892    }
893
894    public boolean hasLabelElement() { 
895      return this.label != null && !this.label.isEmpty();
896    }
897
898    public boolean hasLabel() { 
899      return this.label != null && !this.label.isEmpty();
900    }
901
902    /**
903     * @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
904     */
905    public RelatedArtifact setLabelElement(StringType value) { 
906      this.label = value;
907      return this;
908    }
909
910    /**
911     * @return A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
912     */
913    public String getLabel() { 
914      return this.label == null ? null : this.label.getValue();
915    }
916
917    /**
918     * @param value A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index.
919     */
920    public RelatedArtifact setLabel(String value) { 
921      if (Utilities.noString(value))
922        this.label = null;
923      else {
924        if (this.label == null)
925          this.label = new StringType();
926        this.label.setValue(value);
927      }
928      return this;
929    }
930
931    /**
932     * @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
933     */
934    public StringType getDisplayElement() { 
935      if (this.display == null)
936        if (Configuration.errorOnAutoCreate())
937          throw new Error("Attempt to auto-create RelatedArtifact.display");
938        else if (Configuration.doAutoCreate())
939          this.display = new StringType(); // bb
940      return this.display;
941    }
942
943    public boolean hasDisplayElement() { 
944      return this.display != null && !this.display.isEmpty();
945    }
946
947    public boolean hasDisplay() { 
948      return this.display != null && !this.display.isEmpty();
949    }
950
951    /**
952     * @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
953     */
954    public RelatedArtifact setDisplayElement(StringType value) { 
955      this.display = value;
956      return this;
957    }
958
959    /**
960     * @return A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
961     */
962    public String getDisplay() { 
963      return this.display == null ? null : this.display.getValue();
964    }
965
966    /**
967     * @param value A brief description of the document or knowledge resource being referenced, suitable for display to a consumer.
968     */
969    public RelatedArtifact setDisplay(String value) { 
970      if (Utilities.noString(value))
971        this.display = null;
972      else {
973        if (this.display == null)
974          this.display = new StringType();
975        this.display.setValue(value);
976      }
977      return this;
978    }
979
980    /**
981     * @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
982     */
983    public MarkdownType getCitationElement() { 
984      if (this.citation == null)
985        if (Configuration.errorOnAutoCreate())
986          throw new Error("Attempt to auto-create RelatedArtifact.citation");
987        else if (Configuration.doAutoCreate())
988          this.citation = new MarkdownType(); // bb
989      return this.citation;
990    }
991
992    public boolean hasCitationElement() { 
993      return this.citation != null && !this.citation.isEmpty();
994    }
995
996    public boolean hasCitation() { 
997      return this.citation != null && !this.citation.isEmpty();
998    }
999
1000    /**
1001     * @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
1002     */
1003    public RelatedArtifact setCitationElement(MarkdownType value) { 
1004      this.citation = value;
1005      return this;
1006    }
1007
1008    /**
1009     * @return A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
1010     */
1011    public String getCitation() { 
1012      return this.citation == null ? null : this.citation.getValue();
1013    }
1014
1015    /**
1016     * @param value A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format.
1017     */
1018    public RelatedArtifact setCitation(String value) { 
1019      if (Utilities.noString(value))
1020        this.citation = null;
1021      else {
1022        if (this.citation == null)
1023          this.citation = new MarkdownType();
1024        this.citation.setValue(value);
1025      }
1026      return this;
1027    }
1028
1029    /**
1030     * @return {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.)
1031     */
1032    public Attachment getDocument() { 
1033      if (this.document == null)
1034        if (Configuration.errorOnAutoCreate())
1035          throw new Error("Attempt to auto-create RelatedArtifact.document");
1036        else if (Configuration.doAutoCreate())
1037          this.document = new Attachment(); // cc
1038      return this.document;
1039    }
1040
1041    public boolean hasDocument() { 
1042      return this.document != null && !this.document.isEmpty();
1043    }
1044
1045    /**
1046     * @param value {@link #document} (The document being referenced, represented as an attachment. This is exclusive with the resource element.)
1047     */
1048    public RelatedArtifact setDocument(Attachment value) { 
1049      this.document = value;
1050      return this;
1051    }
1052
1053    /**
1054     * @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
1055     */
1056    public CanonicalType getResourceElement() { 
1057      if (this.resource == null)
1058        if (Configuration.errorOnAutoCreate())
1059          throw new Error("Attempt to auto-create RelatedArtifact.resource");
1060        else if (Configuration.doAutoCreate())
1061          this.resource = new CanonicalType(); // bb
1062      return this.resource;
1063    }
1064
1065    public boolean hasResourceElement() { 
1066      return this.resource != null && !this.resource.isEmpty();
1067    }
1068
1069    public boolean hasResource() { 
1070      return this.resource != null && !this.resource.isEmpty();
1071    }
1072
1073    /**
1074     * @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
1075     */
1076    public RelatedArtifact setResourceElement(CanonicalType value) { 
1077      this.resource = value;
1078      return this;
1079    }
1080
1081    /**
1082     * @return The related artifact, such as a library, value set, profile, or other knowledge resource.
1083     */
1084    public String getResource() { 
1085      return this.resource == null ? null : this.resource.getValue();
1086    }
1087
1088    /**
1089     * @param value The related artifact, such as a library, value set, profile, or other knowledge resource.
1090     */
1091    public RelatedArtifact setResource(String value) { 
1092      if (Utilities.noString(value))
1093        this.resource = null;
1094      else {
1095        if (this.resource == null)
1096          this.resource = new CanonicalType();
1097        this.resource.setValue(value);
1098      }
1099      return this;
1100    }
1101
1102    /**
1103     * @return {@link #resourceReference} (The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.)
1104     */
1105    public Reference getResourceReference() { 
1106      if (this.resourceReference == null)
1107        if (Configuration.errorOnAutoCreate())
1108          throw new Error("Attempt to auto-create RelatedArtifact.resourceReference");
1109        else if (Configuration.doAutoCreate())
1110          this.resourceReference = new Reference(); // cc
1111      return this.resourceReference;
1112    }
1113
1114    public boolean hasResourceReference() { 
1115      return this.resourceReference != null && !this.resourceReference.isEmpty();
1116    }
1117
1118    /**
1119     * @param value {@link #resourceReference} (The related artifact, if the artifact is not a canonical resource, or a resource reference to a canonical resource.)
1120     */
1121    public RelatedArtifact setResourceReference(Reference value) { 
1122      this.resourceReference = value;
1123      return this;
1124    }
1125
1126    /**
1127     * @return {@link #publicationStatus} (The publication status of the artifact being referred to.). This is the underlying object with id, value and extensions. The accessor "getPublicationStatus" gives direct access to the value
1128     */
1129    public Enumeration<PublicationStatus> getPublicationStatusElement() { 
1130      if (this.publicationStatus == null)
1131        if (Configuration.errorOnAutoCreate())
1132          throw new Error("Attempt to auto-create RelatedArtifact.publicationStatus");
1133        else if (Configuration.doAutoCreate())
1134          this.publicationStatus = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
1135      return this.publicationStatus;
1136    }
1137
1138    public boolean hasPublicationStatusElement() { 
1139      return this.publicationStatus != null && !this.publicationStatus.isEmpty();
1140    }
1141
1142    public boolean hasPublicationStatus() { 
1143      return this.publicationStatus != null && !this.publicationStatus.isEmpty();
1144    }
1145
1146    /**
1147     * @param value {@link #publicationStatus} (The publication status of the artifact being referred to.). This is the underlying object with id, value and extensions. The accessor "getPublicationStatus" gives direct access to the value
1148     */
1149    public RelatedArtifact setPublicationStatusElement(Enumeration<PublicationStatus> value) { 
1150      this.publicationStatus = value;
1151      return this;
1152    }
1153
1154    /**
1155     * @return The publication status of the artifact being referred to.
1156     */
1157    public PublicationStatus getPublicationStatus() { 
1158      return this.publicationStatus == null ? null : this.publicationStatus.getValue();
1159    }
1160
1161    /**
1162     * @param value The publication status of the artifact being referred to.
1163     */
1164    public RelatedArtifact setPublicationStatus(PublicationStatus value) { 
1165      if (value == null)
1166        this.publicationStatus = null;
1167      else {
1168        if (this.publicationStatus == null)
1169          this.publicationStatus = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
1170        this.publicationStatus.setValue(value);
1171      }
1172      return this;
1173    }
1174
1175    /**
1176     * @return {@link #publicationDate} (The date of publication of the artifact being referred to.). This is the underlying object with id, value and extensions. The accessor "getPublicationDate" gives direct access to the value
1177     */
1178    public DateType getPublicationDateElement() { 
1179      if (this.publicationDate == null)
1180        if (Configuration.errorOnAutoCreate())
1181          throw new Error("Attempt to auto-create RelatedArtifact.publicationDate");
1182        else if (Configuration.doAutoCreate())
1183          this.publicationDate = new DateType(); // bb
1184      return this.publicationDate;
1185    }
1186
1187    public boolean hasPublicationDateElement() { 
1188      return this.publicationDate != null && !this.publicationDate.isEmpty();
1189    }
1190
1191    public boolean hasPublicationDate() { 
1192      return this.publicationDate != null && !this.publicationDate.isEmpty();
1193    }
1194
1195    /**
1196     * @param value {@link #publicationDate} (The date of publication of the artifact being referred to.). This is the underlying object with id, value and extensions. The accessor "getPublicationDate" gives direct access to the value
1197     */
1198    public RelatedArtifact setPublicationDateElement(DateType value) { 
1199      this.publicationDate = value;
1200      return this;
1201    }
1202
1203    /**
1204     * @return The date of publication of the artifact being referred to.
1205     */
1206    public Date getPublicationDate() { 
1207      return this.publicationDate == null ? null : this.publicationDate.getValue();
1208    }
1209
1210    /**
1211     * @param value The date of publication of the artifact being referred to.
1212     */
1213    public RelatedArtifact setPublicationDate(Date value) { 
1214      if (value == null)
1215        this.publicationDate = null;
1216      else {
1217        if (this.publicationDate == null)
1218          this.publicationDate = new DateType();
1219        this.publicationDate.setValue(value);
1220      }
1221      return this;
1222    }
1223
1224      protected void listChildren(List<Property> children) {
1225        super.listChildren(children);
1226        children.add(new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type));
1227        children.add(new Property("classifier", "CodeableConcept", "Provides additional classifiers of the related artifact.", 0, java.lang.Integer.MAX_VALUE, classifier));
1228        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));
1229        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));
1230        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));
1231        children.add(new Property("document", "Attachment", "The document being referenced, represented as an attachment. This is exclusive with the resource element.", 0, 1, document));
1232        children.add(new Property("resource", "canonical(Any)", "The related artifact, such as a library, value set, profile, or other knowledge resource.", 0, 1, resource));
1233        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));
1234        children.add(new Property("publicationStatus", "code", "The publication status of the artifact being referred to.", 0, 1, publicationStatus));
1235        children.add(new Property("publicationDate", "date", "The date of publication of the artifact being referred to.", 0, 1, publicationDate));
1236      }
1237
1238      @Override
1239      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1240        switch (_hash) {
1241        case 3575610: /*type*/  return new Property("type", "code", "The type of relationship to the related artifact.", 0, 1, type);
1242        case -281470431: /*classifier*/  return new Property("classifier", "CodeableConcept", "Provides additional classifiers of the related artifact.", 0, java.lang.Integer.MAX_VALUE, classifier);
1243        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);
1244        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);
1245        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);
1246        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);
1247        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);
1248        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);
1249        case 616500542: /*publicationStatus*/  return new Property("publicationStatus", "code", "The publication status of the artifact being referred to.", 0, 1, publicationStatus);
1250        case 1470566394: /*publicationDate*/  return new Property("publicationDate", "date", "The date of publication of the artifact being referred to.", 0, 1, publicationDate);
1251        default: return super.getNamedProperty(_hash, _name, _checkValid);
1252        }
1253
1254      }
1255
1256      @Override
1257      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1258        switch (hash) {
1259        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<RelatedArtifactType>
1260        case -281470431: /*classifier*/ return this.classifier == null ? new Base[0] : this.classifier.toArray(new Base[this.classifier.size()]); // CodeableConcept
1261        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
1262        case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType
1263        case -1442706713: /*citation*/ return this.citation == null ? new Base[0] : new Base[] {this.citation}; // MarkdownType
1264        case 861720859: /*document*/ return this.document == null ? new Base[0] : new Base[] {this.document}; // Attachment
1265        case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // CanonicalType
1266        case -610120995: /*resourceReference*/ return this.resourceReference == null ? new Base[0] : new Base[] {this.resourceReference}; // Reference
1267        case 616500542: /*publicationStatus*/ return this.publicationStatus == null ? new Base[0] : new Base[] {this.publicationStatus}; // Enumeration<PublicationStatus>
1268        case 1470566394: /*publicationDate*/ return this.publicationDate == null ? new Base[0] : new Base[] {this.publicationDate}; // DateType
1269        default: return super.getProperty(hash, name, checkValid);
1270        }
1271
1272      }
1273
1274      @Override
1275      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1276        switch (hash) {
1277        case 3575610: // type
1278          value = new RelatedArtifactTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1279          this.type = (Enumeration) value; // Enumeration<RelatedArtifactType>
1280          return value;
1281        case -281470431: // classifier
1282          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1283          return value;
1284        case 102727412: // label
1285          this.label = TypeConvertor.castToString(value); // StringType
1286          return value;
1287        case 1671764162: // display
1288          this.display = TypeConvertor.castToString(value); // StringType
1289          return value;
1290        case -1442706713: // citation
1291          this.citation = TypeConvertor.castToMarkdown(value); // MarkdownType
1292          return value;
1293        case 861720859: // document
1294          this.document = TypeConvertor.castToAttachment(value); // Attachment
1295          return value;
1296        case -341064690: // resource
1297          this.resource = TypeConvertor.castToCanonical(value); // CanonicalType
1298          return value;
1299        case -610120995: // resourceReference
1300          this.resourceReference = TypeConvertor.castToReference(value); // Reference
1301          return value;
1302        case 616500542: // publicationStatus
1303          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1304          this.publicationStatus = (Enumeration) value; // Enumeration<PublicationStatus>
1305          return value;
1306        case 1470566394: // publicationDate
1307          this.publicationDate = TypeConvertor.castToDate(value); // DateType
1308          return value;
1309        default: return super.setProperty(hash, name, value);
1310        }
1311
1312      }
1313
1314      @Override
1315      public Base setProperty(String name, Base value) throws FHIRException {
1316        if (name.equals("type")) {
1317          value = new RelatedArtifactTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1318          this.type = (Enumeration) value; // Enumeration<RelatedArtifactType>
1319        } else if (name.equals("classifier")) {
1320          this.getClassifier().add(TypeConvertor.castToCodeableConcept(value));
1321        } else if (name.equals("label")) {
1322          this.label = TypeConvertor.castToString(value); // StringType
1323        } else if (name.equals("display")) {
1324          this.display = TypeConvertor.castToString(value); // StringType
1325        } else if (name.equals("citation")) {
1326          this.citation = TypeConvertor.castToMarkdown(value); // MarkdownType
1327        } else if (name.equals("document")) {
1328          this.document = TypeConvertor.castToAttachment(value); // Attachment
1329        } else if (name.equals("resource")) {
1330          this.resource = TypeConvertor.castToCanonical(value); // CanonicalType
1331        } else if (name.equals("resourceReference")) {
1332          this.resourceReference = TypeConvertor.castToReference(value); // Reference
1333        } else if (name.equals("publicationStatus")) {
1334          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1335          this.publicationStatus = (Enumeration) value; // Enumeration<PublicationStatus>
1336        } else if (name.equals("publicationDate")) {
1337          this.publicationDate = TypeConvertor.castToDate(value); // DateType
1338        } else
1339          return super.setProperty(name, value);
1340        return value;
1341      }
1342
1343      @Override
1344      public Base makeProperty(int hash, String name) throws FHIRException {
1345        switch (hash) {
1346        case 3575610:  return getTypeElement();
1347        case -281470431:  return addClassifier(); 
1348        case 102727412:  return getLabelElement();
1349        case 1671764162:  return getDisplayElement();
1350        case -1442706713:  return getCitationElement();
1351        case 861720859:  return getDocument();
1352        case -341064690:  return getResourceElement();
1353        case -610120995:  return getResourceReference();
1354        case 616500542:  return getPublicationStatusElement();
1355        case 1470566394:  return getPublicationDateElement();
1356        default: return super.makeProperty(hash, name);
1357        }
1358
1359      }
1360
1361      @Override
1362      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1363        switch (hash) {
1364        case 3575610: /*type*/ return new String[] {"code"};
1365        case -281470431: /*classifier*/ return new String[] {"CodeableConcept"};
1366        case 102727412: /*label*/ return new String[] {"string"};
1367        case 1671764162: /*display*/ return new String[] {"string"};
1368        case -1442706713: /*citation*/ return new String[] {"markdown"};
1369        case 861720859: /*document*/ return new String[] {"Attachment"};
1370        case -341064690: /*resource*/ return new String[] {"canonical"};
1371        case -610120995: /*resourceReference*/ return new String[] {"Reference"};
1372        case 616500542: /*publicationStatus*/ return new String[] {"code"};
1373        case 1470566394: /*publicationDate*/ return new String[] {"date"};
1374        default: return super.getTypesForProperty(hash, name);
1375        }
1376
1377      }
1378
1379      @Override
1380      public Base addChild(String name) throws FHIRException {
1381        if (name.equals("type")) {
1382          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.type");
1383        }
1384        else if (name.equals("classifier")) {
1385          return addClassifier();
1386        }
1387        else if (name.equals("label")) {
1388          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.label");
1389        }
1390        else if (name.equals("display")) {
1391          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.display");
1392        }
1393        else if (name.equals("citation")) {
1394          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.citation");
1395        }
1396        else if (name.equals("document")) {
1397          this.document = new Attachment();
1398          return this.document;
1399        }
1400        else if (name.equals("resource")) {
1401          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.resource");
1402        }
1403        else if (name.equals("resourceReference")) {
1404          this.resourceReference = new Reference();
1405          return this.resourceReference;
1406        }
1407        else if (name.equals("publicationStatus")) {
1408          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.publicationStatus");
1409        }
1410        else if (name.equals("publicationDate")) {
1411          throw new FHIRException("Cannot call addChild on a singleton property RelatedArtifact.publicationDate");
1412        }
1413        else
1414          return super.addChild(name);
1415      }
1416
1417  public String fhirType() {
1418    return "RelatedArtifact";
1419
1420  }
1421
1422      public RelatedArtifact copy() {
1423        RelatedArtifact dst = new RelatedArtifact();
1424        copyValues(dst);
1425        return dst;
1426      }
1427
1428      public void copyValues(RelatedArtifact dst) {
1429        super.copyValues(dst);
1430        dst.type = type == null ? null : type.copy();
1431        if (classifier != null) {
1432          dst.classifier = new ArrayList<CodeableConcept>();
1433          for (CodeableConcept i : classifier)
1434            dst.classifier.add(i.copy());
1435        };
1436        dst.label = label == null ? null : label.copy();
1437        dst.display = display == null ? null : display.copy();
1438        dst.citation = citation == null ? null : citation.copy();
1439        dst.document = document == null ? null : document.copy();
1440        dst.resource = resource == null ? null : resource.copy();
1441        dst.resourceReference = resourceReference == null ? null : resourceReference.copy();
1442        dst.publicationStatus = publicationStatus == null ? null : publicationStatus.copy();
1443        dst.publicationDate = publicationDate == null ? null : publicationDate.copy();
1444      }
1445
1446      protected RelatedArtifact typedCopy() {
1447        return copy();
1448      }
1449
1450      @Override
1451      public boolean equalsDeep(Base other_) {
1452        if (!super.equalsDeep(other_))
1453          return false;
1454        if (!(other_ instanceof RelatedArtifact))
1455          return false;
1456        RelatedArtifact o = (RelatedArtifact) other_;
1457        return compareDeep(type, o.type, true) && compareDeep(classifier, o.classifier, true) && compareDeep(label, o.label, true)
1458           && compareDeep(display, o.display, true) && compareDeep(citation, o.citation, true) && compareDeep(document, o.document, true)
1459           && compareDeep(resource, o.resource, true) && compareDeep(resourceReference, o.resourceReference, true)
1460           && compareDeep(publicationStatus, o.publicationStatus, true) && compareDeep(publicationDate, o.publicationDate, true)
1461          ;
1462      }
1463
1464      @Override
1465      public boolean equalsShallow(Base other_) {
1466        if (!super.equalsShallow(other_))
1467          return false;
1468        if (!(other_ instanceof RelatedArtifact))
1469          return false;
1470        RelatedArtifact o = (RelatedArtifact) other_;
1471        return compareValues(type, o.type, true) && compareValues(label, o.label, true) && compareValues(display, o.display, true)
1472           && compareValues(citation, o.citation, true) && compareValues(resource, o.resource, true) && compareValues(publicationStatus, o.publicationStatus, true)
1473           && compareValues(publicationDate, o.publicationDate, true);
1474      }
1475
1476      public boolean isEmpty() {
1477        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, classifier, label
1478          , display, citation, document, resource, resourceReference, publicationStatus, publicationDate
1479          );
1480      }
1481
1482
1483}
1484