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