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