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