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