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.complextypes14_30.CodeableConcept14_30;
006import org.hl7.fhir.convertors.conv14_30.datatypes14_30.complextypes14_30.ContactPoint14_30;
007import org.hl7.fhir.convertors.conv14_30.datatypes14_30.complextypes14_30.Identifier14_30;
008import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Boolean14_30;
009import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Code14_30;
010import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.DateTime14_30;
011import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.String14_30;
012import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.UnsignedInt14_30;
013import org.hl7.fhir.convertors.conv14_30.datatypes14_30.primitivetypes14_30.Uri14_30;
014import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent;
015import org.hl7.fhir.dstu3.model.CodeSystem;
016import org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator;
017import org.hl7.fhir.dstu3.model.Enumeration;
018import org.hl7.fhir.exceptions.FHIRException;
019
020public class CodeSystem14_30 {
021
022  public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException {
023    if (src == null || src.isEmpty())
024      return null;
025    org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem();
026    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyDomainResource(src, tgt);
027    if (src.hasUrl())
028      tgt.setUrlElement(Uri14_30.convertUri(src.getUrlElement()));
029    if (src.hasIdentifier())
030      tgt.setIdentifier(Identifier14_30.convertIdentifier(src.getIdentifier()));
031    if (src.hasVersion())
032      tgt.setVersionElement(String14_30.convertString(src.getVersionElement()));
033    if (src.hasName())
034      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
035    if (src.hasStatus())
036      tgt.setStatusElement(Enumerations14_30.convertConformanceResourceStatus(src.getStatusElement()));
037    if (src.hasExperimental())
038      tgt.setExperimentalElement(Boolean14_30.convertBoolean(src.getExperimentalElement()));
039    if (src.hasPublisher())
040      tgt.setPublisherElement(String14_30.convertString(src.getPublisherElement()));
041    for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact())
042      tgt.addContact(convertCodeSystemContactComponent(t));
043    if (src.hasDate())
044      tgt.setDateElement(DateTime14_30.convertDateTime(src.getDateElement()));
045    if (src.hasDescription())
046      tgt.setDescription(src.getDescription());
047    for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext())
048      if (VersionConvertor_14_30.isJurisdiction(t))
049        tgt.addJurisdiction(CodeableConcept14_30.convertCodeableConcept(t));
050      else
051        tgt.addUseContext(CodeableConcept14_30.convertCodeableConceptToUsageContext(t));
052    if (src.hasRequirements())
053      tgt.setPurpose(src.getRequirements());
054    if (src.hasCopyright())
055      tgt.setCopyright(src.getCopyright());
056    if (src.hasCaseSensitive())
057      tgt.setCaseSensitiveElement(Boolean14_30.convertBoolean(src.getCaseSensitiveElement()));
058    if (src.hasValueSet())
059      tgt.setValueSetElement(Uri14_30.convertUri(src.getValueSetElement()));
060    if (src.hasCompositional())
061      tgt.setCompositionalElement(Boolean14_30.convertBoolean(src.getCompositionalElement()));
062    if (src.hasVersionNeeded())
063      tgt.setVersionNeededElement(Boolean14_30.convertBoolean(src.getVersionNeededElement()));
064    if (src.hasContent())
065      tgt.setContentElement(convertCodeSystemContentMode(src.getContentElement()));
066    if (src.hasCount())
067      tgt.setCountElement(UnsignedInt14_30.convertUnsignedInt(src.getCountElement()));
068    for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter())
069      tgt.addFilter(convertCodeSystemFilterComponent(t));
070    for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty())
071      tgt.addProperty(convertPropertyComponent(t));
072    for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
073      tgt.addConcept(convertConceptDefinitionComponent(t));
074    return tgt;
075  }
076
077  public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException {
078    if (src == null || src.isEmpty())
079      return null;
080    org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem();
081    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyDomainResource(src, tgt);
082    if (src.hasUrl())
083      tgt.setUrlElement(Uri14_30.convertUri(src.getUrlElement()));
084    if (src.hasIdentifier())
085      tgt.setIdentifier(Identifier14_30.convertIdentifier(src.getIdentifier()));
086    if (src.hasVersion())
087      tgt.setVersionElement(String14_30.convertString(src.getVersionElement()));
088    if (src.hasName())
089      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
090    if (src.hasStatus())
091      tgt.setStatusElement(Enumerations14_30.convertConformanceResourceStatus(src.getStatusElement()));
092    if (src.hasExperimental())
093      tgt.setExperimentalElement(Boolean14_30.convertBoolean(src.getExperimentalElement()));
094    if (src.hasPublisher())
095      tgt.setPublisherElement(String14_30.convertString(src.getPublisherElement()));
096    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
097      tgt.addContact(convertCodeSystemContactComponent(t));
098    if (src.hasDate())
099      tgt.setDateElement(DateTime14_30.convertDateTime(src.getDateElement()));
100    if (src.hasDescription())
101      tgt.setDescription(src.getDescription());
102    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
103      if (t.hasValueCodeableConcept())
104        tgt.addUseContext(CodeableConcept14_30.convertCodeableConcept(t.getValueCodeableConcept()));
105    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
106      tgt.addUseContext(CodeableConcept14_30.convertCodeableConcept(t));
107    if (src.hasPurpose())
108      tgt.setRequirements(src.getPurpose());
109    if (src.hasCopyright())
110      tgt.setCopyright(src.getCopyright());
111    if (src.hasCaseSensitive())
112      tgt.setCaseSensitiveElement(Boolean14_30.convertBoolean(src.getCaseSensitiveElement()));
113    if (src.hasValueSet())
114      tgt.setValueSetElement(Uri14_30.convertUri(src.getValueSetElement()));
115    if (src.hasCompositional())
116      tgt.setCompositionalElement(Boolean14_30.convertBoolean(src.getCompositionalElement()));
117    if (src.hasVersionNeeded())
118      tgt.setVersionNeededElement(Boolean14_30.convertBoolean(src.getVersionNeededElement()));
119    if (src.hasContent())
120      tgt.setContentElement(convertCodeSystemContentMode(src.getContentElement()));
121    if (src.hasCount())
122      tgt.setCountElement(UnsignedInt14_30.convertUnsignedInt(src.getCountElement()));
123    for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter())
124      tgt.addFilter(convertCodeSystemFilterComponent(t));
125    for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty())
126      tgt.addProperty(convertPropertyComponent(t));
127    for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
128      tgt.addConcept(convertConceptDefinitionComponent(t));
129    return tgt;
130  }
131
132  public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException {
133    if (src == null || src.isEmpty())
134      return null;
135    org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent();
136    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
137    if (src.hasName())
138      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
139    for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())
140      tgt.addTelecom(ContactPoint14_30.convertContactPoint(t));
141    return tgt;
142  }
143
144  public static org.hl7.fhir.dstu3.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException {
145    if (src == null || src.isEmpty())
146      return null;
147    org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail();
148    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
149    if (src.hasName())
150      tgt.setNameElement(String14_30.convertString(src.getNameElement()));
151    for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom())
152      tgt.addTelecom(ContactPoint14_30.convertContactPoint(t));
153    return tgt;
154  }
155
156  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
157      if (src == null || src.isEmpty())
158          return null;
159      org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentModeEnumFactory());
160      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
161      if (src.getValue() == null) {
162          tgt.setValue(null);
163      } else {
164          switch (src.getValue()) {
165              case NOTPRESENT:
166                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT);
167                  break;
168              case EXAMPLE:
169                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR);
170                  break;
171              case FRAGMENT:
172                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT);
173                  break;
174              case COMPLETE:
175                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE);
176                  break;
177              default:
178                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL);
179                  break;
180          }
181      }
182      return tgt;
183  }
184
185  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
186      if (src == null || src.isEmpty())
187          return null;
188      Enumeration<CodeSystem.CodeSystemContentMode> tgt = new Enumeration<>(new CodeSystem.CodeSystemContentModeEnumFactory());
189      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
190      if (src.getValue() == null) {
191          tgt.setValue(null);
192      } else {
193          switch (src.getValue()) {
194              case NOTPRESENT:
195                  tgt.setValue(CodeSystem.CodeSystemContentMode.NOTPRESENT);
196                  break;
197              case EXAMPLAR:
198                  tgt.setValue(CodeSystem.CodeSystemContentMode.EXAMPLE);
199                  break;
200              case FRAGMENT:
201                  tgt.setValue(CodeSystem.CodeSystemContentMode.FRAGMENT);
202                  break;
203              case COMPLETE:
204                  tgt.setValue(CodeSystem.CodeSystemContentMode.COMPLETE);
205                  break;
206              default:
207                  tgt.setValue(CodeSystem.CodeSystemContentMode.NULL);
208                  break;
209          }
210      }
211      return tgt;
212  }
213
214  public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
215    if (src == null || src.isEmpty())
216      return null;
217    org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent();
218    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
219    if (src.hasCodeElement())
220      tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
221    if (src.hasDescription())
222      tgt.setDescriptionElement(String14_30.convertString(src.getDescriptionElement()));
223    for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator())
224      try {
225        tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue()));
226      } catch (org.hl7.fhir.exceptions.FHIRException e) {
227        throw new FHIRException(e);
228      }
229    if (src.hasValueElement())
230      tgt.setValueElement(String14_30.convertString(src.getValueElement()));
231    return tgt;
232  }
233
234  public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
235    if (src == null || src.isEmpty())
236      return null;
237    org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent();
238    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
239    if (src.hasCodeElement())
240      tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
241    if (src.hasDescription())
242      tgt.setDescriptionElement(String14_30.convertString(src.getDescriptionElement()));
243    for (Enumeration<FilterOperator> t : src.getOperator()) tgt.addOperator(t.getValue().toCode());
244    if (src.hasValueElement())
245      tgt.setValueElement(String14_30.convertString(src.getValueElement()));
246    return tgt;
247  }
248
249  public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException {
250    if (src == null || src.isEmpty())
251      return null;
252    org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent();
253    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
254    if (src.hasCodeElement())
255      tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
256    if (src.hasDisplay())
257      tgt.setDisplayElement(String14_30.convertString(src.getDisplayElement()));
258    if (src.hasDefinition())
259      tgt.setDefinitionElement(String14_30.convertString(src.getDefinitionElement()));
260    for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation())
261      tgt.addDesignation(convertConceptDefinitionDesignationComponent(t));
262    for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty())
263      tgt.addProperty(convertConceptPropertyComponent(t));
264    for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
265      tgt.addConcept(convertConceptDefinitionComponent(t));
266    return tgt;
267  }
268
269  public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException {
270    if (src == null || src.isEmpty())
271      return null;
272    org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent();
273    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
274    if (src.hasCodeElement())
275      tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
276    if (src.hasDisplay())
277      tgt.setDisplayElement(String14_30.convertString(src.getDisplayElement()));
278    if (src.hasDefinition())
279      tgt.setDefinitionElement(String14_30.convertString(src.getDefinitionElement()));
280    for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation())
281      tgt.addDesignation(convertConceptDefinitionDesignationComponent(t));
282    for (ConceptDefinitionPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t));
283    for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
284      tgt.addConcept(convertConceptDefinitionComponent(t));
285    return tgt;
286  }
287
288  public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
289    if (src == null || src.isEmpty())
290      return null;
291    org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent();
292    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
293    if (src.hasLanguage())
294      tgt.setLanguageElement(Code14_30.convertCode(src.getLanguageElement()));
295    if (src.hasUse())
296      tgt.setUse(Code14_30.convertCoding(src.getUse()));
297    if (src.hasValueElement())
298      tgt.setValueElement(String14_30.convertString(src.getValueElement()));
299    return tgt;
300  }
301
302  public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
303    if (src == null || src.isEmpty())
304      return null;
305    org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent();
306    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
307    if (src.hasLanguage())
308      tgt.setLanguageElement(Code14_30.convertCode(src.getLanguageElement()));
309    if (src.hasUse())
310      tgt.setUse(Code14_30.convertCoding(src.getUse()));
311    if (src.hasValueElement())
312      tgt.setValueElement(String14_30.convertString(src.getValueElement()));
313    return tgt;
314  }
315
316  public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException {
317    if (src == null || src.isEmpty())
318      return null;
319    org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent();
320    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
321    if (src.hasCodeElement())
322      tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
323    if (src.hasValue())
324      tgt.setValue(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getValue()));
325    return tgt;
326  }
327
328  public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException {
329    if (src == null || src.isEmpty())
330      return null;
331    org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent();
332    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
333    if (src.hasCodeElement())
334      tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
335    if (src.hasValue())
336      tgt.setValue(ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().convertType(src.getValue()));
337    return tgt;
338  }
339
340  public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException {
341    if (src == null || src.isEmpty())
342      return null;
343    org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent();
344    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
345    if (src.hasCodeElement())
346      tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
347    if (src.hasDescription())
348      tgt.setDescriptionElement(String14_30.convertString(src.getDescriptionElement()));
349    if (src.hasType())
350      tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
351    return tgt;
352  }
353
354  public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException {
355    if (src == null || src.isEmpty())
356      return null;
357    org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent();
358    ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyBackboneElement(src,tgt);
359    if (src.hasCodeElement())
360      tgt.setCodeElement(Code14_30.convertCode(src.getCodeElement()));
361    if (src.hasDescription())
362      tgt.setDescriptionElement(String14_30.convertString(src.getDescriptionElement()));
363    if (src.hasType())
364      tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
365    return tgt;
366  }
367
368  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType> src) throws FHIRException {
369      if (src == null || src.isEmpty())
370          return null;
371      Enumeration<CodeSystem.PropertyType> tgt = new Enumeration<>(new CodeSystem.PropertyTypeEnumFactory());
372      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
373      if (src.getValue() == null) {
374          tgt.setValue(null);
375      } else {
376          switch (src.getValue()) {
377              case CODE:
378                  tgt.setValue(CodeSystem.PropertyType.CODE);
379                  break;
380              case CODING:
381                  tgt.setValue(CodeSystem.PropertyType.CODING);
382                  break;
383              case STRING:
384                  tgt.setValue(CodeSystem.PropertyType.STRING);
385                  break;
386              case INTEGER:
387                  tgt.setValue(CodeSystem.PropertyType.INTEGER);
388                  break;
389              case BOOLEAN:
390                  tgt.setValue(CodeSystem.PropertyType.BOOLEAN);
391                  break;
392              case DATETIME:
393                  tgt.setValue(CodeSystem.PropertyType.DATETIME);
394                  break;
395              default:
396                  tgt.setValue(CodeSystem.PropertyType.NULL);
397                  break;
398          }
399      }
400      return tgt;
401  }
402
403  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> src) throws FHIRException {
404      if (src == null || src.isEmpty())
405          return null;
406      org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyTypeEnumFactory());
407      ConversionContext14_30.INSTANCE.getVersionConvertor_14_30().copyElement(src, tgt);
408      if (src.getValue() == null) {
409          tgt.setValue(null);
410      } else {
411          switch (src.getValue()) {
412              case CODE:
413                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE);
414                  break;
415              case CODING:
416                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING);
417                  break;
418              case STRING:
419                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING);
420                  break;
421              case INTEGER:
422                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER);
423                  break;
424              case BOOLEAN:
425                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN);
426                  break;
427              case DATETIME:
428                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME);
429                  break;
430              default:
431                  tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL);
432                  break;
433          }
434      }
435      return tgt;
436  }
437}