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