001package org.hl7.fhir.convertors.conv30_40;
002
003import org.hl7.fhir.convertors.VersionConvertor_30_40;
004import org.hl7.fhir.exceptions.FHIRException;
005
006import java.util.Collections;
007
008public class Composition30_40 {
009
010    public static org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.r4.model.Composition src) throws FHIRException {
011        if (src == null)
012            return null;
013        org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition();
014        VersionConvertor_30_40.copyDomainResource(src, tgt);
015        if (src.hasIdentifier())
016            tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier()));
017        if (src.hasStatus())
018            tgt.setStatusElement(convertCompositionStatus(src.getStatusElement()));
019        if (src.hasType())
020            tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType()));
021        if (src.hasCategory())
022            tgt.setClass_(VersionConvertor_30_40.convertCodeableConcept(src.getCategoryFirstRep()));
023        if (src.hasSubject())
024            tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject()));
025        if (src.hasEncounter())
026            tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter()));
027        if (src.hasDateElement())
028            tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement()));
029        for (org.hl7.fhir.r4.model.Reference t : src.getAuthor())
030            tgt.addAuthor(VersionConvertor_30_40.convertReference(t));
031        if (src.hasTitle())
032            tgt.setTitleElement(VersionConvertor_30_40.convertString(src.getTitleElement()));
033        if (src.hasConfidentiality())
034            tgt.setConfidentialityElement(convertDocumentConfidentiality(src.getConfidentialityElement()));
035        for (org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent t : src.getAttester())
036            tgt.addAttester(convertCompositionAttesterComponent(t));
037        if (src.hasCustodian())
038            tgt.setCustodian(VersionConvertor_30_40.convertReference(src.getCustodian()));
039        for (org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo())
040            tgt.addRelatesTo(convertCompositionRelatesToComponent(t));
041        for (org.hl7.fhir.r4.model.Composition.CompositionEventComponent t : src.getEvent())
042            tgt.addEvent(convertCompositionEventComponent(t));
043        for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection())
044            tgt.addSection(convertSectionComponent(t));
045        return tgt;
046    }
047
048    public static org.hl7.fhir.r4.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException {
049        if (src == null)
050            return null;
051        org.hl7.fhir.r4.model.Composition tgt = new org.hl7.fhir.r4.model.Composition();
052        VersionConvertor_30_40.copyDomainResource(src, tgt);
053        if (src.hasIdentifier())
054            tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier()));
055        if (src.hasStatus())
056            tgt.setStatusElement(convertCompositionStatus(src.getStatusElement()));
057        if (src.hasType())
058            tgt.setType(VersionConvertor_30_40.convertCodeableConcept(src.getType()));
059        if (src.hasClass_())
060            tgt.addCategory(VersionConvertor_30_40.convertCodeableConcept(src.getClass_()));
061        if (src.hasSubject())
062            tgt.setSubject(VersionConvertor_30_40.convertReference(src.getSubject()));
063        if (src.hasEncounter())
064            tgt.setEncounter(VersionConvertor_30_40.convertReference(src.getEncounter()));
065        if (src.hasDateElement())
066            tgt.setDateElement(VersionConvertor_30_40.convertDateTime(src.getDateElement()));
067        for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor())
068            tgt.addAuthor(VersionConvertor_30_40.convertReference(t));
069        if (src.hasTitle())
070            tgt.setTitleElement(VersionConvertor_30_40.convertString(src.getTitleElement()));
071        if (src.hasConfidentiality())
072            tgt.setConfidentialityElement(convertDocumentConfidentiality(src.getConfidentialityElement()));
073        for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester())
074            tgt.addAttester(convertCompositionAttesterComponent(t));
075        if (src.hasCustodian())
076            tgt.setCustodian(VersionConvertor_30_40.convertReference(src.getCustodian()));
077        for (org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo())
078            tgt.addRelatesTo(convertCompositionRelatesToComponent(t));
079        for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent())
080            tgt.addEvent(convertCompositionEventComponent(t));
081        for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection())
082            tgt.addSection(convertSectionComponent(t));
083        return tgt;
084    }
085
086    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode> convertCompositionAttestationMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionAttestationMode> src) throws FHIRException {
087        if (src == null || src.isEmpty())
088            return null;
089        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Composition.CompositionAttestationModeEnumFactory());
090        VersionConvertor_30_40.copyElement(src, tgt);
091        switch (src.getValue()) {
092            case PERSONAL:
093                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL);
094                break;
095            case PROFESSIONAL:
096                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL);
097                break;
098            case LEGAL:
099                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL);
100                break;
101            case OFFICIAL:
102                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL);
103                break;
104            default:
105                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL);
106                break;
107        }
108        return tgt;
109    }
110
111    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionAttestationMode> convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode> src) throws FHIRException {
112        if (src == null || src.isEmpty())
113            return null;
114        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionAttestationMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.CompositionAttestationModeEnumFactory());
115        VersionConvertor_30_40.copyElement(src, tgt);
116        switch (src.getValue()) {
117            case PERSONAL:
118                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL);
119                break;
120            case PROFESSIONAL:
121                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL);
122                break;
123            case LEGAL:
124                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL);
125                break;
126            case OFFICIAL:
127                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL);
128                break;
129            default:
130                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL);
131                break;
132        }
133        return tgt;
134    }
135
136    public static org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent src) throws FHIRException {
137        if (src == null)
138            return null;
139        org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent();
140        VersionConvertor_30_40.copyElement(src, tgt);
141        if (src.hasMode())
142            tgt.setMode(Collections.singletonList(convertCompositionAttestationMode(src.getModeElement())));
143        if (src.hasTime())
144            tgt.setTimeElement(VersionConvertor_30_40.convertDateTime(src.getTimeElement()));
145        if (src.hasParty())
146            tgt.setParty(VersionConvertor_30_40.convertReference(src.getParty()));
147        return tgt;
148    }
149
150    public static org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException {
151        if (src == null)
152            return null;
153        org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent();
154        VersionConvertor_30_40.copyElement(src, tgt);
155        if (src.hasMode())
156            tgt.setModeElement(convertCompositionAttestationMode(src.getMode().get(0)));
157        if (src.hasTime())
158            tgt.setTimeElement(VersionConvertor_30_40.convertDateTime(src.getTimeElement()));
159        if (src.hasParty())
160            tgt.setParty(VersionConvertor_30_40.convertReference(src.getParty()));
161        return tgt;
162    }
163
164    public static org.hl7.fhir.r4.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException {
165        if (src == null)
166            return null;
167        org.hl7.fhir.r4.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionEventComponent();
168        VersionConvertor_30_40.copyElement(src, tgt);
169        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode())
170            tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t));
171        if (src.hasPeriod())
172            tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod()));
173        for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail())
174            tgt.addDetail(VersionConvertor_30_40.convertReference(t));
175        return tgt;
176    }
177
178    public static org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r4.model.Composition.CompositionEventComponent src) throws FHIRException {
179        if (src == null)
180            return null;
181        org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent();
182        VersionConvertor_30_40.copyElement(src, tgt);
183        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode())
184            tgt.addCode(VersionConvertor_30_40.convertCodeableConcept(t));
185        if (src.hasPeriod())
186            tgt.setPeriod(VersionConvertor_30_40.convertPeriod(src.getPeriod()));
187        for (org.hl7.fhir.r4.model.Reference t : src.getDetail())
188            tgt.addDetail(VersionConvertor_30_40.convertReference(t));
189        return tgt;
190    }
191
192    public static org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent src) throws FHIRException {
193        if (src == null)
194            return null;
195        org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent();
196        VersionConvertor_30_40.copyElement(src, tgt);
197        if (src.hasCode())
198            tgt.setCodeElement(convertDocumentRelationshipType(src.getCodeElement()));
199        if (src.hasTarget())
200            tgt.setTarget(VersionConvertor_30_40.convertType(src.getTarget()));
201        return tgt;
202    }
203
204    public static org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent src) throws FHIRException {
205        if (src == null)
206            return null;
207        org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent();
208        VersionConvertor_30_40.copyElement(src, tgt);
209        if (src.hasCode())
210            tgt.setCodeElement(convertDocumentRelationshipType(src.getCodeElement()));
211        if (src.hasTarget())
212            tgt.setTarget(VersionConvertor_30_40.convertType(src.getTarget()));
213        return tgt;
214    }
215
216    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionStatus> convertCompositionStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.CompositionStatus> src) throws FHIRException {
217        if (src == null || src.isEmpty())
218            return null;
219        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.CompositionStatusEnumFactory());
220        VersionConvertor_30_40.copyElement(src, tgt);
221        switch (src.getValue()) {
222            case PRELIMINARY:
223                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY);
224                break;
225            case FINAL:
226                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL);
227                break;
228            case AMENDED:
229                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED);
230                break;
231            case ENTEREDINERROR:
232                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR);
233                break;
234            default:
235                tgt.setValue(org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL);
236                break;
237        }
238        return tgt;
239    }
240
241    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.CompositionStatus> convertCompositionStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.CompositionStatus> src) throws FHIRException {
242        if (src == null || src.isEmpty())
243            return null;
244        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.CompositionStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Composition.CompositionStatusEnumFactory());
245        VersionConvertor_30_40.copyElement(src, tgt);
246        switch (src.getValue()) {
247            case PRELIMINARY:
248                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY);
249                break;
250            case FINAL:
251                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL);
252                break;
253            case AMENDED:
254                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED);
255                break;
256            case ENTEREDINERROR:
257                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR);
258                break;
259            default:
260                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL);
261                break;
262        }
263        return tgt;
264    }
265
266    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentConfidentiality> convertDocumentConfidentiality(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality> src) throws FHIRException {
267        if (src == null || src.isEmpty())
268            return null;
269        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentConfidentiality> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.DocumentConfidentialityEnumFactory());
270        VersionConvertor_30_40.copyElement(src, tgt);
271        switch (src.getValue()) {
272            case U:
273                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.U);
274                break;
275            case L:
276                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.L);
277                break;
278            case M:
279                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.M);
280                break;
281            case N:
282                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.N);
283                break;
284            case R:
285                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.R);
286                break;
287            case V:
288                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.V);
289                break;
290            default:
291                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.NULL);
292                break;
293        }
294        return tgt;
295    }
296
297    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality> convertDocumentConfidentiality(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentConfidentiality> src) throws FHIRException {
298        if (src == null || src.isEmpty())
299            return null;
300        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Composition.DocumentConfidentialityEnumFactory());
301        VersionConvertor_30_40.copyElement(src, tgt);
302        switch (src.getValue()) {
303            case U:
304                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.U);
305                break;
306            case L:
307                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.L);
308                break;
309            case M:
310                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.M);
311                break;
312            case N:
313                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.N);
314                break;
315            case R:
316                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.R);
317                break;
318            case V:
319                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.V);
320                break;
321            default:
322                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.NULL);
323                break;
324        }
325        return tgt;
326    }
327
328    public static org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException {
329        if (src == null)
330            return null;
331        org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent();
332        VersionConvertor_30_40.copyElement(src, tgt);
333        if (src.hasTitle())
334            tgt.setTitleElement(VersionConvertor_30_40.convertString(src.getTitleElement()));
335        if (src.hasCode())
336            tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode()));
337        if (src.hasText())
338            tgt.setText(VersionConvertor_30_40.convertNarrative(src.getText()));
339        if (src.hasMode())
340            tgt.setModeElement(convertSectionMode(src.getModeElement()));
341        if (src.hasOrderedBy())
342            tgt.setOrderedBy(VersionConvertor_30_40.convertCodeableConcept(src.getOrderedBy()));
343        for (org.hl7.fhir.r4.model.Reference t : src.getEntry())
344            tgt.addEntry(VersionConvertor_30_40.convertReference(t));
345        if (src.hasEmptyReason())
346            tgt.setEmptyReason(VersionConvertor_30_40.convertCodeableConcept(src.getEmptyReason()));
347        for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection())
348            tgt.addSection(convertSectionComponent(t));
349        return tgt;
350    }
351
352    public static org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException {
353        if (src == null)
354            return null;
355        org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent();
356        VersionConvertor_30_40.copyElement(src, tgt);
357        if (src.hasTitle())
358            tgt.setTitleElement(VersionConvertor_30_40.convertString(src.getTitleElement()));
359        if (src.hasCode())
360            tgt.setCode(VersionConvertor_30_40.convertCodeableConcept(src.getCode()));
361        if (src.hasText())
362            tgt.setText(VersionConvertor_30_40.convertNarrative(src.getText()));
363        if (src.hasMode())
364            tgt.setModeElement(convertSectionMode(src.getModeElement()));
365        if (src.hasOrderedBy())
366            tgt.setOrderedBy(VersionConvertor_30_40.convertCodeableConcept(src.getOrderedBy()));
367        for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry())
368            tgt.addEntry(VersionConvertor_30_40.convertReference(t));
369        if (src.hasEmptyReason())
370            tgt.setEmptyReason(VersionConvertor_30_40.convertCodeableConcept(src.getEmptyReason()));
371        for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection())
372            tgt.addSection(convertSectionComponent(t));
373        return tgt;
374    }
375
376    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.SectionMode> convertSectionMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.SectionMode> src) throws FHIRException {
377        if (src == null || src.isEmpty())
378            return null;
379        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.SectionMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.SectionModeEnumFactory());
380        VersionConvertor_30_40.copyElement(src, tgt);
381        switch (src.getValue()) {
382            case WORKING:
383                tgt.setValue(org.hl7.fhir.r4.model.Composition.SectionMode.WORKING);
384                break;
385            case SNAPSHOT:
386                tgt.setValue(org.hl7.fhir.r4.model.Composition.SectionMode.SNAPSHOT);
387                break;
388            case CHANGES:
389                tgt.setValue(org.hl7.fhir.r4.model.Composition.SectionMode.CHANGES);
390                break;
391            default:
392                tgt.setValue(org.hl7.fhir.r4.model.Composition.SectionMode.NULL);
393                break;
394        }
395        return tgt;
396    }
397
398    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.SectionMode> convertSectionMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.SectionMode> src) throws FHIRException {
399        if (src == null || src.isEmpty())
400            return null;
401        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.SectionMode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Composition.SectionModeEnumFactory());
402        VersionConvertor_30_40.copyElement(src, tgt);
403        switch (src.getValue()) {
404            case WORKING:
405                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.SectionMode.WORKING);
406                break;
407            case SNAPSHOT:
408                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.SectionMode.SNAPSHOT);
409                break;
410            case CHANGES:
411                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.SectionMode.CHANGES);
412                break;
413            default:
414                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.SectionMode.NULL);
415                break;
416        }
417        return tgt;
418    }
419
420    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentRelationshipType> convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType> src) throws FHIRException {
421        if (src == null || src.isEmpty())
422            return null;
423        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentRelationshipType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Composition.DocumentRelationshipTypeEnumFactory());
424        VersionConvertor_30_40.copyElement(src, tgt);
425        switch (src.getValue()) {
426            case REPLACES:
427                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.REPLACES);
428                break;
429            case TRANSFORMS:
430                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.TRANSFORMS);
431                break;
432            case SIGNS:
433                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.SIGNS);
434                break;
435            case APPENDS:
436                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.APPENDS);
437                break;
438            default:
439                tgt.setValue(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.NULL);
440                break;
441        }
442        return tgt;
443    }
444
445    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType> convertDocumentRelationshipType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Composition.DocumentRelationshipType> src) throws FHIRException {
446        if (src == null || src.isEmpty())
447            return null;
448        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipTypeEnumFactory());
449        VersionConvertor_30_40.copyElement(src, tgt);
450        switch (src.getValue()) {
451            case REPLACES:
452                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.REPLACES);
453                break;
454            case TRANSFORMS:
455                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.TRANSFORMS);
456                break;
457            case SIGNS:
458                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.SIGNS);
459                break;
460            case APPENDS:
461                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.APPENDS);
462                break;
463            default:
464                tgt.setValue(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.NULL);
465                break;
466        }
467        return tgt;
468    }
469
470}