001package org.hl7.fhir.convertors.conv30_40;
002
003import org.hl7.fhir.convertors.VersionConvertor_30_40;
004import org.hl7.fhir.exceptions.FHIRException;
005
006public class AuditEvent30_40 {
007
008    public static org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.r4.model.AuditEvent src) throws FHIRException {
009        if (src == null)
010            return null;
011        org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent();
012        VersionConvertor_30_40.copyDomainResource(src, tgt);
013        if (src.hasType())
014            tgt.setType(VersionConvertor_30_40.convertCoding(src.getType()));
015        for (org.hl7.fhir.r4.model.Coding t : src.getSubtype()) tgt.addSubtype(VersionConvertor_30_40.convertCoding(t));
016        if (src.hasAction())
017            tgt.setActionElement(convertAuditEventAction(src.getActionElement()));
018        if (src.hasRecorded())
019            tgt.setRecordedElement(VersionConvertor_30_40.convertInstant(src.getRecordedElement()));
020        if (src.hasOutcome())
021            tgt.setOutcomeElement(convertAuditEventOutcome(src.getOutcomeElement()));
022        if (src.hasOutcomeDesc())
023            tgt.setOutcomeDescElement(VersionConvertor_30_40.convertString(src.getOutcomeDescElement()));
024        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfEvent()) tgt.addPurposeOfEvent(VersionConvertor_30_40.convertCodeableConcept(t));
025        for (org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addAgent(convertAuditEventAgentComponent(t));
026        if (src.hasSource())
027            tgt.setSource(convertAuditEventSourceComponent(src.getSource()));
028        for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) tgt.addEntity(convertAuditEventEntityComponent(t));
029        return tgt;
030    }
031
032    public static org.hl7.fhir.r4.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException {
033        if (src == null)
034            return null;
035        org.hl7.fhir.r4.model.AuditEvent tgt = new org.hl7.fhir.r4.model.AuditEvent();
036        VersionConvertor_30_40.copyDomainResource(src, tgt);
037        if (src.hasType())
038            tgt.setType(VersionConvertor_30_40.convertCoding(src.getType()));
039        for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) tgt.addSubtype(VersionConvertor_30_40.convertCoding(t));
040        if (src.hasAction())
041            tgt.setActionElement(convertAuditEventAction(src.getActionElement()));
042        if (src.hasRecorded())
043            tgt.setRecordedElement(VersionConvertor_30_40.convertInstant(src.getRecordedElement()));
044        if (src.hasOutcome())
045            tgt.setOutcomeElement(convertAuditEventOutcome(src.getOutcomeElement()));
046        if (src.hasOutcomeDesc())
047            tgt.setOutcomeDescElement(VersionConvertor_30_40.convertString(src.getOutcomeDescElement()));
048        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) tgt.addPurposeOfEvent(VersionConvertor_30_40.convertCodeableConcept(t));
049        for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) tgt.addAgent(convertAuditEventAgentComponent(t));
050        if (src.hasSource())
051            tgt.setSource(convertAuditEventSourceComponent(src.getSource()));
052        for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) tgt.addEntity(convertAuditEventEntityComponent(t));
053        return tgt;
054    }
055
056    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AuditEvent.AuditEventAction> convertAuditEventAction(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction> src) throws FHIRException {
057        if (src == null || src.isEmpty())
058            return null;
059        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AuditEvent.AuditEventAction> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.AuditEvent.AuditEventActionEnumFactory());
060        VersionConvertor_30_40.copyElement(src, tgt);
061        switch(src.getValue()) {
062            case C:
063                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.C);
064                break;
065            case R:
066                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.R);
067                break;
068            case U:
069                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.U);
070                break;
071            case D:
072                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.D);
073                break;
074            case E:
075                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.E);
076                break;
077            default:
078                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.NULL);
079                break;
080        }
081        return tgt;
082    }
083
084    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction> convertAuditEventAction(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AuditEvent.AuditEventAction> src) throws FHIRException {
085        if (src == null || src.isEmpty())
086            return null;
087        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventActionEnumFactory());
088        VersionConvertor_30_40.copyElement(src, tgt);
089        switch(src.getValue()) {
090            case C:
091                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C);
092                break;
093            case R:
094                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R);
095                break;
096            case U:
097                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U);
098                break;
099            case D:
100                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D);
101                break;
102            case E:
103                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E);
104                break;
105            default:
106                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL);
107                break;
108        }
109        return tgt;
110    }
111
112    public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException {
113        if (src == null)
114            return null;
115        org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent();
116        VersionConvertor_30_40.copyElement(src, tgt);
117        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_30_40.convertCodeableConcept(t));
118        if (src.hasWho()) {
119            if (src.getWho().hasIdentifier())
120                tgt.setUserId(VersionConvertor_30_40.convertIdentifier(src.getWho().getIdentifier()));
121            if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId())
122                tgt.setReference(VersionConvertor_30_40.convertReference(src.getWho()));
123        }
124        if (src.hasAltId())
125            tgt.setAltIdElement(VersionConvertor_30_40.convertString(src.getAltIdElement()));
126        if (src.hasName())
127            tgt.setNameElement(VersionConvertor_30_40.convertString(src.getNameElement()));
128        if (src.hasRequestor())
129            tgt.setRequestorElement(VersionConvertor_30_40.convertBoolean(src.getRequestorElement()));
130        if (src.hasLocation())
131            tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation()));
132        for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue());
133        if (src.hasMedia())
134            tgt.setMedia(VersionConvertor_30_40.convertCoding(src.getMedia()));
135        if (src.hasNetwork())
136            tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork()));
137        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfUse()) tgt.addPurposeOfUse(VersionConvertor_30_40.convertCodeableConcept(t));
138        return tgt;
139    }
140
141    public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException {
142        if (src == null)
143            return null;
144        org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent();
145        VersionConvertor_30_40.copyElement(src, tgt);
146        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) tgt.addRole(VersionConvertor_30_40.convertCodeableConcept(t));
147        if (src.hasReference())
148            tgt.setWho(VersionConvertor_30_40.convertReference(src.getReference()));
149        if (src.hasUserId())
150            tgt.getWho().setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getUserId()));
151        if (src.hasAltId())
152            tgt.setAltIdElement(VersionConvertor_30_40.convertString(src.getAltIdElement()));
153        if (src.hasName())
154            tgt.setNameElement(VersionConvertor_30_40.convertString(src.getNameElement()));
155        if (src.hasRequestor())
156            tgt.setRequestorElement(VersionConvertor_30_40.convertBoolean(src.getRequestorElement()));
157        if (src.hasLocation())
158            tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation()));
159        for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue());
160        if (src.hasMedia())
161            tgt.setMedia(VersionConvertor_30_40.convertCoding(src.getMedia()));
162        if (src.hasNetwork())
163            tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork()));
164        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) tgt.addPurposeOfUse(VersionConvertor_30_40.convertCodeableConcept(t));
165        return tgt;
166    }
167
168    public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException {
169        if (src == null)
170            return null;
171        org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent();
172        VersionConvertor_30_40.copyElement(src, tgt);
173        if (src.hasAddress())
174            tgt.setAddressElement(VersionConvertor_30_40.convertString(src.getAddressElement()));
175        if (src.hasType())
176            tgt.setTypeElement(convertAuditEventAgentNetworkType(src.getTypeElement()));
177        return tgt;
178    }
179
180    public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException {
181        if (src == null)
182            return null;
183        org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent();
184        VersionConvertor_30_40.copyElement(src, tgt);
185        if (src.hasAddress())
186            tgt.setAddressElement(VersionConvertor_30_40.convertString(src.getAddressElement()));
187        if (src.hasType())
188            tgt.setTypeElement(convertAuditEventAgentNetworkType(src.getTypeElement()));
189        return tgt;
190    }
191
192    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType> convertAuditEventAgentNetworkType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType> src) throws FHIRException {
193        if (src == null || src.isEmpty())
194            return null;
195        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkTypeEnumFactory());
196        VersionConvertor_30_40.copyElement(src, tgt);
197        switch(src.getValue()) {
198            case _1:
199                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1);
200                break;
201            case _2:
202                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2);
203                break;
204            case _3:
205                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3);
206                break;
207            case _4:
208                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4);
209                break;
210            case _5:
211                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5);
212                break;
213            default:
214                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL);
215                break;
216        }
217        return tgt;
218    }
219
220    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType> convertAuditEventAgentNetworkType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType> src) throws FHIRException {
221        if (src == null || src.isEmpty())
222            return null;
223        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkTypeEnumFactory());
224        VersionConvertor_30_40.copyElement(src, tgt);
225        switch(src.getValue()) {
226            case _1:
227                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._1);
228                break;
229            case _2:
230                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._2);
231                break;
232            case _3:
233                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._3);
234                break;
235            case _4:
236                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._4);
237                break;
238            case _5:
239                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._5);
240                break;
241            default:
242                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType.NULL);
243                break;
244        }
245        return tgt;
246    }
247
248    public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException {
249        if (src == null)
250            return null;
251        org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent();
252        VersionConvertor_30_40.copyElement(src, tgt);
253        if (src.hasIdentifier())
254            tgt.getWhat().setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier()));
255        if (src.hasReference())
256            tgt.setWhat(VersionConvertor_30_40.convertReference(src.getReference()));
257        if (src.hasType())
258            tgt.setType(VersionConvertor_30_40.convertCoding(src.getType()));
259        if (src.hasRole())
260            tgt.setRole(VersionConvertor_30_40.convertCoding(src.getRole()));
261        if (src.hasLifecycle())
262            tgt.setLifecycle(VersionConvertor_30_40.convertCoding(src.getLifecycle()));
263        for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_40.convertCoding(t));
264        if (src.hasName())
265            tgt.setNameElement(VersionConvertor_30_40.convertString(src.getNameElement()));
266        if (src.hasDescription())
267            tgt.setDescriptionElement(VersionConvertor_30_40.convertString(src.getDescriptionElement()));
268        if (src.hasQuery())
269            tgt.setQueryElement(VersionConvertor_30_40.convertBase64Binary(src.getQueryElement()));
270        for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t));
271        return tgt;
272    }
273
274    public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException {
275        if (src == null)
276            return null;
277        org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent();
278        VersionConvertor_30_40.copyElement(src, tgt);
279        if (src.hasWhat()) {
280            if (src.getWhat().hasIdentifier())
281                tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getWhat().getIdentifier()));
282            if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId())
283                tgt.setReference(VersionConvertor_30_40.convertReference(src.getWhat()));
284        }
285        if (src.hasType())
286            tgt.setType(VersionConvertor_30_40.convertCoding(src.getType()));
287        if (src.hasRole())
288            tgt.setRole(VersionConvertor_30_40.convertCoding(src.getRole()));
289        if (src.hasLifecycle())
290            tgt.setLifecycle(VersionConvertor_30_40.convertCoding(src.getLifecycle()));
291        for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(VersionConvertor_30_40.convertCoding(t));
292        if (src.hasName())
293            tgt.setNameElement(VersionConvertor_30_40.convertString(src.getNameElement()));
294        if (src.hasDescription())
295            tgt.setDescriptionElement(VersionConvertor_30_40.convertString(src.getDescriptionElement()));
296        if (src.hasQuery())
297            tgt.setQueryElement(VersionConvertor_30_40.convertBase64Binary(src.getQueryElement()));
298        for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) tgt.addDetail(convertAuditEventEntityDetailComponent(t));
299        return tgt;
300    }
301
302    public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException {
303        if (src == null)
304            return null;
305        org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent();
306        VersionConvertor_30_40.copyElement(src, tgt);
307        if (src.hasType())
308            tgt.setTypeElement(VersionConvertor_30_40.convertString(src.getTypeElement()));
309        if (src.hasValue())
310            tgt.setValue(new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()));
311        return tgt;
312    }
313
314    public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException {
315        if (src == null)
316            return null;
317        org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent();
318        VersionConvertor_30_40.copyElement(src, tgt);
319        if (src.hasType())
320            tgt.setTypeElement(VersionConvertor_30_40.convertString(src.getTypeElement()));
321        if (src.hasValueStringType())
322            tgt.setValue(src.getValueStringType().getValue().getBytes());
323        else if (src.hasValueBase64BinaryType())
324            tgt.setValue(src.getValueBase64BinaryType().getValue());
325        return tgt;
326    }
327
328    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome> convertAuditEventOutcome(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome> src) throws FHIRException {
329        if (src == null || src.isEmpty())
330            return null;
331        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcomeEnumFactory());
332        VersionConvertor_30_40.copyElement(src, tgt);
333        switch(src.getValue()) {
334            case _0:
335                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0);
336                break;
337            case _4:
338                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4);
339                break;
340            case _8:
341                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8);
342                break;
343            case _12:
344                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12);
345                break;
346            default:
347                tgt.setValue(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL);
348                break;
349        }
350        return tgt;
351    }
352
353    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome> convertAuditEventOutcome(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome> src) throws FHIRException {
354        if (src == null || src.isEmpty())
355            return null;
356        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcomeEnumFactory());
357        VersionConvertor_30_40.copyElement(src, tgt);
358        switch(src.getValue()) {
359            case _0:
360                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0);
361                break;
362            case _4:
363                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4);
364                break;
365            case _8:
366                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8);
367                break;
368            case _12:
369                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12);
370                break;
371            default:
372                tgt.setValue(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL);
373                break;
374        }
375        return tgt;
376    }
377
378    public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException {
379        if (src == null)
380            return null;
381        org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent();
382        VersionConvertor_30_40.copyElement(src, tgt);
383        if (src.hasSite())
384            tgt.setSiteElement(VersionConvertor_30_40.convertString(src.getSiteElement()));
385        if (src.hasObserver())
386            tgt.setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getObserver().getIdentifier()));
387        for (org.hl7.fhir.r4.model.Coding t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCoding(t));
388        return tgt;
389    }
390
391    public static org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException {
392        if (src == null)
393            return null;
394        org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent();
395        VersionConvertor_30_40.copyElement(src, tgt);
396        if (src.hasSite())
397            tgt.setSiteElement(VersionConvertor_30_40.convertString(src.getSiteElement()));
398        if (src.hasIdentifier())
399            tgt.getObserver().setIdentifier(VersionConvertor_30_40.convertIdentifier(src.getIdentifier()));
400        for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) tgt.addType(VersionConvertor_30_40.convertCoding(t));
401        return tgt;
402    }
403}