001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext40_50;
004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Coding40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.UsageContext40_50;
009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.*;
010import org.hl7.fhir.exceptions.FHIRException;
011
012/*
013  Copyright (c) 2011+, HL7, Inc.
014  All rights reserved.
015  
016  Redistribution and use in source and binary forms, with or without modification, 
017  are permitted provided that the following conditions are met:
018  
019   * Redistributions of source code must retain the above copyright notice, this 
020     list of conditions and the following disclaimer.
021   * Redistributions in binary form must reproduce the above copyright notice, 
022     this list of conditions and the following disclaimer in the documentation 
023     and/or other materials provided with the distribution.
024   * Neither the name of HL7 nor the names of its contributors may be used to 
025     endorse or promote products derived from this software without specific 
026     prior written permission.
027  
028  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
029  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
030  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
031  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
032  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
033  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
034  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
035  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
036  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
037  POSSIBILITY OF SUCH DAMAGE.
038  
039*/
040// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
041public class ValueSet40_50 {
042
043  public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException {
044    if (src == null)
045      return null;
046    org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet();
047    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
048    if (src.hasUrl())
049      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
050    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
051      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
052    if (src.hasVersion())
053      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
054    if (src.hasName())
055      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
056    if (src.hasTitle())
057      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
058    if (src.hasStatus())
059      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
060    if (src.hasExperimental())
061      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
062    if (src.hasDate())
063      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
064    if (src.hasPublisher())
065      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
066    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
067      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
068    if (src.hasDescription())
069      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
070    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
071      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
072    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
073      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
074    if (src.hasImmutable())
075      tgt.setImmutableElement(Boolean40_50.convertBoolean(src.getImmutableElement()));
076    if (src.hasPurpose())
077      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
078    if (src.hasCopyright())
079      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
080    if (src.hasCompose())
081      tgt.setCompose(convertValueSetComposeComponent(src.getCompose()));
082    if (src.hasExpansion())
083      tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion()));
084    return tgt;
085  }
086
087  public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException {
088    if (src == null)
089      return null;
090    org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet();
091    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
092    if (src.hasUrl())
093      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
094    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
095      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
096    if (src.hasVersion())
097      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
098    if (src.hasName())
099      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
100    if (src.hasTitle())
101      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
102    if (src.hasStatus())
103      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
104    if (src.hasExperimental())
105      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
106    if (src.hasDate())
107      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
108    if (src.hasPublisher())
109      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
110    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
111      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
112    if (src.hasDescription())
113      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
114    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
115      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
116    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
117      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
118    if (src.hasImmutable())
119      tgt.setImmutableElement(Boolean40_50.convertBoolean(src.getImmutableElement()));
120    if (src.hasPurpose())
121      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
122    if (src.hasCopyright())
123      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
124    if (src.hasCompose())
125      tgt.setCompose(convertValueSetComposeComponent(src.getCompose()));
126    if (src.hasExpansion())
127      tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion()));
128    return tgt;
129  }
130
131  public static org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src) throws FHIRException {
132    if (src == null)
133      return null;
134    org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent();
135    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
136    if (src.hasLockedDate())
137      tgt.setLockedDateElement(Date40_50.convertDate(src.getLockedDateElement()));
138    if (src.hasInactive())
139      tgt.setInactiveElement(Boolean40_50.convertBoolean(src.getInactiveElement()));
140    for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude())
141      tgt.addInclude(convertConceptSetComponent(t));
142    for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude())
143      tgt.addExclude(convertConceptSetComponent(t));
144    return tgt;
145  }
146
147  public static org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src) throws FHIRException {
148    if (src == null)
149      return null;
150    org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent();
151    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
152    if (src.hasLockedDate())
153      tgt.setLockedDateElement(Date40_50.convertDate(src.getLockedDateElement()));
154    if (src.hasInactive())
155      tgt.setInactiveElement(Boolean40_50.convertBoolean(src.getInactiveElement()));
156    for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude())
157      tgt.addInclude(convertConceptSetComponent(t));
158    for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude())
159      tgt.addExclude(convertConceptSetComponent(t));
160    return tgt;
161  }
162
163  public static org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException {
164    if (src == null)
165      return null;
166    org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent();
167    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
168    if (src.hasSystem())
169      tgt.setSystemElement(Uri40_50.convertUri(src.getSystemElement()));
170    if (src.hasVersion())
171      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
172    for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept())
173      tgt.addConcept(convertConceptReferenceComponent(t));
174    for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter())
175      tgt.addFilter(convertConceptSetFilterComponent(t));
176    for (org.hl7.fhir.r4.model.CanonicalType t : src.getValueSet())
177      tgt.getValueSet().add(Canonical40_50.convertCanonical(t));
178    return tgt;
179  }
180
181  public static org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException {
182    if (src == null)
183      return null;
184    org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent();
185    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
186    if (src.hasSystem())
187      tgt.setSystemElement(Uri40_50.convertUri(src.getSystemElement()));
188    if (src.hasVersion())
189      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
190    for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept())
191      tgt.addConcept(convertConceptReferenceComponent(t));
192    for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter())
193      tgt.addFilter(convertConceptSetFilterComponent(t));
194    for (org.hl7.fhir.r5.model.CanonicalType t : src.getValueSet())
195      tgt.getValueSet().add(Canonical40_50.convertCanonical(t));
196    return tgt;
197  }
198
199  public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException {
200    if (src == null)
201      return null;
202    org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent();
203    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
204    if (src.hasCode())
205      tgt.setCodeElement(Code40_50.convertCode(src.getCodeElement()));
206    if (src.hasDisplay())
207      tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
208    for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
209      tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
210    return tgt;
211  }
212
213  public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException {
214    if (src == null)
215      return null;
216    org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent();
217    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
218    if (src.hasCode())
219      tgt.setCodeElement(Code40_50.convertCode(src.getCodeElement()));
220    if (src.hasDisplay())
221      tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
222    for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
223      tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
224    return tgt;
225  }
226
227  public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException {
228    if (src == null)
229      return null;
230    org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent();
231    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
232    if (src.hasLanguage())
233      tgt.setLanguageElement(Code40_50.convertCode(src.getLanguageElement()));
234    if (src.hasUse())
235      tgt.setUse(Coding40_50.convertCoding(src.getUse()));
236    if (src.hasValue())
237      tgt.setValueElement(String40_50.convertString(src.getValueElement()));
238    return tgt;
239  }
240
241  public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException {
242    if (src == null)
243      return null;
244    org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent();
245    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
246    if (src.hasLanguage())
247      tgt.setLanguageElement(Code40_50.convertCode(src.getLanguageElement()));
248    if (src.hasUse())
249      tgt.setUse(Coding40_50.convertCoding(src.getUse()));
250    if (src.hasValue())
251      tgt.setValueElement(String40_50.convertString(src.getValueElement()));
252    return tgt;
253  }
254
255  public static org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException {
256    if (src == null)
257      return null;
258    org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent();
259    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
260    if (src.hasProperty())
261      tgt.setPropertyElement(Code40_50.convertCode(src.getPropertyElement()));
262    if (src.hasOp())
263      tgt.setOpElement(convertFilterOperator(src.getOpElement()));
264    if (src.hasValue())
265      tgt.setValueElement(String40_50.convertString(src.getValueElement()));
266    return tgt;
267  }
268
269  public static org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException {
270    if (src == null)
271      return null;
272    org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent();
273    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
274    if (src.hasProperty())
275      tgt.setPropertyElement(Code40_50.convertCode(src.getPropertyElement()));
276    if (src.hasOp())
277      tgt.setOpElement(convertFilterOperator(src.getOpElement()));
278    if (src.hasValue())
279      tgt.setValueElement(String40_50.convertString(src.getValueElement()));
280    return tgt;
281  }
282
283  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FilterOperator> convertFilterOperator(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ValueSet.FilterOperator> src) throws FHIRException {
284    if (src == null || src.isEmpty())
285      return null;
286    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());
287    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
288    switch (src.getValue()) {
289      case EQUAL:
290        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL);
291        break;
292      case ISA:
293        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA);
294        break;
295      case DESCENDENTOF:
296        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.DESCENDENTOF);
297        break;
298      case ISNOTA:
299        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA);
300        break;
301      case REGEX:
302        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX);
303        break;
304      case IN:
305        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN);
306        break;
307      case NOTIN:
308        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN);
309        break;
310      case GENERALIZES:
311        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.GENERALIZES);
312        break;
313      case EXISTS:
314        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.EXISTS);
315        break;
316      default:
317        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL);
318        break;
319    }
320    return tgt;
321  }
322
323  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ValueSet.FilterOperator> convertFilterOperator(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FilterOperator> src) throws FHIRException {
324    if (src == null || src.isEmpty())
325      return null;
326    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());
327    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
328    switch (src.getValue()) {
329      case EQUAL:
330        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL);
331        break;
332      case ISA:
333        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA);
334        break;
335      case DESCENDENTOF:
336        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.DESCENDENTOF);
337        break;
338      case ISNOTA:
339        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA);
340        break;
341      case REGEX:
342        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX);
343        break;
344      case IN:
345        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN);
346        break;
347      case NOTIN:
348        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN);
349        break;
350      case GENERALIZES:
351        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.GENERALIZES);
352        break;
353      case EXISTS:
354        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.EXISTS);
355        break;
356      default:
357        tgt.setValue(org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL);
358        break;
359    }
360    return tgt;
361  }
362
363  public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException {
364    if (src == null)
365      return null;
366    org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent();
367    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
368    if (src.hasIdentifier())
369      tgt.setIdentifierElement(Uri40_50.convertUri(src.getIdentifierElement()));
370    if (src.hasTimestamp())
371      tgt.setTimestampElement(DateTime40_50.convertDateTime(src.getTimestampElement()));
372    if (src.hasTotal())
373      tgt.setTotalElement(Integer40_50.convertInteger(src.getTotalElement()));
374    if (src.hasOffset())
375      tgt.setOffsetElement(Integer40_50.convertInteger(src.getOffsetElement()));
376    for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter())
377      tgt.addParameter(convertValueSetExpansionParameterComponent(t));
378    for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
379      tgt.addContains(convertValueSetExpansionContainsComponent(t));
380    return tgt;
381  }
382
383  public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException {
384    if (src == null)
385      return null;
386    org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent();
387    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
388    if (src.hasIdentifier())
389      tgt.setIdentifierElement(Uri40_50.convertUri(src.getIdentifierElement()));
390    if (src.hasTimestamp())
391      tgt.setTimestampElement(DateTime40_50.convertDateTime(src.getTimestampElement()));
392    if (src.hasTotal())
393      tgt.setTotalElement(Integer40_50.convertInteger(src.getTotalElement()));
394    if (src.hasOffset())
395      tgt.setOffsetElement(Integer40_50.convertInteger(src.getOffsetElement()));
396    for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter())
397      tgt.addParameter(convertValueSetExpansionParameterComponent(t));
398    for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
399      tgt.addContains(convertValueSetExpansionContainsComponent(t));
400    return tgt;
401  }
402
403  public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException {
404    if (src == null)
405      return null;
406    org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent();
407    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
408    if (src.hasName())
409      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
410    if (src.hasValue())
411      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
412    return tgt;
413  }
414
415  public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException {
416    if (src == null)
417      return null;
418    org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent();
419    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
420    if (src.hasName())
421      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
422    if (src.hasValue())
423      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
424    return tgt;
425  }
426
427  public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException {
428    if (src == null)
429      return null;
430    org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent();
431    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
432    if (src.hasSystem())
433      tgt.setSystemElement(Uri40_50.convertUri(src.getSystemElement()));
434    if (src.hasAbstract())
435      tgt.setAbstractElement(Boolean40_50.convertBoolean(src.getAbstractElement()));
436    if (src.hasInactive())
437      tgt.setInactiveElement(Boolean40_50.convertBoolean(src.getInactiveElement()));
438    if (src.hasVersion())
439      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
440    if (src.hasCode())
441      tgt.setCodeElement(Code40_50.convertCode(src.getCodeElement()));
442    if (src.hasDisplay())
443      tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
444    for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
445      tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
446    for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
447      tgt.addContains(convertValueSetExpansionContainsComponent(t));
448    return tgt;
449  }
450
451  public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException {
452    if (src == null)
453      return null;
454    org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent();
455    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
456    if (src.hasSystem())
457      tgt.setSystemElement(Uri40_50.convertUri(src.getSystemElement()));
458    if (src.hasAbstract())
459      tgt.setAbstractElement(Boolean40_50.convertBoolean(src.getAbstractElement()));
460    if (src.hasInactive())
461      tgt.setInactiveElement(Boolean40_50.convertBoolean(src.getInactiveElement()));
462    if (src.hasVersion())
463      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
464    if (src.hasCode())
465      tgt.setCodeElement(Code40_50.convertCode(src.getCodeElement()));
466    if (src.hasDisplay())
467      tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
468    for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
469      tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
470    for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
471      tgt.addContains(convertValueSetExpansionContainsComponent(t));
472    return tgt;
473  }
474}