001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ElementDefinition30_50;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Coding30_50;
009import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
010import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
011import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50;
012import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Id30_50;
013import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50;
014import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
015import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
016import org.hl7.fhir.exceptions.FHIRException;
017import org.hl7.fhir.utilities.Utilities;
018
019public class StructureDefinition30_50 {
020
021  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.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.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextTypeEnumFactory());
025    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
026    switch (src.getValue()) {
027      case RESOURCE:
028        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT);
029        break;
030      case DATATYPE:
031        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT);
032        break;
033      case EXTENSION:
034        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION);
035        break;
036      default:
037        tgt.setValue(org.hl7.fhir.r5.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.r5.model.Enumeration<org.hl7.fhir.r5.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_50.INSTANCE.getVersionConvertor_30_50().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.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException {
071    if (src == null)
072      return null;
073    org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition();
074    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
075    if (src.hasUrl())
076      tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
077    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
078      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
079    if (src.hasVersion())
080      tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
081    if (src.hasName())
082      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
083    if (src.hasTitle())
084      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
085    if (src.hasStatus())
086      tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
087    if (src.hasExperimental())
088      tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
089    if (src.hasDate())
090      tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
091    if (src.hasPublisher())
092      tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
093    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
094      tgt.addContact(ContactDetail30_50.convertContactDetail(t));
095    if (src.hasDescription())
096      tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
097    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
098      tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
099    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
100      tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
101    if (src.hasPurpose())
102      tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
103    if (src.hasCopyright())
104      tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
105    for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) tgt.addKeyword(Coding30_50.convertCoding(t));
106    if (src.hasFhirVersion())
107      tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion()));
108    for (org.hl7.fhir.dstu3.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_50.convertBoolean(src.getAbstractElement()));
114    for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) {
115      org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext();
116      ec.setTypeElement(convertExtensionContext(src.getContextTypeElement()));
117      ec.setExpression("*".equals(t.getValue()) ? "Element" : t.getValue());
118    }
119    for (org.hl7.fhir.dstu3.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    if (tgt.getDerivation() == org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION) {
131      for (org.hl7.fhir.r5.model.ElementDefinition ed : tgt.getSnapshot().getElement()) {
132        if (!ed.hasBase()) {
133          ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax());
134        }
135      }
136    }
137    return tgt;
138  }
139
140  public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException {
141    if (src == null)
142      return null;
143    org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition();
144    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
145    if (src.hasUrl())
146      tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
147    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
148      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
149    if (src.hasVersion())
150      tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
151    if (src.hasName())
152      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
153    if (src.hasTitle())
154      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
155    if (src.hasStatus())
156      tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
157    if (src.hasExperimental())
158      tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
159    if (src.hasDate())
160      tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
161    if (src.hasPublisher())
162      tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
163    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
164      tgt.addContact(ContactDetail30_50.convertContactDetail(t));
165    if (src.hasDescription())
166      tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
167    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
168      tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
169    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
170      tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
171    if (src.hasPurpose())
172      tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
173    if (src.hasCopyright())
174      tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
175    for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) tgt.addKeyword(Coding30_50.convertCoding(t));
176    if (src.hasFhirVersion())
177      tgt.setFhirVersion(src.getFhirVersion().toCode());
178    for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
179      tgt.addMapping(convertStructureDefinitionMappingComponent(t));
180    if (src.hasKind())
181      tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement()));
182    if (src.hasAbstract())
183      tgt.setAbstractElement(Boolean30_50.convertBoolean(src.getAbstractElement()));
184    for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
185      if (!tgt.hasContextType())
186        tgt.setContextTypeElement(convertExtensionContext(t.getTypeElement(), t.getExpression()));
187      tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression());
188    }
189    for (org.hl7.fhir.r5.model.StringType t : src.getContextInvariant()) tgt.addContextInvariant(t.getValue());
190    if (src.hasType())
191      tgt.setType(src.getType());
192    if (src.hasBaseDefinition())
193      tgt.setBaseDefinition(src.getBaseDefinition());
194    if (src.hasDerivation())
195      tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement()));
196    if (src.hasSnapshot())
197      tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
198    if (src.hasDifferential())
199      tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
200    return tgt;
201  }
202
203  public static org.hl7.fhir.r5.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.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent();
207    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
208    for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement())
209      tgt.addElement(ElementDefinition30_50.convertElementDefinition(t));
210    return tgt;
211  }
212
213  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.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_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
218    for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement())
219      tgt.addElement(ElementDefinition30_50.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.r5.model.Enumeration<org.hl7.fhir.r5.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_50.INSTANCE.getVersionConvertor_30_50().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.r5.model.Enumeration<org.hl7.fhir.r5.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.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKindEnumFactory());
252    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
253    switch (src.getValue()) {
254      case PRIMITIVETYPE:
255        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE);
256        break;
257      case COMPLEXTYPE:
258        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE);
259        break;
260      case RESOURCE:
261        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE);
262        break;
263      case LOGICAL:
264        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL);
265        break;
266      default:
267        tgt.setValue(org.hl7.fhir.r5.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.r5.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_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
278    if (src.hasIdentity())
279      tgt.setIdentityElement(Id30_50.convertId(src.getIdentityElement()));
280    if (src.hasUri())
281      tgt.setUriElement(Uri30_50.convertUri(src.getUriElement()));
282    if (src.hasName())
283      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
284    if (src.hasComment())
285      tgt.setCommentElement(String30_50.convertString(src.getCommentElement()));
286    return tgt;
287  }
288
289  public static org.hl7.fhir.r5.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.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent();
293    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
294    if (src.hasIdentity())
295      tgt.setIdentityElement(Id30_50.convertId(src.getIdentityElement()));
296    if (src.hasUri())
297      tgt.setUriElement(Uri30_50.convertUri(src.getUriElement()));
298    if (src.hasName())
299      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
300    if (src.hasComment())
301      tgt.setCommentElement(String30_50.convertString(src.getCommentElement()));
302    return tgt;
303  }
304
305  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.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_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
310    for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement())
311      tgt.addElement(ElementDefinition30_50.convertElementDefinition(t));
312    return tgt;
313  }
314
315  public static org.hl7.fhir.r5.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.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent();
319    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
320    for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement())
321      tgt.addElement(ElementDefinition30_50.convertElementDefinition(t));
322    return tgt;
323  }
324
325  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.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.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRuleEnumFactory());
329    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
330    switch (src.getValue()) {
331      case SPECIALIZATION:
332        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION);
333        break;
334      case CONSTRAINT:
335        tgt.setValue(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT);
336        break;
337      default:
338        tgt.setValue(org.hl7.fhir.r5.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.r5.model.Enumeration<org.hl7.fhir.r5.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_50.INSTANCE.getVersionConvertor_30_50().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, "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}