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