001package org.hl7.fhir.convertors.conv14_40.resources14_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext14_40;
004import org.hl7.fhir.convertors.conv14_40.VersionConvertor_14_40;
005import org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40.CodeableConcept14_40;
006import org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40.Coding14_40;
007import org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40.ContactPoint14_40;
008import org.hl7.fhir.convertors.conv14_40.datatypes14_40.complextypes14_40.Identifier14_40;
009import org.hl7.fhir.convertors.conv14_40.datatypes14_40.primitivetypes14_40.*;
010import org.hl7.fhir.exceptions.FHIRException;
011import org.hl7.fhir.r4.model.BooleanType;
012
013public class ValueSet14_40 {
014
015  public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException {
016    if (src == null || src.isEmpty())
017      return null;
018    org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent();
019    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
020    if (src.hasCodeElement())
021      tgt.setCodeElement(Code14_40.convertCode(src.getCodeElement()));
022    if (src.hasDisplay())
023      tgt.setDisplayElement(String14_40.convertString(src.getDisplayElement()));
024    for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
025      tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
026    return tgt;
027  }
028
029  public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException {
030    if (src == null || src.isEmpty())
031      return null;
032    org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent();
033    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
034    if (src.hasCodeElement())
035      tgt.setCodeElement(Code14_40.convertCode(src.getCodeElement()));
036    if (src.hasDisplay())
037      tgt.setDisplayElement(String14_40.convertString(src.getDisplayElement()));
038    for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
039      tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
040    return tgt;
041  }
042
043  public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException {
044    if (src == null || src.isEmpty())
045      return null;
046    org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent();
047    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
048    if (src.hasLanguage())
049      tgt.setLanguageElement(Code14_40.convertCode(src.getLanguageElement()));
050    if (src.hasUse())
051      tgt.setUse(Coding14_40.convertCoding(src.getUse()));
052    if (src.hasValueElement())
053      tgt.setValueElement(String14_40.convertString(src.getValueElement()));
054    return tgt;
055  }
056
057  public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException {
058    if (src == null || src.isEmpty())
059      return null;
060    org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent();
061    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
062    if (src.hasLanguage())
063      tgt.setLanguageElement(Code14_40.convertCode(src.getLanguageElement()));
064    if (src.hasUse())
065      tgt.setUse(Coding14_40.convertCoding(src.getUse()));
066    if (src.hasValueElement())
067      tgt.setValueElement(String14_40.convertString(src.getValueElement()));
068    return tgt;
069  }
070
071  public static org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException {
072    if (src == null || src.isEmpty())
073      return null;
074    org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent();
075    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
076    if (src.hasSystemElement())
077      tgt.setSystemElement(Uri14_40.convertUri(src.getSystemElement()));
078    if (src.hasVersion())
079      tgt.setVersionElement(String14_40.convertString(src.getVersionElement()));
080    for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept())
081      tgt.addConcept(convertConceptReferenceComponent(t));
082    for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter())
083      tgt.addFilter(convertConceptSetFilterComponent(t));
084    return tgt;
085  }
086
087  public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException {
088    if (src == null || src.isEmpty())
089      return null;
090    org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent();
091    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
092    if (src.hasSystemElement())
093      tgt.setSystemElement(Uri14_40.convertUri(src.getSystemElement()));
094    if (src.hasVersion())
095      tgt.setVersionElement(String14_40.convertString(src.getVersionElement()));
096    for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept())
097      tgt.addConcept(convertConceptReferenceComponent(t));
098    for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter())
099      tgt.addFilter(convertConceptSetFilterComponent(t));
100    return tgt;
101  }
102
103  public static org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException {
104    if (src == null || src.isEmpty())
105      return null;
106    org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent();
107    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
108    if (src.hasPropertyElement())
109      tgt.setPropertyElement(Code14_40.convertCode(src.getPropertyElement()));
110    if (src.hasOp())
111      tgt.setOpElement(convertFilterOperator(src.getOpElement()));
112    if (src.hasValue())
113      tgt.setValue(src.getValue());
114    return tgt;
115  }
116
117  public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException {
118    if (src == null || src.isEmpty())
119      return null;
120    org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent();
121    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
122    if (src.hasPropertyElement())
123      tgt.setPropertyElement(Code14_40.convertCode(src.getPropertyElement()));
124    if (src.hasOp())
125      tgt.setOpElement(convertFilterOperator(src.getOpElement()));
126    if (src.hasValue())
127      tgt.setValue(src.getValue());
128    return tgt;
129  }
130
131  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ValueSet.FilterOperator> convertFilterOperator(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator> src) throws FHIRException {
132    if (src == null || src.isEmpty())
133      return null;
134    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ValueSet.FilterOperator> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ValueSet.FilterOperatorEnumFactory());
135    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
136    switch (src.getValue()) {
137      case EQUAL:
138        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL);
139        break;
140      case ISA:
141        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA);
142        break;
143      case ISNOTA:
144        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA);
145        break;
146      case REGEX:
147        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX);
148        break;
149      case IN:
150        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN);
151        break;
152      case NOTIN:
153        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN);
154        break;
155      default:
156        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL);
157        break;
158    }
159    return tgt;
160  }
161
162  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator> convertFilterOperator(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ValueSet.FilterOperator> src) throws FHIRException {
163    if (src == null || src.isEmpty())
164      return null;
165    org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperatorEnumFactory());
166    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
167    switch (src.getValue()) {
168      case EQUAL:
169        tgt.setValue(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL);
170        break;
171      case ISA:
172        tgt.setValue(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA);
173        break;
174      case ISNOTA:
175        tgt.setValue(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA);
176        break;
177      case REGEX:
178        tgt.setValue(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX);
179        break;
180      case IN:
181        tgt.setValue(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN);
182        break;
183      case NOTIN:
184        tgt.setValue(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN);
185        break;
186      default:
187        tgt.setValue(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL);
188        break;
189    }
190    return tgt;
191  }
192
193  public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException {
194    if (src == null || src.isEmpty())
195      return null;
196    org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet();
197    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyDomainResource(src, tgt);
198    if (src.hasUrl())
199      tgt.setUrlElement(Uri14_40.convertUri(src.getUrlElement()));
200    if (src.hasIdentifier())
201      tgt.addIdentifier(Identifier14_40.convertIdentifier(src.getIdentifier()));
202    if (src.hasVersion())
203      tgt.setVersionElement(String14_40.convertString(src.getVersionElement()));
204    if (src.hasName())
205      tgt.setNameElement(String14_40.convertString(src.getNameElement()));
206    if (src.hasStatus())
207      tgt.setStatusElement(Enumerations14_40.convertConformanceResourceStatus(src.getStatusElement()));
208    if (src.hasExperimental())
209      tgt.setExperimentalElement(Boolean14_40.convertBoolean(src.getExperimentalElement()));
210    if (src.hasPublisher())
211      tgt.setPublisherElement(String14_40.convertString(src.getPublisherElement()));
212    for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact())
213      tgt.addContact(convertValueSetContactComponent(t));
214    if (src.hasDate())
215      tgt.setDateElement(DateTime14_40.convertDateTime(src.getDateElement()));
216    if (src.hasDescription())
217      tgt.setDescription(src.getDescription());
218    for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext())
219      if (VersionConvertor_14_40.isJurisdiction(t))
220        tgt.addJurisdiction(CodeableConcept14_40.convertCodeableConcept(t));
221      else
222        tgt.addUseContext(CodeableConcept14_40.convertCodeableConceptToUsageContext(t));
223    if (src.hasImmutable())
224      tgt.setImmutableElement(Boolean14_40.convertBoolean(src.getImmutableElement()));
225    if (src.hasRequirements())
226      tgt.setPurpose(src.getRequirements());
227    if (src.hasCopyright())
228      tgt.setCopyright(src.getCopyright());
229    if (src.hasExtensible())
230      tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible()));
231    if (src.hasCompose())
232      tgt.setCompose(convertValueSetComposeComponent(src.getCompose()));
233    if (src.hasLockedDate())
234      tgt.getCompose().setLockedDate(src.getLockedDate());
235    if (src.hasExpansion())
236      tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion()));
237    return tgt;
238  }
239
240  public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException {
241    if (src == null || src.isEmpty())
242      return null;
243    org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet();
244    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyDomainResource(src, tgt);
245    if (src.hasUrl())
246      tgt.setUrlElement(Uri14_40.convertUri(src.getUrlElement()));
247    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
248      tgt.setIdentifier(Identifier14_40.convertIdentifier(t));
249    if (src.hasVersion())
250      tgt.setVersionElement(String14_40.convertString(src.getVersionElement()));
251    if (src.hasName())
252      tgt.setNameElement(String14_40.convertString(src.getNameElement()));
253    if (src.hasStatus())
254      tgt.setStatusElement(Enumerations14_40.convertConformanceResourceStatus(src.getStatusElement()));
255    if (src.hasExperimental())
256      tgt.setExperimentalElement(Boolean14_40.convertBoolean(src.getExperimentalElement()));
257    if (src.hasPublisher())
258      tgt.setPublisherElement(String14_40.convertString(src.getPublisherElement()));
259    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertValueSetContactComponent(t));
260    if (src.hasDate())
261      tgt.setDateElement(DateTime14_40.convertDateTime(src.getDateElement()));
262    if (src.getCompose().hasLockedDate())
263      tgt.setLockedDate(src.getCompose().getLockedDate());
264    if (src.hasDescription())
265      tgt.setDescription(src.getDescription());
266    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
267      if (t.hasValueCodeableConcept())
268        tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t.getValueCodeableConcept()));
269    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
270      tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t));
271    if (src.hasImmutable())
272      tgt.setImmutableElement(Boolean14_40.convertBoolean(src.getImmutableElement()));
273    if (src.hasPurpose())
274      tgt.setRequirements(src.getPurpose());
275    if (src.hasCopyright())
276      tgt.setCopyright(src.getCopyright());
277    if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible"))
278      tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue());
279    if (src.hasCompose())
280      tgt.setCompose(convertValueSetComposeComponent(src.getCompose()));
281    if (src.hasExpansion())
282      tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion()));
283    return tgt;
284  }
285
286  public static org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException {
287    if (src == null || src.isEmpty())
288      return null;
289    org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent();
290    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
291    for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) tgt.addInclude().addValueSet(t.getValue());
292    for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude())
293      tgt.addInclude(convertConceptSetComponent(t));
294    for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude())
295      tgt.addExclude(convertConceptSetComponent(t));
296    return tgt;
297  }
298
299  public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src) throws FHIRException {
300    if (src == null || src.isEmpty())
301      return null;
302    org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent();
303    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
304    for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) {
305      for (org.hl7.fhir.r4.model.UriType ti : t.getValueSet()) tgt.addImport(ti.getValue());
306      tgt.addInclude(convertConceptSetComponent(t));
307    }
308    for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude())
309      tgt.addExclude(convertConceptSetComponent(t));
310    return tgt;
311  }
312
313  public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
314    if (src == null || src.isEmpty())
315      return null;
316    org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent();
317    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
318    if (src.hasName())
319      tgt.setNameElement(String14_40.convertString(src.getNameElement()));
320    for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
321      tgt.addTelecom(ContactPoint14_40.convertContactPoint(t));
322    return tgt;
323  }
324
325  public static org.hl7.fhir.r4.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException {
326    if (src == null || src.isEmpty())
327      return null;
328    org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
329    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
330    if (src.hasName())
331      tgt.setNameElement(String14_40.convertString(src.getNameElement()));
332    for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom())
333      tgt.addTelecom(ContactPoint14_40.convertContactPoint(t));
334    return tgt;
335  }
336
337  public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException {
338    if (src == null || src.isEmpty())
339      return null;
340    org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent();
341    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
342    if (src.hasIdentifierElement())
343      tgt.setIdentifierElement(Uri14_40.convertUri(src.getIdentifierElement()));
344    if (src.hasTimestampElement())
345      tgt.setTimestampElement(DateTime14_40.convertDateTime(src.getTimestampElement()));
346    if (src.hasTotal())
347      tgt.setTotalElement(Integer14_40.convertInteger(src.getTotalElement()));
348    if (src.hasOffset())
349      tgt.setOffsetElement(Integer14_40.convertInteger(src.getOffsetElement()));
350    for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter())
351      tgt.addParameter(convertValueSetExpansionParameterComponent(t));
352    for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
353      tgt.addContains(convertValueSetExpansionContainsComponent(t));
354    return tgt;
355  }
356
357  public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException {
358    if (src == null || src.isEmpty())
359      return null;
360    org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent();
361    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
362    if (src.hasIdentifierElement())
363      tgt.setIdentifierElement(Uri14_40.convertUri(src.getIdentifierElement()));
364    if (src.hasTimestampElement())
365      tgt.setTimestampElement(DateTime14_40.convertDateTime(src.getTimestampElement()));
366    if (src.hasTotal())
367      tgt.setTotalElement(Integer14_40.convertInteger(src.getTotalElement()));
368    if (src.hasOffset())
369      tgt.setOffsetElement(Integer14_40.convertInteger(src.getOffsetElement()));
370    for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter())
371      tgt.addParameter(convertValueSetExpansionParameterComponent(t));
372    for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
373      tgt.addContains(convertValueSetExpansionContainsComponent(t));
374    return tgt;
375  }
376
377  public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException {
378    if (src == null || src.isEmpty())
379      return null;
380    org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent();
381    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
382    if (src.hasSystem())
383      tgt.setSystemElement(Uri14_40.convertUri(src.getSystemElement()));
384    if (src.hasAbstract())
385      tgt.setAbstractElement(Boolean14_40.convertBoolean(src.getAbstractElement()));
386    if (src.hasVersion())
387      tgt.setVersionElement(String14_40.convertString(src.getVersionElement()));
388    if (src.hasCode())
389      tgt.setCodeElement(Code14_40.convertCode(src.getCodeElement()));
390    if (src.hasDisplay())
391      tgt.setDisplayElement(String14_40.convertString(src.getDisplayElement()));
392    for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
393      tgt.addContains(convertValueSetExpansionContainsComponent(t));
394    return tgt;
395  }
396
397  public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException {
398    if (src == null || src.isEmpty())
399      return null;
400    org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent();
401    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
402    if (src.hasSystem())
403      tgt.setSystemElement(Uri14_40.convertUri(src.getSystemElement()));
404    if (src.hasAbstract())
405      tgt.setAbstractElement(Boolean14_40.convertBoolean(src.getAbstractElement()));
406    if (src.hasVersion())
407      tgt.setVersionElement(String14_40.convertString(src.getVersionElement()));
408    if (src.hasCode())
409      tgt.setCodeElement(Code14_40.convertCode(src.getCodeElement()));
410    if (src.hasDisplay())
411      tgt.setDisplayElement(String14_40.convertString(src.getDisplayElement()));
412    for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
413      tgt.addContains(convertValueSetExpansionContainsComponent(t));
414    return tgt;
415  }
416
417  public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException {
418    if (src == null || src.isEmpty())
419      return null;
420    org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent();
421    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
422    if (src.hasNameElement())
423      tgt.setNameElement(String14_40.convertString(src.getNameElement()));
424    if (src.hasValue())
425      tgt.setValue(ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().convertType(src.getValue()));
426    return tgt;
427  }
428
429  public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException {
430    if (src == null || src.isEmpty())
431      return null;
432    org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent();
433    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyElement(src, tgt);
434    if (src.hasNameElement())
435      tgt.setNameElement(String14_40.convertString(src.getNameElement()));
436    if (src.hasValue())
437      tgt.setValue(ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().convertType(src.getValue()));
438    return tgt;
439  }
440}