001package org.hl7.fhir.convertors.conv40_50;
002
003
004import org.hl7.fhir.convertors.VersionConvertor_40_50;
005import org.hl7.fhir.exceptions.FHIRException;
006
007import java.util.stream.Collectors;
008
009/*
010  Copyright (c) 2011+, HL7, Inc.
011  All rights reserved.
012  
013  Redistribution and use in source and binary forms, with or without modification, 
014  are permitted provided that the following conditions are met:
015  
016   * Redistributions of source code must retain the above copyright notice, this 
017     list of conditions and the following disclaimer.
018   * Redistributions in binary form must reproduce the above copyright notice, 
019     this list of conditions and the following disclaimer in the documentation 
020     and/or other materials provided with the distribution.
021   * Neither the name of HL7 nor the names of its contributors may be used to 
022     endorse or promote products derived from this software without specific 
023     prior written permission.
024  
025  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
026  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
027  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
028  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
029  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
030  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
031  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
032  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
033  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
034  POSSIBILITY OF SUCH DAMAGE.
035  
036*/
037// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
038public class CodeSystem40_50 extends VersionConvertor_40_50 {
039
040    public static org.hl7.fhir.r5.model.CodeSystem convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException {
041        if (src == null)
042            return null;
043        org.hl7.fhir.r5.model.CodeSystem tgt = new org.hl7.fhir.r5.model.CodeSystem();
044        copyDomainResource(src, tgt);
045        if (src.hasUrl())
046            tgt.setUrlElement(convertUri(src.getUrlElement()));
047        for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
048        if (src.hasVersion())
049            tgt.setVersionElement(convertString(src.getVersionElement()));
050        if (src.hasName())
051            tgt.setNameElement(convertString(src.getNameElement()));
052        if (src.hasTitle())
053            tgt.setTitleElement(convertString(src.getTitleElement()));
054        if (src.hasStatus())
055            tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
056        if (src.hasExperimental())
057            tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement()));
058        if (src.hasDate())
059            tgt.setDateElement(convertDateTime(src.getDateElement()));
060        if (src.hasPublisher())
061            tgt.setPublisherElement(convertString(src.getPublisherElement()));
062        for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertContactDetail(t));
063        if (src.hasDescription())
064            tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement()));
065        for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) tgt.addUseContext(convertUsageContext(t));
066        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(convertCodeableConcept(t));
067        if (src.hasPurpose())
068            tgt.setPurposeElement(convertMarkdown(src.getPurposeElement()));
069        if (src.hasCopyright())
070            tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement()));
071        if (src.hasCaseSensitive())
072            tgt.setCaseSensitiveElement(convertBoolean(src.getCaseSensitiveElement()));
073        if (src.hasValueSet())
074            tgt.setValueSetElement(convertCanonical(src.getValueSetElement()));
075        if (src.hasHierarchyMeaning())
076            tgt.setHierarchyMeaningElement(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaningElement()));
077        if (src.hasCompositional())
078            tgt.setCompositionalElement(convertBoolean(src.getCompositionalElement()));
079        if (src.hasVersionNeeded())
080            tgt.setVersionNeededElement(convertBoolean(src.getVersionNeededElement()));
081        if (src.hasContent())
082            tgt.setContentElement(convertCodeSystemContentMode(src.getContentElement()));
083        if (src.hasSupplements())
084            tgt.setSupplementsElement(convertCanonical(src.getSupplementsElement()));
085        if (src.hasCount())
086            tgt.setCountElement(convertUnsignedInt(src.getCountElement()));
087        for (org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t));
088        for (org.hl7.fhir.r4.model.CodeSystem.PropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t));
089        for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t));
090        return tgt;
091    }
092
093    public static org.hl7.fhir.r4.model.CodeSystem convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException {
094        if (src == null)
095            return null;
096        org.hl7.fhir.r4.model.CodeSystem tgt = new org.hl7.fhir.r4.model.CodeSystem();
097        copyDomainResource(src, tgt);
098        if (src.hasUrl())
099            tgt.setUrlElement(convertUri(src.getUrlElement()));
100        for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
101        if (src.hasVersion())
102            tgt.setVersionElement(convertString(src.getVersionElement()));
103        if (src.hasName())
104            tgt.setNameElement(convertString(src.getNameElement()));
105        if (src.hasTitle())
106            tgt.setTitleElement(convertString(src.getTitleElement()));
107        if (src.hasStatus())
108            tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
109        if (src.hasExperimental())
110            tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement()));
111        if (src.hasDate())
112            tgt.setDateElement(convertDateTime(src.getDateElement()));
113        if (src.hasPublisher())
114            tgt.setPublisherElement(convertString(src.getPublisherElement()));
115        for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertContactDetail(t));
116        if (src.hasDescription())
117            tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement()));
118        for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(convertUsageContext(t));
119        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(convertCodeableConcept(t));
120        if (src.hasPurpose())
121            tgt.setPurposeElement(convertMarkdown(src.getPurposeElement()));
122        if (src.hasCopyright())
123            tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement()));
124        if (src.hasCaseSensitive())
125            tgt.setCaseSensitiveElement(convertBoolean(src.getCaseSensitiveElement()));
126        if (src.hasValueSet())
127            tgt.setValueSetElement(convertCanonical(src.getValueSetElement()));
128        if (src.hasHierarchyMeaning())
129            tgt.setHierarchyMeaningElement(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaningElement()));
130        if (src.hasCompositional())
131            tgt.setCompositionalElement(convertBoolean(src.getCompositionalElement()));
132        if (src.hasVersionNeeded())
133            tgt.setVersionNeededElement(convertBoolean(src.getVersionNeededElement()));
134        if (src.hasContent())
135            tgt.setContentElement(convertCodeSystemContentMode(src.getContentElement()));
136        if (src.hasSupplements())
137            tgt.setSupplementsElement(convertCanonical(src.getSupplementsElement()));
138        if (src.hasCount())
139            tgt.setCountElement(convertUnsignedInt(src.getCountElement()));
140        for (org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) tgt.addFilter(convertCodeSystemFilterComponent(t));
141        for (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent t : src.getProperty()) tgt.addProperty(convertPropertyComponent(t));
142        for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t));
143        return tgt;
144    }
145
146    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning> convertCodeSystemHierarchyMeaning(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning> src) throws FHIRException {
147        if (src == null || src.isEmpty())
148            return null;
149        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaningEnumFactory());
150        VersionConvertor_40_50.copyElement(src, tgt);
151        switch(src.getValue()) {
152            case GROUPEDBY:
153                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY);
154                break;
155            case ISA:
156                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.ISA);
157                break;
158            case PARTOF:
159                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF);
160                break;
161            case CLASSIFIEDWITH:
162                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
163                break;
164            default:
165                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.NULL);
166                break;
167        }
168        return tgt;
169    }
170
171    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning> convertCodeSystemHierarchyMeaning(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning> src) throws FHIRException {
172        if (src == null || src.isEmpty())
173            return null;
174        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());
175        VersionConvertor_40_50.copyElement(src, tgt);
176        switch(src.getValue()) {
177            case GROUPEDBY:
178                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY);
179                break;
180            case ISA:
181                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.ISA);
182                break;
183            case PARTOF:
184                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF);
185                break;
186            case CLASSIFIEDWITH:
187                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
188                break;
189            default:
190                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.NULL);
191                break;
192        }
193        return tgt;
194    }
195
196    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
197        if (src == null || src.isEmpty())
198            return null;
199        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentModeEnumFactory());
200        VersionConvertor_40_50.copyElement(src, tgt);
201        switch(src.getValue()) {
202            case NOTPRESENT:
203                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NOTPRESENT);
204                break;
205            case EXAMPLE:
206                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.EXAMPLE);
207                break;
208            case FRAGMENT:
209                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.FRAGMENT);
210                break;
211            case COMPLETE:
212                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE);
213                break;
214            case SUPPLEMENT:
215                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.SUPPLEMENT);
216                break;
217            default:
218                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NULL);
219                break;
220        }
221        return tgt;
222    }
223
224    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
225        if (src == null || src.isEmpty())
226            return null;
227        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());
228        VersionConvertor_40_50.copyElement(src, tgt);
229        switch(src.getValue()) {
230            case NOTPRESENT:
231                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NOTPRESENT);
232                break;
233            case EXAMPLE:
234                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.EXAMPLE);
235                break;
236            case FRAGMENT:
237                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.FRAGMENT);
238                break;
239            case COMPLETE:
240                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.COMPLETE);
241                break;
242            case SUPPLEMENT:
243                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.SUPPLEMENT);
244                break;
245            default:
246                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NULL);
247                break;
248        }
249        return tgt;
250    }
251
252    public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
253        if (src == null)
254            return null;
255        org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent();
256        copyElement(src, tgt);
257        if (src.hasCode())
258            tgt.setCodeElement(convertCode(src.getCodeElement()));
259        if (src.hasDescription())
260            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
261        tgt.setOperator(src.getOperator().stream()
262                .map(CodeSystem40_50::convertFilterOperator)
263                .collect(Collectors.toList()));
264        if (src.hasValue())
265            tgt.setValueElement(convertString(src.getValueElement()));
266        return tgt;
267    }
268
269    public static org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
270        if (src == null)
271            return null;
272        org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent();
273        copyElement(src, tgt);
274        if (src.hasCode())
275            tgt.setCodeElement(convertCode(src.getCodeElement()));
276        if (src.hasDescription())
277            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
278        tgt.setOperator(src.getOperator().stream()
279                .map(CodeSystem40_50::convertFilterOperator)
280                .collect(Collectors.toList()));
281        if (src.hasValue())
282            tgt.setValueElement(convertString(src.getValueElement()));
283        return tgt;
284    }
285
286    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.CodeSystem.FilterOperator> src) throws FHIRException {
287        if (src == null || src.isEmpty())
288            return null;
289        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());
290        VersionConvertor_40_50.copyElement(src, tgt);
291        switch(src.getValue()) {
292            case EQUAL:
293                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL);
294                break;
295            case ISA:
296                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA);
297                break;
298            case DESCENDENTOF:
299                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.DESCENDENTOF);
300                break;
301            case ISNOTA:
302                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA);
303                break;
304            case REGEX:
305                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX);
306                break;
307            case IN:
308                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN);
309                break;
310            case NOTIN:
311                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN);
312                break;
313            case GENERALIZES:
314                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.GENERALIZES);
315                break;
316            case EXISTS:
317                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.EXISTS);
318                break;
319            default:
320                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL);
321                break;
322        }
323        return tgt;
324    }
325
326    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.FilterOperator> convertFilterOperator(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FilterOperator> src) throws FHIRException {
327        if (src == null || src.isEmpty())
328            return null;
329        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());
330        VersionConvertor_40_50.copyElement(src, tgt);
331        switch(src.getValue()) {
332            case EQUAL:
333                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EQUAL);
334                break;
335            case ISA:
336                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISA);
337                break;
338            case DESCENDENTOF:
339                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.DESCENDENTOF);
340                break;
341            case ISNOTA:
342                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISNOTA);
343                break;
344            case REGEX:
345                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.REGEX);
346                break;
347            case IN:
348                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.IN);
349                break;
350            case NOTIN:
351                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NOTIN);
352                break;
353            case GENERALIZES:
354                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.GENERALIZES);
355                break;
356            case EXISTS:
357                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EXISTS);
358                break;
359            default:
360                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NULL);
361                break;
362        }
363        return tgt;
364    }
365
366    public static org.hl7.fhir.r5.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.PropertyComponent src) throws FHIRException {
367        if (src == null)
368            return null;
369        org.hl7.fhir.r5.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.PropertyComponent();
370        copyElement(src, tgt);
371        if (src.hasCode())
372            tgt.setCodeElement(convertCode(src.getCodeElement()));
373        if (src.hasUri())
374            tgt.setUriElement(convertUri(src.getUriElement()));
375        if (src.hasDescription())
376            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
377        if (src.hasType())
378            tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
379        return tgt;
380    }
381
382    public static org.hl7.fhir.r4.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.PropertyComponent src) throws FHIRException {
383        if (src == null)
384            return null;
385        org.hl7.fhir.r4.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.PropertyComponent();
386        copyElement(src, tgt);
387        if (src.hasCode())
388            tgt.setCodeElement(convertCode(src.getCodeElement()));
389        if (src.hasUri())
390            tgt.setUriElement(convertUri(src.getUriElement()));
391        if (src.hasDescription())
392            tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
393        if (src.hasType())
394            tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
395        return tgt;
396    }
397
398    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.PropertyType> src) throws FHIRException {
399        if (src == null || src.isEmpty())
400            return null;
401        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.PropertyType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CodeSystem.PropertyTypeEnumFactory());
402        VersionConvertor_40_50.copyElement(src, tgt);
403        switch(src.getValue()) {
404            case CODE:
405                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODE);
406                break;
407            case CODING:
408                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODING);
409                break;
410            case STRING:
411                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.STRING);
412                break;
413            case INTEGER:
414                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.INTEGER);
415                break;
416            case BOOLEAN:
417                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.BOOLEAN);
418                break;
419            case DATETIME:
420                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.DATETIME);
421                break;
422            case DECIMAL:
423                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.DECIMAL);
424                break;
425            default:
426                tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.NULL);
427                break;
428        }
429        return tgt;
430    }
431
432    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.PropertyType> src) throws FHIRException {
433        if (src == null || src.isEmpty())
434            return null;
435        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());
436        VersionConvertor_40_50.copyElement(src, tgt);
437        switch(src.getValue()) {
438            case CODE:
439                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODE);
440                break;
441            case CODING:
442                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODING);
443                break;
444            case STRING:
445                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.STRING);
446                break;
447            case INTEGER:
448                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.INTEGER);
449                break;
450            case BOOLEAN:
451                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.BOOLEAN);
452                break;
453            case DATETIME:
454                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.DATETIME);
455                break;
456            case DECIMAL:
457                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.DECIMAL);
458                break;
459            default:
460                tgt.setValue(org.hl7.fhir.r4.model.CodeSystem.PropertyType.NULL);
461                break;
462        }
463        return tgt;
464    }
465
466    public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException {
467        if (src == null)
468            return null;
469        org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent();
470        copyElement(src, tgt);
471        if (src.hasCode())
472            tgt.setCodeElement(convertCode(src.getCodeElement()));
473        if (src.hasDisplay())
474            tgt.setDisplayElement(convertString(src.getDisplayElement()));
475        if (src.hasDefinition())
476            tgt.setDefinitionElement(convertString(src.getDefinitionElement()));
477        for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t));
478        for (org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t));
479        for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t));
480        return tgt;
481    }
482
483    public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException {
484        if (src == null)
485            return null;
486        org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent();
487        copyElement(src, tgt);
488        if (src.hasCode())
489            tgt.setCodeElement(convertCode(src.getCodeElement()));
490        if (src.hasDisplay())
491            tgt.setDisplayElement(convertString(src.getDisplayElement()));
492        if (src.hasDefinition())
493            tgt.setDefinitionElement(convertString(src.getDefinitionElement()));
494        for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) tgt.addDesignation(convertConceptDefinitionDesignationComponent(t));
495        for (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) tgt.addProperty(convertConceptPropertyComponent(t));
496        for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) tgt.addConcept(convertConceptDefinitionComponent(t));
497        return tgt;
498    }
499
500    public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
501        if (src == null)
502            return null;
503        org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent();
504        copyElement(src, tgt);
505        if (src.hasLanguage())
506            tgt.setLanguageElement(convertCode(src.getLanguageElement()));
507        if (src.hasUse())
508            tgt.setUse(convertCoding(src.getUse()));
509        if (src.hasValue())
510            tgt.setValueElement(convertString(src.getValueElement()));
511        return tgt;
512    }
513
514    public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
515        if (src == null)
516            return null;
517        org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent();
518        copyElement(src, tgt);
519        if (src.hasLanguage())
520            tgt.setLanguageElement(convertCode(src.getLanguageElement()));
521        if (src.hasUse())
522            tgt.setUse(convertCoding(src.getUse()));
523        if (src.hasValue())
524            tgt.setValueElement(convertString(src.getValueElement()));
525        return tgt;
526    }
527
528    public static org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException {
529        if (src == null)
530            return null;
531        org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent();
532        copyElement(src, tgt);
533        if (src.hasCode())
534            tgt.setCodeElement(convertCode(src.getCodeElement()));
535        if (src.hasValue())
536            tgt.setValue(convertType(src.getValue()));
537        return tgt;
538    }
539
540    public static org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException {
541        if (src == null)
542            return null;
543        org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent();
544        copyElement(src, tgt);
545        if (src.hasCode())
546            tgt.setCodeElement(convertCode(src.getCodeElement()));
547        if (src.hasValue())
548            tgt.setValue(convertType(src.getValue()));
549        return tgt;
550    }
551}