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