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