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