001package org.hl7.fhir.convertors.conv30_50;
002
003import org.hl7.fhir.convertors.VersionConvertorConstants;
004import org.hl7.fhir.convertors.VersionConvertor_30_50;
005import org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence;
006import org.hl7.fhir.exceptions.FHIRException;
007import org.hl7.fhir.r5.model.Enumeration;
008import org.hl7.fhir.r5.model.Enumerations;
009import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
010import org.hl7.fhir.r5.utils.ToolingExtensions;
011
012public class ConceptMap30_50 {
013
014    public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException {
015        if (src == null)
016            return null;
017        org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap();
018        VersionConvertor_30_50.copyDomainResource(src, tgt);
019        if (src.hasUrl())
020            tgt.setUrlElement(VersionConvertor_30_50.convertUri(src.getUrlElement()));
021        if (src.hasIdentifier())
022            tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifierFirstRep()));
023        if (src.hasVersion())
024            tgt.setVersionElement(VersionConvertor_30_50.convertString(src.getVersionElement()));
025        if (src.hasName())
026            tgt.setNameElement(VersionConvertor_30_50.convertString(src.getNameElement()));
027        if (src.hasTitle())
028            tgt.setTitleElement(VersionConvertor_30_50.convertString(src.getTitleElement()));
029        if (src.hasStatus())
030            tgt.setStatusElement(VersionConvertor_30_50.convertPublicationStatus(src.getStatusElement()));
031        if (src.hasExperimental())
032            tgt.setExperimentalElement(VersionConvertor_30_50.convertBoolean(src.getExperimentalElement()));
033        if (src.hasDate())
034            tgt.setDateElement(VersionConvertor_30_50.convertDateTime(src.getDateElement()));
035        if (src.hasPublisher())
036            tgt.setPublisherElement(VersionConvertor_30_50.convertString(src.getPublisherElement()));
037        for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t));
038        if (src.hasDescription())
039            tgt.setDescriptionElement(VersionConvertor_30_50.convertMarkdown(src.getDescriptionElement()));
040        for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t));
041        for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t));
042        if (src.hasPurpose())
043            tgt.setPurposeElement(VersionConvertor_30_50.convertMarkdown(src.getPurposeElement()));
044        if (src.hasCopyright())
045            tgt.setCopyrightElement(VersionConvertor_30_50.convertMarkdown(src.getCopyrightElement()));
046        if (src.hasSource())
047            tgt.setSource(VersionConvertor_30_50.convertType(src.getSource()));
048        if (src.hasTarget())
049            tgt.setTarget(VersionConvertor_30_50.convertType(src.getTarget()));
050        for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) tgt.addGroup(convertConceptMapGroupComponent(t));
051        return tgt;
052    }
053
054    public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException {
055        if (src == null)
056            return null;
057        org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap();
058        VersionConvertor_30_50.copyDomainResource(src, tgt);
059        if (src.hasUrl())
060            tgt.setUrlElement(VersionConvertor_30_50.convertUri(src.getUrlElement()));
061        if (src.hasIdentifier())
062            tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier()));
063        if (src.hasVersion())
064            tgt.setVersionElement(VersionConvertor_30_50.convertString(src.getVersionElement()));
065        if (src.hasName())
066            tgt.setNameElement(VersionConvertor_30_50.convertString(src.getNameElement()));
067        if (src.hasTitle())
068            tgt.setTitleElement(VersionConvertor_30_50.convertString(src.getTitleElement()));
069        if (src.hasStatus())
070            tgt.setStatusElement(VersionConvertor_30_50.convertPublicationStatus(src.getStatusElement()));
071        if (src.hasExperimental())
072            tgt.setExperimentalElement(VersionConvertor_30_50.convertBoolean(src.getExperimentalElement()));
073        if (src.hasDate())
074            tgt.setDateElement(VersionConvertor_30_50.convertDateTime(src.getDateElement()));
075        if (src.hasPublisher())
076            tgt.setPublisherElement(VersionConvertor_30_50.convertString(src.getPublisherElement()));
077        for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(VersionConvertor_30_50.convertContactDetail(t));
078        if (src.hasDescription())
079            tgt.setDescriptionElement(VersionConvertor_30_50.convertMarkdown(src.getDescriptionElement()));
080        for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(VersionConvertor_30_50.convertUsageContext(t));
081        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(VersionConvertor_30_50.convertCodeableConcept(t));
082        if (src.hasPurpose())
083            tgt.setPurposeElement(VersionConvertor_30_50.convertMarkdown(src.getPurposeElement()));
084        if (src.hasCopyright())
085            tgt.setCopyrightElement(VersionConvertor_30_50.convertMarkdown(src.getCopyrightElement()));
086        if (src.hasSource()) {
087            org.hl7.fhir.r5.model.DataType t = VersionConvertor_30_50.convertType(src.getSource());
088            tgt.setSource(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t);
089        }
090        if (src.hasTarget()) {
091            org.hl7.fhir.r5.model.DataType t = VersionConvertor_30_50.convertType(src.getTarget());
092            tgt.setTarget(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t);
093        }
094        for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) tgt.addGroup(convertConceptMapGroupComponent(t));
095        return tgt;
096    }
097
098    public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException {
099        if (src == null)
100            return null;
101        org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent();
102        VersionConvertor_30_50.copyElement(src, tgt);
103        if (src.hasSource())
104            tgt.setSourceElement(VersionConvertor_30_50.convertUri(src.getSourceElement()));
105        if (src.hasSourceVersion())
106            tgt.setSourceVersionElement(VersionConvertor_30_50.convertString(src.getSourceVersionElement()));
107        if (src.hasTarget())
108            tgt.setTarget(src.getTarget());
109        if (src.hasTargetVersion())
110            tgt.setTargetVersion(src.getTargetVersion());
111        for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t));
112        if (src.hasUnmapped())
113            tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped()));
114        return tgt;
115    }
116
117    public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException {
118        if (src == null)
119            return null;
120        org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent();
121        VersionConvertor_30_50.copyElement(src, tgt);
122        if (src.hasSource())
123            tgt.setSourceElement(VersionConvertor_30_50.convertUri(src.getSourceElement()));
124        if (src.hasSourceVersion())
125            tgt.setSourceVersionElement(VersionConvertor_30_50.convertString(src.getSourceVersionElement()));
126        if (src.hasTarget())
127            tgt.setTarget(src.getTarget());
128        if (src.hasTargetVersion())
129            tgt.setTargetVersion(src.getTargetVersion());
130        for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t));
131        if (src.hasUnmapped())
132            tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped()));
133        return tgt;
134    }
135
136    public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException {
137        if (src == null)
138            return null;
139        org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent();
140        VersionConvertor_30_50.copyElement(src, tgt);
141        if (src.hasMode())
142            tgt.setModeElement(convertConceptMapGroupUnmappedMode(src.getModeElement()));
143        if (src.hasCode())
144            tgt.setCodeElement(VersionConvertor_30_50.convertCode(src.getCodeElement()));
145        if (src.hasDisplay())
146            tgt.setDisplayElement(VersionConvertor_30_50.convertString(src.getDisplayElement()));
147        if (src.hasUrl())
148            tgt.setUrl(src.getUrl());
149        return tgt;
150    }
151
152    public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException {
153        if (src == null)
154            return null;
155        org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent();
156        VersionConvertor_30_50.copyElement(src, tgt);
157        if (src.hasMode())
158            tgt.setModeElement(convertConceptMapGroupUnmappedMode(src.getModeElement()));
159        if (src.hasCode())
160            tgt.setCodeElement(VersionConvertor_30_50.convertCode(src.getCodeElement()));
161        if (src.hasDisplay())
162            tgt.setDisplayElement(VersionConvertor_30_50.convertString(src.getDisplayElement()));
163        if (src.hasUrl())
164            tgt.setUrl(src.getUrl());
165        return tgt;
166    }
167
168    static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode> convertConceptMapGroupUnmappedMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode> src) throws FHIRException {
169        if (src == null || src.isEmpty())
170            return null;
171        org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedModeEnumFactory());
172        VersionConvertor_30_50.copyElement(src, tgt);
173        switch(src.getValue()) {
174            case PROVIDED:
175                tgt.setValue(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED);
176                break;
177            case FIXED:
178                tgt.setValue(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED);
179                break;
180            case OTHERMAP:
181                tgt.setValue(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP);
182                break;
183            default:
184                tgt.setValue(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL);
185                break;
186        }
187        return tgt;
188    }
189
190    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode> convertConceptMapGroupUnmappedMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode> src) throws FHIRException {
191        if (src == null || src.isEmpty())
192            return null;
193        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedModeEnumFactory());
194        VersionConvertor_30_50.copyElement(src, tgt);
195        switch(src.getValue()) {
196            case PROVIDED:
197                tgt.setValue(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED);
198                break;
199            case FIXED:
200                tgt.setValue(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED);
201                break;
202            case OTHERMAP:
203                tgt.setValue(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP);
204                break;
205            default:
206                tgt.setValue(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL);
207                break;
208        }
209        return tgt;
210    }
211
212    public static org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src) throws FHIRException {
213        if (src == null || src.isEmpty())
214            return null;
215        org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> tgt = new org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence>(new org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalenceEnumFactory());
216        VersionConvertor_30_50.copyElement(src, tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
217        if (src.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
218            tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
219        } else {
220            switch(src.getValue()) {
221                case EQUIVALENT:
222                    tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT);
223                    break;
224                case SOURCEISNARROWERTHANTARGET:
225                    tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER);
226                    break;
227                case SOURCEISBROADERTHANTARGET:
228                    tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER);
229                    break;
230                case NOTRELATEDTO:
231                    tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT);
232                    break;
233                default:
234                    tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL);
235                    break;
236            }
237        }
238        return tgt;
239    }
240
241    public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> src) throws FHIRException {
242        if (src == null || src.isEmpty())
243            return null;
244        Enumeration<ConceptMapRelationship> tgt = new Enumeration<ConceptMapRelationship>(new Enumerations.ConceptMapRelationshipEnumFactory());
245        VersionConvertor_30_50.copyElement(src, tgt);
246        ToolingExtensions.setCodeExtension(tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
247        switch(src.getValue()) {
248            case EQUIVALENT:
249                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT);
250                break;
251            case EQUAL:
252                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT);
253                break;
254            case WIDER:
255                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.SOURCEISNARROWERTHANTARGET);
256                break;
257            case SUBSUMES:
258                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.SOURCEISNARROWERTHANTARGET);
259                break;
260            case NARROWER:
261                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.SOURCEISBROADERTHANTARGET);
262                break;
263            case SPECIALIZES:
264                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.SOURCEISBROADERTHANTARGET);
265                break;
266            case INEXACT:
267                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.RELATEDTO);
268                break;
269            case UNMATCHED:
270                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL);
271                break;
272            case DISJOINT:
273                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NOTRELATEDTO);
274                break;
275            default:
276                tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.NULL);
277                break;
278        }
279        return tgt;
280    }
281
282    public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException {
283        if (src == null)
284            return null;
285        org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent();
286        VersionConvertor_30_50.copyElement(src, tgt);
287        if (src.hasProperty())
288            tgt.setPropertyElement(VersionConvertor_30_50.convertUri(src.getPropertyElement()));
289        if (src.hasSystem())
290            tgt.setSystem(src.getSystem());
291        if (src.hasCode())
292            tgt.setValueElement(VersionConvertor_30_50.convertString(src.getCodeElement()));
293        if (src.hasDisplay())
294            tgt.setDisplayElement(VersionConvertor_30_50.convertString(src.getDisplayElement()));
295        return tgt;
296    }
297
298    public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException {
299        if (src == null)
300            return null;
301        org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent();
302        VersionConvertor_30_50.copyElement(src, tgt);
303        if (src.hasProperty())
304            tgt.setPropertyElement(VersionConvertor_30_50.convertUri(src.getPropertyElement()));
305        if (src.hasSystem())
306            tgt.setSystem(src.getSystem());
307        if (src.hasValue())
308            tgt.setCodeElement(VersionConvertor_30_50.convertString(src.getValueElement()));
309        if (src.hasDisplay())
310            tgt.setDisplayElement(VersionConvertor_30_50.convertString(src.getDisplayElement()));
311        return tgt;
312    }
313
314    public static org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src) throws FHIRException {
315        if (src == null)
316            return null;
317        org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent();
318        VersionConvertor_30_50.copyElement(src, tgt);
319        if (src.hasCode())
320            tgt.setCodeElement(VersionConvertor_30_50.convertCode(src.getCodeElement()));
321        if (src.hasDisplay())
322            tgt.setDisplayElement(VersionConvertor_30_50.convertString(src.getDisplayElement()));
323        if (src.hasNoMap() && src.getNoMap() == true) {
324            tgt.addTarget(new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent().setEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED));
325        } else {
326            for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) tgt.addTarget(convertTargetElementComponent(t));
327        }
328        return tgt;
329    }
330
331    public static org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src) throws FHIRException {
332        if (src == null)
333            return null;
334        org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent();
335        VersionConvertor_30_50.copyElement(src, tgt);
336        if (src.hasCode())
337            tgt.setCodeElement(VersionConvertor_30_50.convertCode(src.getCodeElement()));
338        if (src.hasDisplay())
339            tgt.setDisplayElement(VersionConvertor_30_50.convertString(src.getDisplayElement()));
340        for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) if (t.getEquivalence() == org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED) {
341            tgt.setNoMap(true);
342        } else {
343            tgt.addTarget(convertTargetElementComponent(t));
344        }
345        return tgt;
346    }
347
348    public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src) throws FHIRException {
349        if (src == null)
350            return null;
351        org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent();
352        VersionConvertor_30_50.copyElement(src, tgt);
353        if (src.hasCode())
354            tgt.setCodeElement(VersionConvertor_30_50.convertCode(src.getCodeElement()));
355        if (src.hasDisplay())
356            tgt.setDisplayElement(VersionConvertor_30_50.convertString(src.getDisplayElement()));
357        if (src.hasEquivalence())
358            tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement()));
359        if (src.hasComment())
360            tgt.setCommentElement(VersionConvertor_30_50.convertString(src.getCommentElement()));
361        for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t));
362        for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t));
363        return tgt;
364    }
365
366    public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src) throws FHIRException {
367        if (src == null)
368            return null;
369        org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent();
370        VersionConvertor_30_50.copyElement(src, tgt);
371        if (src.hasCode())
372            tgt.setCodeElement(VersionConvertor_30_50.convertCode(src.getCodeElement()));
373        if (src.hasDisplay())
374            tgt.setDisplayElement(VersionConvertor_30_50.convertString(src.getDisplayElement()));
375        if (src.hasRelationship())
376            tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement()));
377        if (src.hasComment())
378            tgt.setCommentElement(VersionConvertor_30_50.convertString(src.getCommentElement()));
379        for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t));
380        for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) tgt.addProduct(convertOtherElementComponent(t));
381        return tgt;
382    }
383}