001package org.hl7.fhir.convertors.conv14_30.resources14_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext14_30;
004import org.hl7.fhir.convertors.conv14_30.VersionConvertor_14_30;
005import org.hl7.fhir.convertors.conv14_30.datatypes14_30.ElementDefinition14_30;
006import org.hl7.fhir.convertors.conv14_30.datatypes14_30.complextypes14_30.CodeableConcept14_30;
007import org.hl7.fhir.convertors.conv14_30.datatypes14_30.complextypes14_30.ContactPoint14_30;
008import org.hl7.fhir.convertors.conv14_30.datatypes14_30.complextypes14_30.Identifier14_30;
009import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Boolean14_30;
010import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Code14_30;
011import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.DateTime14_30;
012import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Id14_30;
013import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.String14_30;
014import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Uri14_30;
015import org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule;
016import org.hl7.fhir.dstu3.model.Enumeration;
017import org.hl7.fhir.dstu3.model.StructureDefinition;
018import org.hl7.fhir.exceptions.FHIRException;
019
020public class StructureDefinition14_30 {
021
022  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> convertExtensionContext(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext> src) throws FHIRException {
023      if (src == null || src.isEmpty())
024          return null;
025      Enumeration<StructureDefinition.ExtensionContext> tgt = new Enumeration<>(new StructureDefinition.ExtensionContextEnumFactory());
026      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
027      if (src.getValue() == null) {
028          tgt.setValue(null);
029      } else {
030          switch (src.getValue()) {
031              case RESOURCE:
032                  tgt.setValue(StructureDefinition.ExtensionContext.RESOURCE);
033                  break;
034              case DATATYPE:
035                  tgt.setValue(StructureDefinition.ExtensionContext.DATATYPE);
036                  break;
037              case EXTENSION:
038                  tgt.setValue(StructureDefinition.ExtensionContext.EXTENSION);
039                  break;
040              default:
041                  tgt.setValue(StructureDefinition.ExtensionContext.NULL);
042                  break;
043          }
044      }
045      return tgt;
046  }
047
048  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext> convertExtensionContext(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext> src) throws FHIRException {
049      if (src == null || src.isEmpty())
050          return null;
051      org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContextEnumFactory());
052      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
053      if (src.getValue() == null) {
054          tgt.setValue(null);
055      } else {
056          switch (src.getValue()) {
057              case RESOURCE:
058                  tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE);
059                  break;
060              case DATATYPE:
061                  tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE);
062                  break;
063              case EXTENSION:
064                  tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION);
065                  break;
066              default:
067                  tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL);
068                  break;
069          }
070      }
071      return tgt;
072  }
073
074  public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException {
075    if (src == null || src.isEmpty())
076      return null;
077    org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition();
078    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyDomainResource(src, tgt);
079    if (src.hasUrl())
080      tgt.setUrlElement(Uri14_30.convertUri(src.getUrlElement()));
081    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
082      tgt.addIdentifier(Identifier14_30.convertIdentifier(t));
083    if (src.hasVersion())
084      tgt.setVersionElement(String14_30.convertString(src.getVersionElement()));
085    if (src.hasNameElement())
086      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
087    if (src.hasTitle())
088      tgt.setDisplayElement(String14_30.convertString(src.getTitleElement()));
089    if (src.hasStatus())
090      tgt.setStatusElement(Enumerations14_30.convertConformanceResourceStatus(src.getStatusElement()));
091    if (src.hasExperimental())
092      tgt.setExperimentalElement(Boolean14_30.convertBoolean(src.getExperimentalElement()));
093    if (src.hasPublisher())
094      tgt.setPublisherElement(String14_30.convertString(src.getPublisherElement()));
095    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
096      tgt.addContact(convertStructureDefinitionContactComponent(t));
097    if (src.hasDate())
098      tgt.setDateElement(DateTime14_30.convertDateTime(src.getDateElement()));
099    if (src.hasDescription())
100      tgt.setDescription(src.getDescription());
101    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
102      if (t.hasValueCodeableConcept())
103        tgt.addUseContext(CodeableConcept14_30.convertCodeableConcept(t.getValueCodeableConcept()));
104    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
105      tgt.addUseContext(CodeableConcept14_30.convertCodeableConcept(t));
106    if (src.hasPurpose())
107      tgt.setRequirements(src.getPurpose());
108    if (src.hasCopyright())
109      tgt.setCopyright(src.getCopyright());
110    for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) tgt.addCode(Code14_30.convertCoding(t));
111    if (src.hasFhirVersion())
112      tgt.setFhirVersionElement(Id14_30.convertId(src.getFhirVersionElement()));
113    for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
114      tgt.addMapping(convertStructureDefinitionMappingComponent(t));
115    if (src.hasKind())
116      tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement()));
117    if (src.hasAbstractElement())
118      tgt.setAbstractElement(Boolean14_30.convertBoolean(src.getAbstractElement()));
119    if (src.hasContextType())
120      tgt.setContextTypeElement(convertExtensionContext(src.getContextTypeElement()));
121    for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) tgt.addContext(t.getValue());
122    if (src.hasBaseDefinition())
123      tgt.setBaseDefinitionElement(Uri14_30.convertUri(src.getBaseDefinitionElement()));
124    if (src.hasType() && src.getDerivation() == org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT)
125      tgt.setBaseTypeElement(Code14_30.convertCode(src.getTypeElement()));
126    if (src.hasDerivation())
127      tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement()));
128    if (src.hasSnapshot())
129      tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
130    if (src.hasDifferential())
131      tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
132    return tgt;
133  }
134
135  public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException {
136    if (src == null || src.isEmpty())
137      return null;
138    org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition();
139    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyDomainResource(src, tgt);
140    if (src.hasUrl())
141      tgt.setUrlElement(Uri14_30.convertUri(src.getUrlElement()));
142    for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier())
143      tgt.addIdentifier(Identifier14_30.convertIdentifier(t));
144    if (src.hasVersion())
145      tgt.setVersionElement(String14_30.convertString(src.getVersionElement()));
146    if (src.hasNameElement())
147      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
148    if (src.hasDisplay())
149      tgt.setTitleElement(String14_30.convertString(src.getDisplayElement()));
150    if (src.hasStatus())
151      tgt.setStatusElement(Enumerations14_30.convertConformanceResourceStatus(src.getStatusElement()));
152    if (src.hasExperimental())
153      tgt.setExperimentalElement(Boolean14_30.convertBoolean(src.getExperimentalElement()));
154    if (src.hasPublisher())
155      tgt.setPublisherElement(String14_30.convertString(src.getPublisherElement()));
156    for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact())
157      tgt.addContact(convertStructureDefinitionContactComponent(t));
158    if (src.hasDate())
159      tgt.setDateElement(DateTime14_30.convertDateTime(src.getDateElement()));
160    if (src.hasDescription())
161      tgt.setDescription(src.getDescription());
162    for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext())
163      if (VersionConvertor_14_30.isJurisdiction(t))
164        tgt.addJurisdiction(CodeableConcept14_30.convertCodeableConcept(t));
165      else
166        tgt.addUseContext(CodeableConcept14_30.convertCodeableConceptToUsageContext(t));
167    if (src.hasRequirements())
168      tgt.setPurpose(src.getRequirements());
169    if (src.hasCopyright())
170      tgt.setCopyright(src.getCopyright());
171    for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) tgt.addKeyword(Code14_30.convertCoding(t));
172    if (src.hasFhirVersion())
173      tgt.setFhirVersionElement(Id14_30.convertId(src.getFhirVersionElement()));
174    for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
175      tgt.addMapping(convertStructureDefinitionMappingComponent(t));
176    if (src.hasKind())
177      tgt.setKindElement(convertStructureDefinitionKind(src.getKindElement()));
178    if (src.hasAbstractElement())
179      tgt.setAbstractElement(Boolean14_30.convertBoolean(src.getAbstractElement()));
180    if (src.hasContextType())
181      tgt.setContextTypeElement(convertExtensionContext(src.getContextTypeElement()));
182    for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) tgt.addContext(t.getValue());
183    if (src.getDerivation() == TypeDerivationRule.CONSTRAINT)
184      tgt.setTypeElement(Code14_30.convertCode(src.getBaseTypeElement()));
185    else
186      tgt.setType(src.getId());
187    if (src.hasBaseDefinition())
188      tgt.setBaseDefinitionElement(Uri14_30.convertUri(src.getBaseDefinitionElement()));
189    if (src.hasDerivation())
190      tgt.setDerivationElement(convertTypeDerivationRule(src.getDerivationElement()));
191    if (src.hasSnapshot()) {
192      if (src.hasSnapshot())
193        tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
194      tgt.getSnapshot().getElementFirstRep().getType().clear();
195    }
196    if (src.hasDifferential()) {
197      if (src.hasDifferential())
198        tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
199      tgt.getDifferential().getElementFirstRep().getType().clear();
200    }
201    return tgt;
202  }
203
204  public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException {
205    if (src == null || src.isEmpty())
206      return null;
207    org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent();
208    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
209    if (src.hasName())
210      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
211    for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())
212      tgt.addTelecom(ContactPoint14_30.convertContactPoint(t));
213    return tgt;
214  }
215
216  public static org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException {
217    if (src == null || src.isEmpty())
218      return null;
219    org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail();
220    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
221    if (src.hasName())
222      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
223    for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom())
224      tgt.addTelecom(ContactPoint14_30.convertContactPoint(t));
225    return tgt;
226  }
227
228  public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
229    if (src == null || src.isEmpty())
230      return null;
231    org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent();
232    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
233    for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement())
234      tgt.addElement(ElementDefinition14_30.convertElementDefinition(t));
235    return tgt;
236  }
237
238  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
239    if (src == null || src.isEmpty())
240      return null;
241    org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent();
242    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
243    for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement())
244      tgt.addElement(ElementDefinition14_30.convertElementDefinition(t));
245    return tgt;
246  }
247
248  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.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.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKindEnumFactory());
252      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
253      if (src.getValue() == null) {
254          tgt.setValue(null);
255      } else {
256          switch (src.getValue()) {
257              case PRIMITIVETYPE:
258                  tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE);
259                  break;
260              case COMPLEXTYPE:
261                  tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE);
262                  break;
263              case RESOURCE:
264                  tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE);
265                  break;
266              case LOGICAL:
267                  tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL);
268                  break;
269              default:
270                  tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL);
271                  break;
272          }
273      }
274      return tgt;
275  }
276
277  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind> convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind> src) throws FHIRException {
278      if (src == null || src.isEmpty())
279          return null;
280      Enumeration<StructureDefinition.StructureDefinitionKind> tgt = new Enumeration<>(new StructureDefinition.StructureDefinitionKindEnumFactory());
281      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
282      if (src.getValue() == null) {
283          tgt.setValue(null);
284      } else {
285          switch (src.getValue()) {
286              case DATATYPE:
287                  tgt.setValue(StructureDefinition.StructureDefinitionKind.COMPLEXTYPE);
288                  break;
289              case RESOURCE:
290                  tgt.setValue(StructureDefinition.StructureDefinitionKind.RESOURCE);
291                  break;
292              case LOGICAL:
293                  tgt.setValue(StructureDefinition.StructureDefinitionKind.LOGICAL);
294                  break;
295              default:
296                  tgt.setValue(StructureDefinition.StructureDefinitionKind.NULL);
297                  break;
298          }
299      }
300      return tgt;
301  }
302
303  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
304    if (src == null || src.isEmpty())
305      return null;
306    org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent();
307    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
308    if (src.hasIdentityElement())
309      tgt.setIdentityElement(Id14_30.convertId(src.getIdentityElement()));
310    if (src.hasUri())
311      tgt.setUriElement(Uri14_30.convertUri(src.getUriElement()));
312    if (src.hasName())
313      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
314    if (src.hasComments())
315      tgt.setCommentElement(String14_30.convertString(src.getCommentsElement()));
316    return tgt;
317  }
318
319  public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
320    if (src == null || src.isEmpty())
321      return null;
322    org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent();
323    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
324    if (src.hasIdentityElement())
325      tgt.setIdentityElement(Id14_30.convertId(src.getIdentityElement()));
326    if (src.hasUri())
327      tgt.setUriElement(Uri14_30.convertUri(src.getUriElement()));
328    if (src.hasName())
329      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
330    if (src.hasComment())
331      tgt.setCommentsElement(String14_30.convertString(src.getCommentElement()));
332    return tgt;
333  }
334
335  public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
336    if (src == null || src.isEmpty())
337      return null;
338    org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent();
339    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
340    for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement())
341      tgt.addElement(ElementDefinition14_30.convertElementDefinition(t));
342    return tgt;
343  }
344
345  public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
346    if (src == null || src.isEmpty())
347      return null;
348    org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent();
349    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
350    for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement())
351      tgt.addElement(ElementDefinition14_30.convertElementDefinition(t));
352    return tgt;
353  }
354
355  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException {
356      if (src == null || src.isEmpty())
357          return null;
358      Enumeration<StructureDefinition.TypeDerivationRule> tgt = new Enumeration<>(new StructureDefinition.TypeDerivationRuleEnumFactory());
359      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
360      if (src.getValue() == null) {
361          tgt.setValue(null);
362      } else {
363          switch (src.getValue()) {
364              case SPECIALIZATION:
365                  tgt.setValue(StructureDefinition.TypeDerivationRule.SPECIALIZATION);
366                  break;
367              case CONSTRAINT:
368                  tgt.setValue(StructureDefinition.TypeDerivationRule.CONSTRAINT);
369                  break;
370              default:
371                  tgt.setValue(StructureDefinition.TypeDerivationRule.NULL);
372                  break;
373          }
374      }
375      return tgt;
376  }
377
378  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule> convertTypeDerivationRule(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule> src) throws FHIRException {
379      if (src == null || src.isEmpty())
380          return null;
381      org.hl7.fhir.dstu2016may.model.Enumeration<TypeDerivationRule> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRuleEnumFactory());
382      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
383      if (src.getValue() == null) {
384          tgt.setValue(null);
385      } else {
386          switch (src.getValue()) {
387              case SPECIALIZATION:
388                  tgt.setValue(TypeDerivationRule.SPECIALIZATION);
389                  break;
390              case CONSTRAINT:
391                  tgt.setValue(TypeDerivationRule.CONSTRAINT);
392                  break;
393              default:
394                  tgt.setValue(TypeDerivationRule.NULL);
395                  break;
396          }
397      }
398      return tgt;
399  }
400}