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