001package org.hl7.fhir.convertors.conv30_40.resources30_40;
002
003import java.util.stream.Collectors;
004
005import org.hl7.fhir.convertors.context.ConversionContext30_40;
006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.ContactDetail30_40;
007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40;
008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Coding30_40;
009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40;
010import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Timing30_40;
011import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Boolean30_40;
012import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Code30_40;
013import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.DateTime30_40;
014import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.MarkDown30_40;
015import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40;
016import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.UnsignedInt30_40;
017import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Uri30_40;
018import org.hl7.fhir.exceptions.FHIRException;
019
020public class CodeSystem30_40 {
021
022  public static org.hl7.fhir.r4.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException {
023    if (src == null)
024      return null;
025    org.hl7.fhir.r4.model.CodeSystem tgt = new org.hl7.fhir.r4.model.CodeSystem();
026    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
027    if (src.hasUrl())
028      tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement()));
029    if (src.hasIdentifier())
030      tgt.addIdentifier(Identifier30_40.convertIdentifier(src.getIdentifier()));
031    if (src.hasVersion())
032      tgt.setVersionElement(String30_40.convertString(src.getVersionElement()));
033    if (src.hasName())
034      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
035    if (src.hasTitle())
036      tgt.setTitleElement(String30_40.convertString(src.getTitleElement()));
037    if (src.hasStatus())
038      tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement()));
039    if (src.hasExperimental())
040      tgt.setExperimentalElement(Boolean30_40.convertBoolean(src.getExperimentalElement()));
041    if (src.hasDateElement())
042      tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
043    if (src.hasPublisher())
044      tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement()));
045    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
046      tgt.addContact(ContactDetail30_40.convertContactDetail(t));
047    if (src.hasDescription())
048      tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement()));
049    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
050      tgt.addUseContext(Timing30_40.convertUsageContext(t));
051    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
052      tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t));
053    if (src.hasPurpose())
054      tgt.setPurposeElement(MarkDown30_40.convertMarkdown(src.getPurposeElement()));
055    if (src.hasCopyright())
056      tgt.setCopyrightElement(MarkDown30_40.convertMarkdown(src.getCopyrightElement()));
057    if (src.hasCaseSensitive())
058      tgt.setCaseSensitiveElement(Boolean30_40.convertBoolean(src.getCaseSensitiveElement()));
059    if (src.hasValueSet())
060      tgt.setValueSet(src.getValueSet());
061    if (src.hasHierarchyMeaning())
062      tgt.setHierarchyMeaningElement(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaningElement()));
063    if (src.hasCompositional())
064      tgt.setCompositionalElement(Boolean30_40.convertBoolean(src.getCompositionalElement()));
065    if (src.hasVersionNeeded())
066      tgt.setVersionNeededElement(Boolean30_40.convertBoolean(src.getVersionNeededElement()));
067    if (src.hasContent())
068      tgt.setContentElement(convertCodeSystemContentMode(src.getContentElement()));
069    if (src.hasCount())
070      tgt.setCountElement(UnsignedInt30_40.convertUnsignedInt(src.getCountElement()));
071    for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter())
072      tgt.addFilter(convertCodeSystemFilterComponent(t));
073    for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty())
074      tgt.addProperty(convertPropertyComponent(t));
075    for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
076      tgt.addConcept(convertConceptDefinitionComponent(t));
077    return tgt;
078  }
079
080  public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException {
081    if (src == null)
082      return null;
083    org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem();
084    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
085    if (src.hasUrl())
086      tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement()));
087    if (src.hasIdentifier())
088      tgt.setIdentifier(Identifier30_40.convertIdentifier(src.getIdentifierFirstRep()));
089    if (src.hasVersion())
090      tgt.setVersionElement(String30_40.convertString(src.getVersionElement()));
091    if (src.hasName())
092      tgt.setNameElement(String30_40.convertString(src.getNameElement()));
093    if (src.hasTitle())
094      tgt.setTitleElement(String30_40.convertString(src.getTitleElement()));
095    if (src.hasStatus())
096      tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement()));
097    if (src.hasExperimental())
098      tgt.setExperimentalElement(Boolean30_40.convertBoolean(src.getExperimentalElement()));
099    if (src.hasDateElement())
100      tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
101    if (src.hasPublisher())
102      tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement()));
103    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
104      tgt.addContact(ContactDetail30_40.convertContactDetail(t));
105    if (src.hasDescription())
106      tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement()));
107    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
108      tgt.addUseContext(Timing30_40.convertUsageContext(t));
109    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
110      tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t));
111    if (src.hasPurpose())
112      tgt.setPurposeElement(MarkDown30_40.convertMarkdown(src.getPurposeElement()));
113    if (src.hasCopyright())
114      tgt.setCopyrightElement(MarkDown30_40.convertMarkdown(src.getCopyrightElement()));
115    if (src.hasCaseSensitive())
116      tgt.setCaseSensitiveElement(Boolean30_40.convertBoolean(src.getCaseSensitiveElement()));
117    if (src.hasValueSet())
118      tgt.setValueSet(src.getValueSet());
119    if (src.hasHierarchyMeaning())
120      tgt.setHierarchyMeaningElement(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaningElement()));
121    if (src.hasCompositional())
122      tgt.setCompositionalElement(Boolean30_40.convertBoolean(src.getCompositionalElement()));
123    if (src.hasVersionNeeded())
124      tgt.setVersionNeededElement(Boolean30_40.convertBoolean(src.getVersionNeededElement()));
125    if (src.hasContent())
126      tgt.setContentElement(convertCodeSystemContentMode(src.getContentElement()));
127    if (src.hasCount())
128      tgt.setCountElement(UnsignedInt30_40.convertUnsignedInt(src.getCountElement()));
129    for (org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter())
130      tgt.addFilter(convertCodeSystemFilterComponent(t));
131    for (org.hl7.fhir.r4.model.CodeSystem.PropertyComponent t : src.getProperty())
132      tgt.addProperty(convertPropertyComponent(t));
133    for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
134      tgt.addConcept(convertConceptDefinitionComponent(t));
135    return tgt;
136  }
137
138  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
139    if (src == null || src.isEmpty())
140      return null;
141    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentModeEnumFactory());
142    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
143    switch (src.getValue()) {
144      case NOTPRESENT:
145        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT);
146        break;
147      case EXAMPLE:
148        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE);
149        break;
150      case FRAGMENT:
151        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT);
152        break;
153      case COMPLETE:
154        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE);
155        break;
156      default:
157        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL);
158        break;
159    }
160    return tgt;
161  }
162
163  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
164    if (src == null || src.isEmpty())
165      return null;
166    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentModeEnumFactory());
167    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
168    switch (src.getValue()) {
169      case NOTPRESENT:
170        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NOTPRESENT);
171        break;
172      case EXAMPLE:
173        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.EXAMPLE);
174        break;
175      case FRAGMENT:
176        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.FRAGMENT);
177        break;
178      case COMPLETE:
179        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.COMPLETE);
180        break;
181      default:
182        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NULL);
183        break;
184    }
185    return tgt;
186  }
187
188  public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
189    if (src == null)
190      return null;
191    org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent();
192    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
193    if (src.hasCode())
194      tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement()));
195    if (src.hasDescription())
196      tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement()));
197    tgt.setOperator(src.getOperator().stream()
198      .map(CodeSystem30_40::convertFilterOperator)
199      .collect(Collectors.toList()));
200    if (src.hasValue())
201      tgt.setValueElement(String30_40.convertString(src.getValueElement()));
202    return tgt;
203  }
204
205  public static org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
206    if (src == null)
207      return null;
208    org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent();
209    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
210    if (src.hasCode())
211      tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement()));
212    if (src.hasDescription())
213      tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement()));
214    tgt.setOperator(src.getOperator().stream()
215      .map(CodeSystem30_40::convertFilterOperator)
216      .collect(Collectors.toList()));
217    if (src.hasValue())
218      tgt.setValueElement(String30_40.convertString(src.getValueElement()));
219    return tgt;
220  }
221
222  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning> convertCodeSystemHierarchyMeaning(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning> src) throws FHIRException {
223    if (src == null || src.isEmpty())
224      return null;
225    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaningEnumFactory());
226    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
227    switch (src.getValue()) {
228      case GROUPEDBY:
229        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY);
230        break;
231      case ISA:
232        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.ISA);
233        break;
234      case PARTOF:
235        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF);
236        break;
237      case CLASSIFIEDWITH:
238        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
239        break;
240      default:
241        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.NULL);
242        break;
243    }
244    return tgt;
245  }
246
247  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning> convertCodeSystemHierarchyMeaning(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning> src) throws FHIRException {
248    if (src == null || src.isEmpty())
249      return null;
250    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaningEnumFactory());
251    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
252    switch (src.getValue()) {
253      case GROUPEDBY:
254        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY);
255        break;
256      case ISA:
257        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.ISA);
258        break;
259      case PARTOF:
260        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF);
261        break;
262      case CLASSIFIEDWITH:
263        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
264        break;
265      default:
266        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.NULL);
267        break;
268    }
269    return tgt;
270  }
271
272  public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException {
273    if (src == null)
274      return null;
275    org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent();
276    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
277    if (src.hasCode())
278      tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement()));
279    if (src.hasDisplay())
280      tgt.setDisplayElement(String30_40.convertString(src.getDisplayElement()));
281    if (src.hasDefinition())
282      tgt.setDefinitionElement(String30_40.convertString(src.getDefinitionElement()));
283    for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation())
284      tgt.addDesignation(convertConceptDefinitionDesignationComponent(t));
285    for (org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent t : src.getProperty())
286      tgt.addProperty(convertConceptPropertyComponent(t));
287    for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
288      tgt.addConcept(convertConceptDefinitionComponent(t));
289    return tgt;
290  }
291
292  public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException {
293    if (src == null)
294      return null;
295    org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent();
296    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
297    if (src.hasCode())
298      tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement()));
299    if (src.hasDisplay())
300      tgt.setDisplayElement(String30_40.convertString(src.getDisplayElement()));
301    if (src.hasDefinition())
302      tgt.setDefinitionElement(String30_40.convertString(src.getDefinitionElement()));
303    for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation())
304      tgt.addDesignation(convertConceptDefinitionDesignationComponent(t));
305    for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty())
306      tgt.addProperty(convertConceptPropertyComponent(t));
307    for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
308      tgt.addConcept(convertConceptDefinitionComponent(t));
309    return tgt;
310  }
311
312  public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
313    if (src == null)
314      return null;
315    org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent();
316    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
317    if (src.hasLanguage())
318      tgt.setLanguageElement(Code30_40.convertCode(src.getLanguageElement()));
319    if (src.hasUse())
320      tgt.setUse(Coding30_40.convertCoding(src.getUse()));
321    if (src.hasValue())
322      tgt.setValueElement(String30_40.convertString(src.getValueElement()));
323    return tgt;
324  }
325
326  public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
327    if (src == null)
328      return null;
329    org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent();
330    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
331    if (src.hasLanguage())
332      tgt.setLanguageElement(Code30_40.convertCode(src.getLanguageElement()));
333    if (src.hasUse())
334      tgt.setUse(Coding30_40.convertCoding(src.getUse()));
335    if (src.hasValue())
336      tgt.setValueElement(String30_40.convertString(src.getValueElement()));
337    return tgt;
338  }
339
340  public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException {
341    if (src == null)
342      return null;
343    org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent();
344    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
345    if (src.hasCode())
346      tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement()));
347    if (src.hasValue())
348      tgt.setValue(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getValue()));
349    return tgt;
350  }
351
352  public static org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException {
353    if (src == null)
354      return null;
355    org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent();
356    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
357    if (src.hasCode())
358      tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement()));
359    if (src.hasValue())
360      tgt.setValue(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getValue()));
361    return tgt;
362  }
363
364  public static org.hl7.fhir.r4.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException {
365    if (src == null)
366      return null;
367    org.hl7.fhir.r4.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.PropertyComponent();
368    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
369    if (src.hasCode())
370      tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement()));
371    if (src.hasUri())
372      tgt.setUriElement(Uri30_40.convertUri(src.getUriElement()));
373    if (src.hasDescription())
374      tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement()));
375    if (src.hasType())
376      tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
377    return tgt;
378  }
379
380  public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.PropertyComponent src) throws FHIRException {
381    if (src == null)
382      return null;
383    org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent();
384    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
385    if (src.hasCode())
386      tgt.setCodeElement(Code30_40.convertCode(src.getCodeElement()));
387    if (src.hasUri())
388      tgt.setUriElement(Uri30_40.convertUri(src.getUriElement()));
389    if (src.hasDescription())
390      tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement()));
391    if (src.hasType())
392      tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
393    return tgt;
394  }
395
396  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> src) throws FHIRException {
397    if (src == null || src.isEmpty())
398      return null;
399    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.PropertyType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CodeSystem.PropertyTypeEnumFactory());
400    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
401    switch (src.getValue()) {
402      case CODE:
403        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODE);
404        break;
405      case CODING:
406        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODING);
407        break;
408      case STRING:
409        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.STRING);
410        break;
411      case INTEGER:
412        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.INTEGER);
413        break;
414      case BOOLEAN:
415        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.BOOLEAN);
416        break;
417      case DATETIME:
418        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.DATETIME);
419        break;
420      default:
421        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.NULL);
422        break;
423    }
424    return tgt;
425  }
426
427  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.PropertyType> src) throws FHIRException {
428    if (src == null || src.isEmpty())
429      return null;
430    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.PropertyTypeEnumFactory());
431    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
432    switch (src.getValue()) {
433      case CODE:
434        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE);
435        break;
436      case CODING:
437        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING);
438        break;
439      case STRING:
440        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING);
441        break;
442      case INTEGER:
443        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER);
444        break;
445      case BOOLEAN:
446        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN);
447        break;
448      case DATETIME:
449        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME);
450        break;
451      default:
452        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL);
453        break;
454    }
455    return tgt;
456  }
457
458  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.FilterOperator> convertFilterOperator(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator> src) {
459    if (src == null || src.isEmpty())
460      return null;
461    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.FilterOperator> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CodeSystem.FilterOperatorEnumFactory());
462    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
463    switch (src.getValue()) {
464      case EQUAL:
465        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EQUAL);
466        break;
467      case ISA:
468        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISA);
469        break;
470      case DESCENDENTOF:
471        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.DESCENDENTOF);
472        break;
473      case ISNOTA:
474        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISNOTA);
475        break;
476      case REGEX:
477        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.REGEX);
478        break;
479      case IN:
480        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.IN);
481        break;
482      case NOTIN:
483        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NOTIN);
484        break;
485      case GENERALIZES:
486        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.GENERALIZES);
487        break;
488      case EXISTS:
489        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EXISTS);
490        break;
491      default:
492        tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NULL);
493        break;
494    }
495    return tgt;
496  }
497
498  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator> convertFilterOperator(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.FilterOperator> src) {
499    if (src == null || src.isEmpty())
500      return null;
501    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.FilterOperatorEnumFactory());
502    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
503    switch (src.getValue()) {
504      case EQUAL:
505        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EQUAL);
506        break;
507      case ISA:
508        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISA);
509        break;
510      case DESCENDENTOF:
511        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.DESCENDENTOF);
512        break;
513      case ISNOTA:
514        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISNOTA);
515        break;
516      case REGEX:
517        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.REGEX);
518        break;
519      case IN:
520        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.IN);
521        break;
522      case NOTIN:
523        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NOTIN);
524        break;
525      case GENERALIZES:
526        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.GENERALIZES);
527        break;
528      case EXISTS:
529        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EXISTS);
530        break;
531      default:
532        tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NULL);
533        break;
534    }
535    return tgt;
536  }
537}