001package org.hl7.fhir.convertors.conv30_40.resources30_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_40;
004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.ContactDetail30_40;
005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.ElementDefinition30_40;
006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40;
007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Coding30_40;
008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40;
009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Timing30_40;
010import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Boolean30_40;
011import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.DateTime30_40;
012import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Id30_40;
013import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.MarkDown30_40;
014import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40;
015import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Uri30_40;
016import org.hl7.fhir.exceptions.FHIRException;
017import org.hl7.fhir.utilities.Utilities;
018
019public class StructureDefinition30_40 {
020
021  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType> convertExtensionContext(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> src) throws FHIRException {
022    if (src == null || src.isEmpty())
023      return null;
024    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextTypeEnumFactory());
025    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
026    switch (src.getValue()) {
027      case RESOURCE:
028        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT);
029        break;
030      case DATATYPE:
031        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT);
032        break;
033      case EXTENSION:
034        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION);
035        break;
036      default:
037        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL);
038        break;
039    }
040    return tgt;
041  }
042
043  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> convertExtensionContext(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType> src, String expression) throws FHIRException {
044    if (src == null || src.isEmpty())
045      return null;
046    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContextEnumFactory());
047    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
048    switch (src.getValue()) {
049      case FHIRPATH:
050        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE);
051        break;
052      case ELEMENT:
053        String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression;
054        if (isResource300(tn)) {
055          tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE);
056        } else {
057          tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE);
058        }
059        break;
060      case EXTENSION:
061        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION);
062        break;
063      default:
064        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL);
065        break;
066    }
067    return tgt;
068  }
069
070  public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException {
071    if (src == null)
072      return null;
073    org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition();
074    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
075    if (src.hasUrl())
076      tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement()));
077    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
078      tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
079    if (src.hasVersion())
080      tgt.setVersionElement(String30_40.convertString(src.getVersionElement()));
081    if (src.hasName())
082      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
083    if (src.hasTitle())
084      tgt.setTitleElement(String30_40.convertString(src.getTitleElement()));
085    if (src.hasStatus())
086      tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement()));
087    if (src.hasExperimental())
088      tgt.setExperimentalElement(Boolean30_40.convertBoolean(src.getExperimentalElement()));
089    if (src.hasDateElement())
090      tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
091    if (src.hasPublisher())
092      tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement()));
093    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
094      tgt.addContact(ContactDetail30_40.convertContactDetail(t));
095    if (src.hasDescription())
096      tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement()));
097    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
098      tgt.addUseContext(Timing30_40.convertUsageContext(t));
099    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
100      tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t));
101    if (src.hasPurpose())
102      tgt.setPurposeElement(MarkDown30_40.convertMarkdown(src.getPurposeElement()));
103    if (src.hasCopyright())
104      tgt.setCopyrightElement(MarkDown30_40.convertMarkdown(src.getCopyrightElement()));
105    for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) tgt.addKeyword(Coding30_40.convertCoding(t));
106    if (src.hasFhirVersion())
107      tgt.setFhirVersion(src.getFhirVersion().toCode());
108    for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
109      tgt.addMapping(convertStructureDefinitionMappingComponent(t));
110    if (src.hasKind())
111      tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement()));
112    if (src.hasAbstract())
113      tgt.setAbstractElement(Boolean30_40.convertBoolean(src.getAbstractElement()));
114    for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
115      if (!tgt.hasContextType())
116        tgt.setContextTypeElement(convertExtensionContext(t.getTypeElement(), t.getExpression()));
117      tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression());
118    }
119    for (org.hl7.fhir.r4.model.StringType t : src.getContextInvariant()) tgt.addContextInvariant(t.getValue());
120    if (src.hasType())
121      tgt.setType(src.getType());
122    if (src.hasBaseDefinition())
123      tgt.setBaseDefinition(src.getBaseDefinition());
124    if (src.hasDerivation())
125      tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement()));
126    if (src.hasSnapshot())
127      tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
128    if (src.hasDifferential())
129      tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
130    return tgt;
131  }
132
133  public static org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException {
134    if (src == null)
135      return null;
136    org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition();
137    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
138    if (src.hasUrl())
139      tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement()));
140    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
141      tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
142    if (src.hasVersion())
143      tgt.setVersionElement(String30_40.convertString(src.getVersionElement()));
144    if (src.hasName())
145      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
146    if (src.hasTitle())
147      tgt.setTitleElement(String30_40.convertString(src.getTitleElement()));
148    if (src.hasStatus())
149      tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement()));
150    if (src.hasExperimental())
151      tgt.setExperimentalElement(Boolean30_40.convertBoolean(src.getExperimentalElement()));
152    if (src.hasDateElement())
153      tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
154    if (src.hasPublisher())
155      tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement()));
156    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
157      tgt.addContact(ContactDetail30_40.convertContactDetail(t));
158    if (src.hasDescription())
159      tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement()));
160    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
161      tgt.addUseContext(Timing30_40.convertUsageContext(t));
162    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
163      tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t));
164    if (src.hasPurpose())
165      tgt.setPurposeElement(MarkDown30_40.convertMarkdown(src.getPurposeElement()));
166    if (src.hasCopyright())
167      tgt.setCopyrightElement(MarkDown30_40.convertMarkdown(src.getCopyrightElement()));
168    for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) tgt.addKeyword(Coding30_40.convertCoding(t));
169    if (src.hasFhirVersion())
170      tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion()));
171    for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
172      tgt.addMapping(convertStructureDefinitionMappingComponent(t));
173    if (src.hasKind())
174      tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement()));
175    if (src.hasAbstract())
176      tgt.setAbstractElement(Boolean30_40.convertBoolean(src.getAbstractElement()));
177    for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) {
178      org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext();
179      ec.setTypeElement(convertExtensionContext(src.getContextTypeElement()));
180      ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue());
181    }
182    for (org.hl7.fhir.dstu3.model.StringType t : src.getContextInvariant()) tgt.addContextInvariant(t.getValue());
183    if (src.hasType())
184      tgt.setType(src.getType());
185    if (src.hasBaseDefinition())
186      tgt.setBaseDefinition(src.getBaseDefinition());
187    if (src.hasDerivation())
188      tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement()));
189    if (src.hasSnapshot())
190      tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
191    if (src.hasDifferential())
192      tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
193    if (tgt.getDerivation() == org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION) {
194      for (org.hl7.fhir.r4.model.ElementDefinition ed : tgt.getSnapshot().getElement()) {
195        if (!ed.hasBase()) {
196          ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax());
197        }
198      }
199    }
200    return tgt;
201  }
202
203  public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
204    if (src == null)
205      return null;
206    org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent();
207    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
208    for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement())
209      tgt.addElement(ElementDefinition30_40.convertElementDefinition(t));
210    return tgt;
211  }
212
213  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
214    if (src == null)
215      return null;
216    org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent();
217    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
218    for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
219      tgt.addElement(ElementDefinition30_40.convertElementDefinition(t));
220    return tgt;
221  }
222
223  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException {
224    if (src == null || src.isEmpty())
225      return null;
226    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKindEnumFactory());
227    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
228    switch (src.getValue()) {
229      case PRIMITIVETYPE:
230        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE);
231        break;
232      case COMPLEXTYPE:
233        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE);
234        break;
235      case RESOURCE:
236        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE);
237        break;
238      case LOGICAL:
239        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL);
240        break;
241      default:
242        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL);
243        break;
244    }
245    return tgt;
246  }
247
248  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException {
249    if (src == null || src.isEmpty())
250      return null;
251    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKindEnumFactory());
252    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
253    switch (src.getValue()) {
254      case PRIMITIVETYPE:
255        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE);
256        break;
257      case COMPLEXTYPE:
258        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE);
259        break;
260      case RESOURCE:
261        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE);
262        break;
263      case LOGICAL:
264        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL);
265        break;
266      default:
267        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL);
268        break;
269    }
270    return tgt;
271  }
272
273  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
274    if (src == null)
275      return null;
276    org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent();
277    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
278    if (src.hasIdentity())
279      tgt.setIdentityElement(Id30_40.convertId(src.getIdentityElement()));
280    if (src.hasUri())
281      tgt.setUriElement(Uri30_40.convertUri(src.getUriElement()));
282    if (src.hasName())
283      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
284    if (src.hasComment())
285      tgt.setCommentElement(String30_40.convertString(src.getCommentElement()));
286    return tgt;
287  }
288
289  public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
290    if (src == null)
291      return null;
292    org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent();
293    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
294    if (src.hasIdentity())
295      tgt.setIdentityElement(Id30_40.convertId(src.getIdentityElement()));
296    if (src.hasUri())
297      tgt.setUriElement(Uri30_40.convertUri(src.getUriElement()));
298    if (src.hasName())
299      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
300    if (src.hasComment())
301      tgt.setCommentElement(String30_40.convertString(src.getCommentElement()));
302    return tgt;
303  }
304
305  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
306    if (src == null)
307      return null;
308    org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent();
309    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
310    for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
311      tgt.addElement(ElementDefinition30_40.convertElementDefinition(t));
312    return tgt;
313  }
314
315  public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
316    if (src == null)
317      return null;
318    org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent();
319    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
320    for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement())
321      tgt.addElement(ElementDefinition30_40.convertElementDefinition(t));
322    return tgt;
323  }
324
325  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException {
326    if (src == null || src.isEmpty())
327      return null;
328    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRuleEnumFactory());
329    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
330    switch (src.getValue()) {
331      case SPECIALIZATION:
332        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION);
333        break;
334      case CONSTRAINT:
335        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT);
336        break;
337      default:
338        tgt.setValue(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.NULL);
339        break;
340    }
341    return tgt;
342  }
343
344  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException {
345    if (src == null || src.isEmpty())
346      return null;
347    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRuleEnumFactory());
348    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
349    switch (src.getValue()) {
350      case SPECIALIZATION:
351        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION);
352        break;
353      case CONSTRAINT:
354        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT);
355        break;
356      default:
357        tgt.setValue(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL);
358        break;
359    }
360    return tgt;
361  }
362
363  static public boolean isResource300(String tn) {
364    return Utilities.existsInList(tn, "Resource", "DomainResource", "Account", "ActivityDefinition", "AllergyIntolerance", "AdverseEvent", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CapabilityStatement", "CarePlan", "CareTeam", "ChargeItem", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "Contract", "Coverage", "DataElement", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceRequest", "DeviceUseStatement", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "Endpoint", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "GuidanceResponse", "HealthcareService", "ImagingManifest", "ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RequestGroup", "ResearchStudy", "ResearchSubject", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "ServiceDefinition", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "TestReport", "ValueSet", "VisionPrescription");
365  }
366}