001package org.hl7.fhir.convertors.conv43_50.resources43_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext43_50;
004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Coding43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Period43_50;
007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Base64Binary43_50;
008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Instant43_50;
010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
012import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50;
013import org.hl7.fhir.exceptions.FHIRException;
014import org.hl7.fhir.r5.model.CodeableConcept;
015
016/*
017  Copyright (c) 2011+, HL7, Inc.
018  All rights reserved.
019  
020  Redistribution and use in source and binary forms, with or without modification, 
021  are permitted provided that the following conditions are met:
022  
023   * Redistributions of source code must retain the above copyright notice, this 
024     list of conditions and the following disclaimer.
025   * Redistributions in binary form must reproduce the above copyright notice, 
026     this list of conditions and the following disclaimer in the documentation 
027     and/or other materials provided with the distribution.
028   * Neither the name of HL7 nor the names of its contributors may be used to 
029     endorse or promote products derived from this software without specific 
030     prior written permission.
031  
032  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
033  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
034  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
035  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
036  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
037  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
038  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
039  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
040  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
041  POSSIBILITY OF SUCH DAMAGE.
042  
043*/
044// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
045public class AuditEvent43_50 {
046
047  public static org.hl7.fhir.r5.model.AuditEvent convertAuditEvent(org.hl7.fhir.r4b.model.AuditEvent src) throws FHIRException {
048    if (src == null)
049      return null;
050    org.hl7.fhir.r5.model.AuditEvent tgt = new org.hl7.fhir.r5.model.AuditEvent();
051    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
052    if (src.hasType())
053      tgt.getCategoryFirstRep().addCoding(Coding43_50.convertCoding(src.getType()));
054    for (org.hl7.fhir.r4b.model.Coding t : src.getSubtype()) tgt.getCode().addCoding(Coding43_50.convertCoding(t));
055    if (src.hasAction())
056      tgt.setActionElement(convertAuditEventAction(src.getActionElement()));
057    if (src.hasPeriod())
058      tgt.setOccurred(Period43_50.convertPeriod(src.getPeriod()));
059    if (src.hasRecorded())
060      tgt.setRecordedElement(Instant43_50.convertInstant(src.getRecordedElement()));
061    if (src.hasOutcome())
062      tgt.getOutcome().getCode().setSystem("http://terminology.hl7.org/CodeSystem/audit-event-outcome").setCode(src.getOutcome().toCode());
063    if (src.hasOutcomeDesc())
064      tgt.getOutcome().getDetailFirstRep().setTextElement(String43_50.convertString(src.getOutcomeDescElement()));
065    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getPurposeOfEvent())
066      tgt.addAuthorization(CodeableConcept43_50.convertCodeableConcept(t));
067    for (org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentComponent t : src.getAgent())
068      tgt.addAgent(convertAuditEventAgentComponent(t));
069    if (src.hasSource())
070      tgt.setSource(convertAuditEventSourceComponent(src.getSource()));
071    for (org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityComponent t : src.getEntity())
072      tgt.addEntity(convertAuditEventEntityComponent(t));
073    return tgt;
074  }
075
076  public static org.hl7.fhir.r4b.model.AuditEvent convertAuditEvent(org.hl7.fhir.r5.model.AuditEvent src) throws FHIRException {
077    if (src == null)
078      return null;
079    org.hl7.fhir.r4b.model.AuditEvent tgt = new org.hl7.fhir.r4b.model.AuditEvent();
080    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
081    if (src.getCategoryFirstRep().hasCoding()) {
082      tgt.setType(Coding43_50.convertCoding(src.getCategoryFirstRep().getCodingFirstRep()));
083    }
084    for (org.hl7.fhir.r5.model.Coding t : src.getCode().getCoding()) tgt.addSubtype(Coding43_50.convertCoding(t));
085    if (src.hasAction())
086      tgt.setActionElement(convertAuditEventAction(src.getActionElement()));
087    if (src.hasOccurredPeriod())
088      tgt.setPeriod(Period43_50.convertPeriod(src.getOccurredPeriod()));
089    if (src.hasRecorded())
090      tgt.setRecordedElement(Instant43_50.convertInstant(src.getRecordedElement()));
091    if (src.hasOutcome() && "http://terminology.hl7.org/CodeSystem/audit-event-outcome".equals(src.getOutcome().getCode().getSystem()))
092      tgt.getOutcomeElement().setValueAsString(src.getOutcome().getCode().getCode());
093    if (src.getOutcome().getDetailFirstRep().hasText())
094      tgt.setOutcomeDescElement(String43_50.convertString(src.getOutcome().getDetailFirstRep().getTextElement()));
095    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAuthorization())
096      tgt.addPurposeOfEvent(CodeableConcept43_50.convertCodeableConcept(t));
097    for (org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent t : src.getAgent())
098      tgt.addAgent(convertAuditEventAgentComponent(t));
099    if (src.hasSource())
100      tgt.setSource(convertAuditEventSourceComponent(src.getSource()));
101    for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent t : src.getEntity())
102      tgt.addEntity(convertAuditEventEntityComponent(t));
103    return tgt;
104  }
105
106  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AuditEvent.AuditEventAction> convertAuditEventAction(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.AuditEvent.AuditEventAction> src) throws FHIRException {
107    if (src == null || src.isEmpty())
108      return null;
109    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AuditEvent.AuditEventAction> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.AuditEvent.AuditEventActionEnumFactory());
110    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
111    switch (src.getValue()) {
112      case C:
113        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.C);
114        break;
115      case R:
116        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.R);
117        break;
118      case U:
119        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.U);
120        break;
121      case D:
122        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.D);
123        break;
124      case E:
125        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.E);
126        break;
127      default:
128        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.NULL);
129        break;
130    }
131    return tgt;
132  }
133
134  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.AuditEvent.AuditEventAction> convertAuditEventAction(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AuditEvent.AuditEventAction> src) throws FHIRException {
135    if (src == null || src.isEmpty())
136      return null;
137    org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.AuditEvent.AuditEventAction> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.AuditEvent.AuditEventActionEnumFactory());
138    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
139    switch (src.getValue()) {
140      case C:
141        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAction.C);
142        break;
143      case R:
144        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAction.R);
145        break;
146      case U:
147        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAction.U);
148        break;
149      case D:
150        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAction.D);
151        break;
152      case E:
153        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAction.E);
154        break;
155      default:
156        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAction.NULL);
157        break;
158    }
159    return tgt;
160  }
161
162
163  public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException {
164    if (src == null)
165      return null;
166    org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent();
167    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
168    if (src.hasType())
169      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
170    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getRole())
171      tgt.addRole(CodeableConcept43_50.convertCodeableConcept(t));
172    if (src.hasWho())
173      tgt.setWho(Reference43_50.convertReference(src.getWho()));
174//    if (src.hasAltId())
175//      tgt.setAltIdElement(String43_50.convertString(src.getAltIdElement()));
176//    if (src.hasName())
177//      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
178    if (src.hasRequestor())
179      tgt.setRequestorElement(Boolean43_50.convertBoolean(src.getRequestorElement()));
180    if (src.hasLocation())
181      tgt.setLocation(Reference43_50.convertReference(src.getLocation()));
182    for (org.hl7.fhir.r4b.model.UriType t : src.getPolicy()) tgt.getPolicy().add(Uri43_50.convertUri(t));
183//    if (src.hasMedia())
184//      tgt.setMedia(Coding43_50.convertCoding(src.getMedia()));
185//    if (src.hasNetwork())
186//      tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork()));
187    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getPurposeOfUse())
188      tgt.addAuthorization(CodeableConcept43_50.convertCodeableConcept(t));
189    return tgt;
190  }
191
192  public static org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException {
193    if (src == null)
194      return null;
195    org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentComponent();
196    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
197    if (src.hasType())
198      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
199    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole())
200      tgt.addRole(CodeableConcept43_50.convertCodeableConcept(t));
201    if (src.hasWho())
202      tgt.setWho(Reference43_50.convertReference(src.getWho()));
203//    if (src.hasAltId())
204//      tgt.setAltIdElement(String43_50.convertString(src.getAltIdElement()));
205//    if (src.hasName())
206//      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
207    if (src.hasRequestor())
208      tgt.setRequestorElement(Boolean43_50.convertBoolean(src.getRequestorElement()));
209    if (src.hasLocation())
210      tgt.setLocation(Reference43_50.convertReference(src.getLocation()));
211    for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) tgt.getPolicy().add(Uri43_50.convertUri(t));
212//    if (src.hasMedia())
213//      tgt.setMedia(Coding43_50.convertCoding(src.getMedia()));
214//    if (src.hasNetwork())
215//      tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork()));
216    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAuthorization())
217      tgt.addPurposeOfUse(CodeableConcept43_50.convertCodeableConcept(t));
218    return tgt;
219  }
220
221//  public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException {
222//    if (src == null)
223//      return null;
224//    org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent();
225//    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
226//    if (src.hasAddress())
227//      tgt.setAddressElement(String43_50.convertString(src.getAddressElement()));
228//    if (src.hasType())
229//      tgt.setTypeElement(convertAuditEventAgentNetworkType(src.getTypeElement()));
230//    return tgt;
231//  }
232//
233//  public static org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException {
234//    if (src == null)
235//      return null;
236//    org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkComponent();
237//    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
238//    if (src.hasAddress())
239//      tgt.setAddressElement(String43_50.convertString(src.getAddressElement()));
240//    if (src.hasType())
241//      tgt.setTypeElement(convertAuditEventAgentNetworkType(src.getTypeElement()));
242//    return tgt;
243//  }
244//
245//  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType> convertAuditEventAgentNetworkType(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkType> src) throws FHIRException {
246//    if (src == null || src.isEmpty())
247//      return null;
248//    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkTypeEnumFactory());
249//    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
250//    switch (src.getValue()) {
251//      case _1:
252//        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._1);
253//        break;
254//      case _2:
255//        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._2);
256//        break;
257//      case _3:
258//        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._3);
259//        break;
260//      case _4:
261//        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._4);
262//        break;
263//      case _5:
264//        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._5);
265//        break;
266//      default:
267//        tgt.setValue(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType.NULL);
268//        break;
269//    }
270//    return tgt;
271//  }
272//
273//  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkType> convertAuditEventAgentNetworkType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType> src) throws FHIRException {
274//    if (src == null || src.isEmpty())
275//      return null;
276//    org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkType> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkTypeEnumFactory());
277//    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
278//    switch (src.getValue()) {
279//      case _1:
280//        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkType._1);
281//        break;
282//      case _2:
283//        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkType._2);
284//        break;
285//      case _3:
286//        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkType._3);
287//        break;
288//      case _4:
289//        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkType._4);
290//        break;
291//      case _5:
292//        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkType._5);
293//        break;
294//      default:
295//        tgt.setValue(org.hl7.fhir.r4b.model.AuditEvent.AuditEventAgentNetworkType.NULL);
296//        break;
297//    }
298//    return tgt;
299//  }
300
301  public static org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r4b.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException {
302    if (src == null)
303      return null;
304    org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent();
305    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
306//    if (src.hasSite())
307//      tgt.setSiteElement(String43_50.convertString(src.getSiteElement()));
308    if (src.hasObserver())
309      tgt.setObserver(Reference43_50.convertReference(src.getObserver()));
310    for (org.hl7.fhir.r4b.model.Coding t : src.getType()) tgt.addType().addCoding(Coding43_50.convertCoding(t));
311    return tgt;
312  }
313
314  public static org.hl7.fhir.r4b.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException {
315    if (src == null)
316      return null;
317    org.hl7.fhir.r4b.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r4b.model.AuditEvent.AuditEventSourceComponent();
318    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
319//    if (src.hasSite())
320//      tgt.setSiteElement(String43_50.convertString(src.getSiteElement()));
321    if (src.hasObserver())
322      tgt.setObserver(Reference43_50.convertReference(src.getObserver()));
323    for (CodeableConcept t : src.getType()) tgt.addType(Coding43_50.convertCoding(t.getCodingFirstRep()));
324    return tgt;
325  }
326
327  public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException {
328    if (src == null)
329      return null;
330    org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent();
331    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
332    if (src.hasWhat())
333      tgt.setWhat(Reference43_50.convertReference(src.getWhat()));
334//    if (src.hasType())
335//      tgt.setType(Coding43_50.convertCoding(src.getType()));
336    if (src.hasRole())
337      tgt.getRole().addCoding(Coding43_50.convertCoding(src.getRole()));
338//    if (src.hasLifecycle())
339//      tgt.setLifecycle(Coding43_50.convertCoding(src.getLifecycle()));
340    for (org.hl7.fhir.r4b.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel().addCoding(Coding43_50.convertCoding(t));
341//    if (src.hasName())
342//      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
343    // if (src.hasDescription())
344    // tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
345    if (src.hasQuery())
346      tgt.setQueryElement(Base64Binary43_50.convertBase64Binary(src.getQueryElement()));
347    for (org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail())
348      tgt.addDetail(convertAuditEventEntityDetailComponent(t));
349    return tgt;
350  }
351
352  public static org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException {
353    if (src == null)
354      return null;
355    org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityComponent();
356    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
357    if (src.hasWhat())
358      tgt.setWhat(Reference43_50.convertReference(src.getWhat()));
359//    if (src.hasType())
360//      tgt.setType(Coding43_50.convertCoding(src.getType()));
361    if (src.hasRole())
362      tgt.setRole(Coding43_50.convertCoding(src.getRole().getCodingFirstRep()));
363//    if (src.hasLifecycle())
364//      tgt.setLifecycle(Coding43_50.convertCoding(src.getLifecycle()));
365    for (CodeableConcept t : src.getSecurityLabel()) tgt.addSecurityLabel(Coding43_50.convertCoding(t.getCodingFirstRep()));
366//    if (src.hasName())
367//      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
368    // if (src.hasDescription())
369    // tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
370    if (src.hasQuery())
371      tgt.setQueryElement(Base64Binary43_50.convertBase64Binary(src.getQueryElement()));
372    for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail())
373      tgt.addDetail(convertAuditEventEntityDetailComponent(t));
374    return tgt;
375  }
376
377  public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException {
378    if (src == null)
379      return null;
380    org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent();
381    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
382    if (src.hasType())
383      tgt.getType().setTextElement(String43_50.convertString(src.getTypeElement()));
384    if (src.hasValue())
385      tgt.setValue(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getValue()));
386    return tgt;
387  }
388
389  public static org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException {
390    if (src == null)
391      return null;
392    org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4b.model.AuditEvent.AuditEventEntityDetailComponent();
393    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
394    if (src.getType().hasTextElement())
395      tgt.setTypeElement(String43_50.convertString(src.getType().getTextElement()));
396    if (src.hasValue())
397      tgt.setValue(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getValue()));
398    return tgt;
399  }
400}