
001package org.hl7.fhir.convertors.conv10_40.resources10_40; 002 003import org.hl7.fhir.convertors.VersionConvertorConstants; 004import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40; 005import org.hl7.fhir.convertors.context.ConversionContext10_40; 006import org.hl7.fhir.convertors.conv10_40.datatypes10_40.Reference10_40; 007import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.CodeableConcept10_40; 008import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Coding10_40; 009import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.ContactPoint10_40; 010import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Boolean10_40; 011import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Canonical10_40; 012import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Code10_40; 013import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.DateTime10_40; 014import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.String10_40; 015import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.UnsignedInt10_40; 016import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.Uri10_40; 017import org.hl7.fhir.dstu2.model.Conformance; 018import org.hl7.fhir.dstu2.model.Enumeration; 019import org.hl7.fhir.exceptions.FHIRException; 020import org.hl7.fhir.r4.model.CapabilityStatement; 021import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent; 022import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent; 023import org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction; 024 025public class Conformance10_40 { 026 027 public static final String ACCEPT_UNKNOWN_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"; 028 029 private static final String[] IGNORED_EXTENSION_URLS = new String[]{ 030 ACCEPT_UNKNOWN_EXTENSION_URL 031 }; 032 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus> convertConditionalDeleteStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus> src) throws FHIRException { 033 if (src == null || src.isEmpty()) 034 return null; 035 Enumeration<Conformance.ConditionalDeleteStatus> tgt = new Enumeration<>(new Conformance.ConditionalDeleteStatusEnumFactory()); 036 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 037 if (src.getValue() == null) { 038 tgt.setValue(null); 039 } else { 040 switch (src.getValue()) { 041 case NOTSUPPORTED: 042 tgt.setValue(Conformance.ConditionalDeleteStatus.NOTSUPPORTED); 043 break; 044 case SINGLE: 045 tgt.setValue(Conformance.ConditionalDeleteStatus.SINGLE); 046 break; 047 case MULTIPLE: 048 tgt.setValue(Conformance.ConditionalDeleteStatus.MULTIPLE); 049 break; 050 default: 051 tgt.setValue(Conformance.ConditionalDeleteStatus.NULL); 052 break; 053 } 054 } 055 return tgt; 056 } 057 058 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus> convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus> src) throws FHIRException { 059 if (src == null || src.isEmpty()) 060 return null; 061 org.hl7.fhir.r4.model.Enumeration<CapabilityStatement.ConditionalDeleteStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new CapabilityStatement.ConditionalDeleteStatusEnumFactory()); 062 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 063 if (src.getValue() == null) { 064 tgt.setValue(null); 065 } else { 066 switch (src.getValue()) { 067 case NOTSUPPORTED: 068 tgt.setValue(CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED); 069 break; 070 case SINGLE: 071 tgt.setValue(CapabilityStatement.ConditionalDeleteStatus.SINGLE); 072 break; 073 case MULTIPLE: 074 tgt.setValue(CapabilityStatement.ConditionalDeleteStatus.MULTIPLE); 075 break; 076 default: 077 tgt.setValue(CapabilityStatement.ConditionalDeleteStatus.NULL); 078 break; 079 } 080 } 081 return tgt; 082 } 083 084 public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src, BaseAdvisor_10_40 advisor) throws FHIRException { 085 if (src == null || src.isEmpty()) 086 return null; 087 org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); 088 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); 089 if (src.hasUrlElement()) 090 tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement())); 091 if (src.hasVersionElement()) 092 tgt.setVersionElement(String10_40.convertString(src.getVersionElement())); 093 if (src.hasNameElement()) 094 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 095 if (src.hasStatus()) 096 tgt.setStatusElement(Enumerations10_40.convertConformanceResourceStatus(src.getStatusElement())); 097 if (src.hasExperimental()) 098 tgt.setExperimentalElement(Boolean10_40.convertBoolean(src.getExperimentalElement())); 099 if (src.hasDate()) 100 tgt.setDateElement(DateTime10_40.convertDateTime(src.getDateElement())); 101 if (src.hasPublisherElement()) 102 tgt.setPublisherElement(String10_40.convertString(src.getPublisherElement())); 103 for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) 104 tgt.addContact(convertConformanceContactComponent(t)); 105 if (src.hasDescription()) 106 tgt.setDescription(src.getDescription()); 107 if (src.hasPurpose()) 108 tgt.setRequirements(src.getPurpose()); 109 if (src.hasCopyright()) 110 tgt.setCopyright(src.getCopyright()); 111 if (src.hasKind()) 112 tgt.setKindElement(convertConformanceStatementKind(src.getKindElement())); 113 if (src.hasSoftware()) 114 tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); 115 if (src.hasImplementation()) 116 tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); 117 if (src.hasFhirVersion()) 118 tgt.setFhirVersion(src.getFhirVersion().toCode()); 119 if (src.hasExtension(ACCEPT_UNKNOWN_EXTENSION_URL)) 120 tgt.setAcceptUnknown(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl(ACCEPT_UNKNOWN_EXTENSION_URL).getValue().primitiveValue())); 121 for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); 122 for (CapabilityStatementRestComponent r : src.getRest()) 123 for (CapabilityStatementRestResourceComponent rr : r.getResource()) 124 for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile()) 125 tgt.addProfile(Canonical10_40.convertCanonicalToReference(t)); 126 for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) 127 tgt.addRest(convertConformanceRestComponent(t)); 128 for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) 129 tgt.addMessaging(convertConformanceMessagingComponent(t)); 130 for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) 131 tgt.addDocument(convertConformanceDocumentComponent(t)); 132 return tgt; 133 } 134 135 public static org.hl7.fhir.r4.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2.model.Conformance src) throws FHIRException { 136 if (src == null || src.isEmpty()) 137 return null; 138 org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement(); 139 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt); 140 if (src.hasUrlElement()) 141 tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement())); 142 if (src.hasVersionElement()) 143 tgt.setVersionElement(String10_40.convertString(src.getVersionElement())); 144 if (src.hasNameElement()) 145 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 146 if (src.hasStatus()) 147 tgt.setStatusElement(Enumerations10_40.convertConformanceResourceStatus(src.getStatusElement())); 148 if (src.hasExperimental()) 149 tgt.setExperimentalElement(Boolean10_40.convertBoolean(src.getExperimentalElement())); 150 if (src.hasDate()) 151 tgt.setDateElement(DateTime10_40.convertDateTime(src.getDateElement())); 152 if (src.hasPublisherElement()) 153 tgt.setPublisherElement(String10_40.convertString(src.getPublisherElement())); 154 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent t : src.getContact()) 155 tgt.addContact(convertConformanceContactComponent(t)); 156 if (src.hasDescription()) 157 tgt.setDescription(src.getDescription()); 158 if (src.hasRequirements()) 159 tgt.setPurpose(src.getRequirements()); 160 if (src.hasCopyright()) 161 tgt.setCopyright(src.getCopyright()); 162 if (src.hasKind()) 163 tgt.setKindElement(convertConformanceStatementKind(src.getKindElement())); 164 if (src.hasSoftware()) 165 tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); 166 if (src.hasImplementation()) 167 tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); 168 if (src.hasFhirVersion()) 169 tgt.setFhirVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); 170 if (src.hasAcceptUnknown()) 171 tgt.addExtension().setUrl(ACCEPT_UNKNOWN_EXTENSION_URL).setValue(new org.hl7.fhir.r4.model.CodeType(src.getAcceptUnknownElement().asStringValue())); 172 for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); 173 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest()) 174 tgt.addRest(convertConformanceRestComponent(t)); 175 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) 176 tgt.addMessaging(convertConformanceMessagingComponent(t)); 177 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) 178 tgt.addDocument(convertConformanceDocumentComponent(t)); 179 return tgt; 180 } 181 182 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { 183 if (src == null || src.isEmpty()) 184 return null; 185 org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent(); 186 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 187 if (src.hasNameElement()) 188 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 189 for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) 190 tgt.addTelecom(ContactPoint10_40.convertContactPoint(t)); 191 return tgt; 192 } 193 194 public static org.hl7.fhir.r4.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent src) throws FHIRException { 195 if (src == null || src.isEmpty()) 196 return null; 197 org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); 198 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 199 if (src.hasNameElement()) 200 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 201 for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) 202 tgt.addTelecom(ContactPoint10_40.convertContactPoint(t)); 203 return tgt; 204 } 205 206 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { 207 if (src == null || src.isEmpty()) 208 return null; 209 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); 210 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 211 if (src.hasMode()) 212 tgt.setModeElement(convertDocumentMode(src.getModeElement())); 213 if (src.hasDocumentation()) 214 tgt.setDocumentation(src.getDocumentation()); 215 if (src.hasProfile()) 216 tgt.setProfileElement(Canonical10_40.convertReferenceToCanonical(src.getProfile())); 217 return tgt; 218 } 219 220 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { 221 if (src == null || src.isEmpty()) 222 return null; 223 org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent(); 224 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 225 if (src.hasMode()) 226 tgt.setModeElement(convertDocumentMode(src.getModeElement())); 227 if (src.hasDocumentation()) 228 tgt.setDocumentation(src.getDocumentation()); 229 if (src.hasProfileElement()) 230 tgt.setProfile(Canonical10_40.convertCanonicalToReference(src.getProfileElement())); 231 return tgt; 232 } 233 234 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { 235 if (src == null || src.isEmpty()) 236 return null; 237 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent(); 238 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 239 if (src.hasDescriptionElement()) 240 tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement())); 241 if (src.hasUrl()) 242 tgt.setUrl(src.getUrl()); 243 return tgt; 244 } 245 246 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { 247 if (src == null || src.isEmpty()) 248 return null; 249 org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent(); 250 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 251 if (src.hasDescriptionElement()) 252 tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement())); 253 if (src.hasUrl()) 254 tgt.setUrl(src.getUrl()); 255 return tgt; 256 } 257 258 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { 259 if (src == null || src.isEmpty()) 260 return null; 261 org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent(); 262 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 263 for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) 264 tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); 265 if (src.hasReliableCacheElement()) 266 tgt.setReliableCacheElement(UnsignedInt10_40.convertUnsignedInt(src.getReliableCacheElement())); 267 if (src.hasDocumentation()) 268 tgt.setDocumentation(src.getDocumentation()); 269 for (org.hl7.fhir.r4.model.Extension e : src.getExtensionsByUrl(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT)) { 270 org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent event = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent(); 271 tgt.addEvent(event); 272 event.setCode(Coding10_40.convertCoding((org.hl7.fhir.r4.model.Coding) e.getExtensionByUrl("code").getValue())); 273 if (e.hasExtension("category")) 274 event.setCategory(org.hl7.fhir.dstu2.model.Conformance.MessageSignificanceCategory.fromCode(e.getExtensionByUrl("category").getValue().toString())); 275 event.setMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.fromCode(e.getExtensionByUrl("mode").getValue().toString())); 276 org.hl7.fhir.r4.model.Extension focusE = e.getExtensionByUrl("focus"); 277 if (focusE.getValue().hasPrimitiveValue()) 278 event.setFocus(focusE.getValue().toString()); 279 else { 280 event.setFocusElement(new org.hl7.fhir.dstu2.model.CodeType()); 281 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(focusE.getValue(), event.getFocusElement()); 282 } 283 event.setRequest(Reference10_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("request").getValue())); 284 event.setResponse(Reference10_40.convertReference((org.hl7.fhir.r4.model.Reference) e.getExtensionByUrl("response").getValue())); 285 if (e.hasExtension("documentation")) 286 event.setDocumentation(e.getExtensionByUrl("documentation").getValue().toString()); 287 } 288 return tgt; 289 } 290 291 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { 292 if (src == null || src.isEmpty()) 293 return null; 294 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent(); 295 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 296 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) 297 tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); 298 if (src.hasReliableCacheElement()) 299 tgt.setReliableCacheElement(UnsignedInt10_40.convertUnsignedInt(src.getReliableCacheElement())); 300 if (src.hasDocumentation()) 301 tgt.setDocumentation(src.getDocumentation()); 302 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) { 303 org.hl7.fhir.r4.model.Extension e = new org.hl7.fhir.r4.model.Extension(VersionConvertorConstants.IG_CONFORMANCE_MESSAGE_EVENT); 304 e.addExtension(new org.hl7.fhir.r4.model.Extension("code", Coding10_40.convertCoding(t.getCode()))); 305 if (t.hasCategory()) 306 e.addExtension(new org.hl7.fhir.r4.model.Extension("category", new org.hl7.fhir.r4.model.CodeType(t.getCategory().toCode()))); 307 e.addExtension(new org.hl7.fhir.r4.model.Extension("mode", new org.hl7.fhir.r4.model.CodeType(t.getMode().toCode()))); 308 if (t.getFocusElement().hasValue()) 309 e.addExtension(new org.hl7.fhir.r4.model.Extension("focus", new org.hl7.fhir.r4.model.StringType(t.getFocus()))); 310 else { 311 org.hl7.fhir.r4.model.CodeType focus = new org.hl7.fhir.r4.model.CodeType(); 312 org.hl7.fhir.r4.model.Extension focusE = new org.hl7.fhir.r4.model.Extension("focus", focus); 313 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(t.getFocusElement(), focus); 314 e.addExtension(focusE); 315 } 316 e.addExtension(new org.hl7.fhir.r4.model.Extension("request", Reference10_40.convertReference(t.getRequest()))); 317 e.addExtension(new org.hl7.fhir.r4.model.Extension("response", Reference10_40.convertReference(t.getResponse()))); 318 if (t.hasDocumentation()) 319 e.addExtension(new org.hl7.fhir.r4.model.Extension("documentation", new org.hl7.fhir.r4.model.StringType(t.getDocumentation()))); 320 tgt.addExtension(e); 321 } 322 return tgt; 323 } 324 325 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { 326 if (src == null || src.isEmpty()) 327 return null; 328 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); 329 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 330 if (src.hasProtocol()) 331 tgt.setProtocol(Coding10_40.convertCoding(src.getProtocol())); 332 if (src.hasAddress()) 333 tgt.setAddress(src.getAddress()); 334 return tgt; 335 } 336 337 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { 338 if (src == null || src.isEmpty()) 339 return null; 340 org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent(); 341 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 342 if (src.hasProtocol()) 343 tgt.setProtocol(Coding10_40.convertCoding(src.getProtocol())); 344 if (src.hasAddress()) 345 tgt.setAddress(src.getAddress()); 346 return tgt; 347 } 348 349 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent src) throws FHIRException { 350 if (src == null || src.isEmpty()) 351 return null; 352 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); 353 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 354 if (src.hasMode()) 355 tgt.setModeElement(convertRestfulConformanceMode(src.getModeElement())); 356 if (src.hasDocumentation()) 357 tgt.setDocumentation(src.getDocumentation()); 358 if (src.hasSecurity()) 359 tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); 360 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) 361 tgt.addResource(convertConformanceRestResourceComponent(t)); 362 for (org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent t : src.getInteraction()) 363 tgt.addInteraction(convertSystemInteractionComponent(t)); 364 if (src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH) 365 tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); 366 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) 367 tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); 368 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) 369 tgt.addOperation(convertConformanceRestOperationComponent(t)); 370 for (org.hl7.fhir.dstu2.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); 371 return tgt; 372 } 373 374 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { 375 if (src == null || src.isEmpty()) 376 return null; 377 org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent(); 378 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 379 if (src.hasMode()) 380 tgt.setModeElement(convertRestfulConformanceMode(src.getModeElement())); 381 if (src.hasDocumentation()) 382 tgt.setDocumentation(src.getDocumentation()); 383 if (src.hasSecurity()) 384 tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); 385 for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) 386 tgt.addResource(convertConformanceRestResourceComponent(t)); 387 boolean batch = false; 388 boolean transaction = false; 389 for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { 390 if (t.getCode().equals(SystemRestfulInteraction.BATCH)) 391 batch = true; 392 else 393 tgt.addInteraction(convertSystemInteractionComponent(t)); 394 if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) 395 transaction = true; 396 } 397 if (batch) 398 tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH); 399 else 400 tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.NOTSUPPORTED); 401 for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) 402 tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); 403 for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) 404 tgt.addOperation(convertConformanceRestOperationComponent(t)); 405 for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) tgt.addCompartment(t.getValue()); 406 return tgt; 407 } 408 409 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { 410 if (src == null || src.isEmpty()) 411 return null; 412 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); 413 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 414 if (src.hasNameElement()) 415 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 416 if (src.hasDefinition()) 417 tgt.setDefinitionElement(Canonical10_40.convertReferenceToCanonical(src.getDefinition())); 418 return tgt; 419 } 420 421 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { 422 if (src == null || src.isEmpty()) 423 return null; 424 org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent(); 425 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 426 if (src.hasNameElement()) 427 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 428 if (src.hasDefinitionElement()) 429 tgt.setDefinition(Canonical10_40.convertCanonicalToReference(src.getDefinitionElement())); 430 return tgt; 431 } 432 433 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { 434 if (src == null || src.isEmpty()) 435 return null; 436 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); 437 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 438 if (src.hasTypeElement()) 439 tgt.setTypeElement(Code10_40.convertCode(src.getTypeElement())); 440 if (src.hasProfile()) 441 tgt.setProfileElement(Canonical10_40.convertReferenceToCanonical(src.getProfile())); 442 for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) 443 tgt.addInteraction(convertResourceInteractionComponent(t)); 444 if (src.hasVersioning()) 445 tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement())); 446 if (src.hasReadHistoryElement()) 447 tgt.setReadHistoryElement(Boolean10_40.convertBoolean(src.getReadHistoryElement())); 448 if (src.hasUpdateCreateElement()) 449 tgt.setUpdateCreateElement(Boolean10_40.convertBoolean(src.getUpdateCreateElement())); 450 if (src.hasConditionalCreateElement()) 451 tgt.setConditionalCreateElement(Boolean10_40.convertBoolean(src.getConditionalCreateElement())); 452 if (src.hasConditionalUpdateElement()) 453 tgt.setConditionalUpdateElement(Boolean10_40.convertBoolean(src.getConditionalUpdateElement())); 454 if (src.hasConditionalDelete()) 455 tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement())); 456 for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); 457 for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); 458 for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) 459 tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); 460 return tgt; 461 } 462 463 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { 464 if (src == null || src.isEmpty()) 465 return null; 466 org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent(); 467 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 468 if (src.hasTypeElement()) 469 tgt.setTypeElement(Code10_40.convertCode(src.getTypeElement())); 470 if (src.hasProfile()) 471 tgt.setProfile(Canonical10_40.convertCanonicalToReference(src.getProfileElement())); 472 for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) 473 tgt.addInteraction(convertResourceInteractionComponent(t)); 474 if (src.hasVersioning()) 475 tgt.setVersioningElement(convertResourceVersionPolicy(src.getVersioningElement())); 476 if (src.hasReadHistoryElement()) 477 tgt.setReadHistoryElement(Boolean10_40.convertBoolean(src.getReadHistoryElement())); 478 if (src.hasUpdateCreateElement()) 479 tgt.setUpdateCreateElement(Boolean10_40.convertBoolean(src.getUpdateCreateElement())); 480 if (src.hasConditionalCreateElement()) 481 tgt.setConditionalCreateElement(Boolean10_40.convertBoolean(src.getConditionalCreateElement())); 482 if (src.hasConditionalUpdateElement()) 483 tgt.setConditionalUpdateElement(Boolean10_40.convertBoolean(src.getConditionalUpdateElement())); 484 if (src.hasConditionalDelete()) 485 tgt.setConditionalDeleteElement(convertConditionalDeleteStatus(src.getConditionalDeleteElement())); 486 for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) tgt.addSearchInclude(t.getValue()); 487 for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) tgt.addSearchRevInclude(t.getValue()); 488 for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) 489 tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); 490 return tgt; 491 } 492 493 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { 494 if (src == null || src.isEmpty()) 495 return null; 496 org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent(); 497 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 498 if (src.hasNameElement()) 499 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 500 if (src.hasDefinition()) 501 tgt.setDefinition(src.getDefinition()); 502 if (src.hasType()) 503 tgt.setTypeElement(Enumerations10_40.convertSearchParamType(src.getTypeElement())); 504 if (src.hasDocumentation()) 505 tgt.setDocumentation(src.getDocumentation()); 506 return tgt; 507 } 508 509 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { 510 if (src == null || src.isEmpty()) 511 return null; 512 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); 513 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 514 if (src.hasNameElement()) 515 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 516 if (src.hasDefinition()) 517 tgt.setDefinition(src.getDefinition()); 518 if (src.hasType()) 519 tgt.setTypeElement(Enumerations10_40.convertSearchParamType(src.getTypeElement())); 520 if (src.hasDocumentation()) 521 tgt.setDocumentation(src.getDocumentation()); 522 return tgt; 523 } 524 525 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { 526 if (src == null || src.isEmpty()) 527 return null; 528 org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent(); 529 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 530 if (src.hasCorsElement()) 531 tgt.setCorsElement(Boolean10_40.convertBoolean(src.getCorsElement())); 532 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) 533 tgt.addService(CodeableConcept10_40.convertCodeableConcept(t)); 534 if (src.hasDescription()) 535 tgt.setDescription(src.getDescription()); 536 return tgt; 537 } 538 539 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { 540 if (src == null || src.isEmpty()) 541 return null; 542 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); 543 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 544 if (src.hasCorsElement()) 545 tgt.setCorsElement(Boolean10_40.convertBoolean(src.getCorsElement())); 546 for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getService()) 547 tgt.addService(CodeableConcept10_40.convertCodeableConcept(t)); 548 if (src.hasDescription()) 549 tgt.setDescription(src.getDescription()); 550 return tgt; 551 } 552 553 public static org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { 554 if (src == null || src.isEmpty()) 555 return null; 556 org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent(); 557 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 558 if (src.hasNameElement()) 559 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 560 if (src.hasVersionElement()) 561 tgt.setVersionElement(String10_40.convertString(src.getVersionElement())); 562 if (src.hasReleaseDateElement()) 563 tgt.setReleaseDateElement(DateTime10_40.convertDateTime(src.getReleaseDateElement())); 564 return tgt; 565 } 566 567 public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { 568 if (src == null || src.isEmpty()) 569 return null; 570 org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); 571 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 572 if (src.hasNameElement()) 573 tgt.setNameElement(String10_40.convertString(src.getNameElement())); 574 if (src.hasVersionElement()) 575 tgt.setVersionElement(String10_40.convertString(src.getVersionElement())); 576 if (src.hasReleaseDateElement()) 577 tgt.setReleaseDateElement(DateTime10_40.convertDateTime(src.getReleaseDateElement())); 578 return tgt; 579 } 580 581 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind> convertConformanceStatementKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind> src) throws FHIRException { 582 if (src == null || src.isEmpty()) 583 return null; 584 Enumeration<Conformance.ConformanceStatementKind> tgt = new Enumeration<>(new Conformance.ConformanceStatementKindEnumFactory()); 585 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 586 if (src.getValue() == null) { 587 tgt.setValue(null); 588 } else { 589 switch (src.getValue()) { 590 case INSTANCE: 591 tgt.setValue(Conformance.ConformanceStatementKind.INSTANCE); 592 break; 593 case CAPABILITY: 594 tgt.setValue(Conformance.ConformanceStatementKind.CAPABILITY); 595 break; 596 case REQUIREMENTS: 597 tgt.setValue(Conformance.ConformanceStatementKind.REQUIREMENTS); 598 break; 599 default: 600 tgt.setValue(Conformance.ConformanceStatementKind.NULL); 601 break; 602 } 603 } 604 return tgt; 605 } 606 607 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind> convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind> src) throws FHIRException { 608 if (src == null || src.isEmpty()) 609 return null; 610 org.hl7.fhir.r4.model.Enumeration<CapabilityStatement.CapabilityStatementKind> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new CapabilityStatement.CapabilityStatementKindEnumFactory()); 611 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 612 if (src.getValue() == null) { 613 tgt.setValue(null); 614 } else { 615 switch (src.getValue()) { 616 case INSTANCE: 617 tgt.setValue(CapabilityStatement.CapabilityStatementKind.INSTANCE); 618 break; 619 case CAPABILITY: 620 tgt.setValue(CapabilityStatement.CapabilityStatementKind.CAPABILITY); 621 break; 622 case REQUIREMENTS: 623 tgt.setValue(CapabilityStatement.CapabilityStatementKind.REQUIREMENTS); 624 break; 625 default: 626 tgt.setValue(CapabilityStatement.CapabilityStatementKind.NULL); 627 break; 628 } 629 } 630 return tgt; 631 } 632 633 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.DocumentMode> convertDocumentMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode> src) throws FHIRException { 634 if (src == null || src.isEmpty()) 635 return null; 636 Enumeration<Conformance.DocumentMode> tgt = new Enumeration<>(new Conformance.DocumentModeEnumFactory()); 637 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 638 if (src.getValue() == null) { 639 tgt.setValue(null); 640 } else { 641 switch (src.getValue()) { 642 case PRODUCER: 643 tgt.setValue(Conformance.DocumentMode.PRODUCER); 644 break; 645 case CONSUMER: 646 tgt.setValue(Conformance.DocumentMode.CONSUMER); 647 break; 648 default: 649 tgt.setValue(Conformance.DocumentMode.NULL); 650 break; 651 } 652 } 653 return tgt; 654 } 655 656 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode> convertDocumentMode(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.DocumentMode> src) throws FHIRException { 657 if (src == null || src.isEmpty()) 658 return null; 659 org.hl7.fhir.r4.model.Enumeration<CapabilityStatement.DocumentMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new CapabilityStatement.DocumentModeEnumFactory()); 660 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 661 if (src.getValue() == null) { 662 tgt.setValue(null); 663 } else { 664 switch (src.getValue()) { 665 case PRODUCER: 666 tgt.setValue(CapabilityStatement.DocumentMode.PRODUCER); 667 break; 668 case CONSUMER: 669 tgt.setValue(CapabilityStatement.DocumentMode.CONSUMER); 670 break; 671 default: 672 tgt.setValue(CapabilityStatement.DocumentMode.NULL); 673 break; 674 } 675 } 676 return tgt; 677 } 678 679 public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException { 680 if (src == null || src.isEmpty()) 681 return null; 682 org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); 683 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 684 if (src.hasCode()) 685 tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement())); 686 if (src.hasDocumentation()) 687 tgt.setDocumentation(src.getDocumentation()); 688 return tgt; 689 } 690 691 public static org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { 692 if (src == null || src.isEmpty()) 693 return null; 694 org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent(); 695 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 696 if (src.hasCode()) 697 tgt.setCodeElement(convertTypeRestfulInteraction(src.getCodeElement())); 698 if (src.hasDocumentation()) 699 tgt.setDocumentation(src.getDocumentation()); 700 return tgt; 701 } 702 703 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy> convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy> src) throws FHIRException { 704 if (src == null || src.isEmpty()) 705 return null; 706 org.hl7.fhir.r4.model.Enumeration<CapabilityStatement.ResourceVersionPolicy> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new CapabilityStatement.ResourceVersionPolicyEnumFactory()); 707 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 708 if (src.getValue() == null) { 709 tgt.setValue(null); 710 } else { 711 switch (src.getValue()) { 712 case NOVERSION: 713 tgt.setValue(CapabilityStatement.ResourceVersionPolicy.NOVERSION); 714 break; 715 case VERSIONED: 716 tgt.setValue(CapabilityStatement.ResourceVersionPolicy.VERSIONED); 717 break; 718 case VERSIONEDUPDATE: 719 tgt.setValue(CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE); 720 break; 721 default: 722 tgt.setValue(CapabilityStatement.ResourceVersionPolicy.NULL); 723 break; 724 } 725 } 726 return tgt; 727 } 728 729 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy> convertResourceVersionPolicy(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy> src) throws FHIRException { 730 if (src == null || src.isEmpty()) 731 return null; 732 Enumeration<Conformance.ResourceVersionPolicy> tgt = new Enumeration<>(new Conformance.ResourceVersionPolicyEnumFactory()); 733 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 734 if (src.getValue() == null) { 735 tgt.setValue(null); 736 } else { 737 switch (src.getValue()) { 738 case NOVERSION: 739 tgt.setValue(Conformance.ResourceVersionPolicy.NOVERSION); 740 break; 741 case VERSIONED: 742 tgt.setValue(Conformance.ResourceVersionPolicy.VERSIONED); 743 break; 744 case VERSIONEDUPDATE: 745 tgt.setValue(Conformance.ResourceVersionPolicy.VERSIONEDUPDATE); 746 break; 747 default: 748 tgt.setValue(Conformance.ResourceVersionPolicy.NULL); 749 break; 750 } 751 } 752 return tgt; 753 } 754 755 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode> convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode> src) throws FHIRException { 756 if (src == null || src.isEmpty()) 757 return null; 758 org.hl7.fhir.r4.model.Enumeration<CapabilityStatement.RestfulCapabilityMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new CapabilityStatement.RestfulCapabilityModeEnumFactory()); 759 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 760 if (src.getValue() == null) { 761 tgt.setValue(null); 762 } else { 763 switch (src.getValue()) { 764 case CLIENT: 765 tgt.setValue(CapabilityStatement.RestfulCapabilityMode.CLIENT); 766 break; 767 case SERVER: 768 tgt.setValue(CapabilityStatement.RestfulCapabilityMode.SERVER); 769 break; 770 default: 771 tgt.setValue(CapabilityStatement.RestfulCapabilityMode.NULL); 772 break; 773 } 774 } 775 return tgt; 776 } 777 778 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode> convertRestfulConformanceMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode> src) throws FHIRException { 779 if (src == null || src.isEmpty()) 780 return null; 781 Enumeration<Conformance.RestfulConformanceMode> tgt = new Enumeration<>(new Conformance.RestfulConformanceModeEnumFactory()); 782 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 783 if (src.getValue() == null) { 784 tgt.setValue(null); 785 } else { 786 switch (src.getValue()) { 787 case CLIENT: 788 tgt.setValue(Conformance.RestfulConformanceMode.CLIENT); 789 break; 790 case SERVER: 791 tgt.setValue(Conformance.RestfulConformanceMode.SERVER); 792 break; 793 default: 794 tgt.setValue(Conformance.RestfulConformanceMode.NULL); 795 break; 796 } 797 } 798 return tgt; 799 } 800 801 public static org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { 802 if (src == null || src.isEmpty()) 803 return null; 804 org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent(); 805 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 806 if (src.hasCode()) 807 tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement())); 808 if (src.hasDocumentation()) 809 tgt.setDocumentation(src.getDocumentation()); 810 return tgt; 811 } 812 813 public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent src) throws FHIRException { 814 if (src == null || src.isEmpty()) 815 return null; 816 org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); 817 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyBackboneElement(src,tgt); 818 if (src.hasCode()) 819 tgt.setCodeElement(convertSystemRestfulInteraction(src.getCodeElement())); 820 if (src.hasDocumentation()) 821 tgt.setDocumentation(src.getDocumentation()); 822 return tgt; 823 } 824 825 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction> convertSystemRestfulInteraction(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction> src) throws FHIRException { 826 if (src == null || src.isEmpty()) 827 return null; 828 Enumeration<Conformance.SystemRestfulInteraction> tgt = new Enumeration<>(new Conformance.SystemRestfulInteractionEnumFactory()); 829 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 830 if (src.getValue() == null) { 831 tgt.setValue(null); 832 } else { 833 switch (src.getValue()) { 834 case TRANSACTION: 835 tgt.setValue(Conformance.SystemRestfulInteraction.TRANSACTION); 836 break; 837 case SEARCHSYSTEM: 838 tgt.setValue(Conformance.SystemRestfulInteraction.SEARCHSYSTEM); 839 break; 840 case HISTORYSYSTEM: 841 tgt.setValue(Conformance.SystemRestfulInteraction.HISTORYSYSTEM); 842 break; 843 default: 844 tgt.setValue(Conformance.SystemRestfulInteraction.NULL); 845 break; 846 } 847 } 848 return tgt; 849 } 850 851 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction> convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction> src) throws FHIRException { 852 if (src == null || src.isEmpty()) 853 return null; 854 org.hl7.fhir.r4.model.Enumeration<SystemRestfulInteraction> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new CapabilityStatement.SystemRestfulInteractionEnumFactory()); 855 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 856 if (src.getValue() == null) { 857 tgt.setValue(null); 858 } else { 859 switch (src.getValue()) { 860 case TRANSACTION: 861 tgt.setValue(SystemRestfulInteraction.TRANSACTION); 862 break; 863 case SEARCHSYSTEM: 864 tgt.setValue(SystemRestfulInteraction.SEARCHSYSTEM); 865 break; 866 case HISTORYSYSTEM: 867 tgt.setValue(SystemRestfulInteraction.HISTORYSYSTEM); 868 break; 869 default: 870 tgt.setValue(SystemRestfulInteraction.NULL); 871 break; 872 } 873 } 874 return tgt; 875 } 876 877 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction> convertTypeRestfulInteraction(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction> src) throws FHIRException { 878 if (src == null || src.isEmpty()) 879 return null; 880 Enumeration<Conformance.TypeRestfulInteraction> tgt = new Enumeration<>(new Conformance.TypeRestfulInteractionEnumFactory()); 881 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 882 if (src.getValue() == null) { 883 tgt.setValue(null); 884 } else { 885 switch (src.getValue()) { 886 case READ: 887 tgt.setValue(Conformance.TypeRestfulInteraction.READ); 888 break; 889 case VREAD: 890 tgt.setValue(Conformance.TypeRestfulInteraction.VREAD); 891 break; 892 case UPDATE: 893 tgt.setValue(Conformance.TypeRestfulInteraction.UPDATE); 894 break; 895 case DELETE: 896 tgt.setValue(Conformance.TypeRestfulInteraction.DELETE); 897 break; 898 case HISTORYINSTANCE: 899 tgt.setValue(Conformance.TypeRestfulInteraction.HISTORYINSTANCE); 900 break; 901 case HISTORYTYPE: 902 tgt.setValue(Conformance.TypeRestfulInteraction.HISTORYTYPE); 903 break; 904 case CREATE: 905 tgt.setValue(Conformance.TypeRestfulInteraction.CREATE); 906 break; 907 case SEARCHTYPE: 908 tgt.setValue(Conformance.TypeRestfulInteraction.SEARCHTYPE); 909 break; 910 default: 911 tgt.setValue(Conformance.TypeRestfulInteraction.NULL); 912 break; 913 } 914 } 915 return tgt; 916 } 917 918 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction> convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction> src) throws FHIRException { 919 if (src == null || src.isEmpty()) 920 return null; 921 org.hl7.fhir.r4.model.Enumeration<CapabilityStatement.TypeRestfulInteraction> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new CapabilityStatement.TypeRestfulInteractionEnumFactory()); 922 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 923 if (src.getValue() == null) { 924 tgt.setValue(null); 925 } else { 926 switch (src.getValue()) { 927 case READ: 928 tgt.setValue(CapabilityStatement.TypeRestfulInteraction.READ); 929 break; 930 case VREAD: 931 tgt.setValue(CapabilityStatement.TypeRestfulInteraction.VREAD); 932 break; 933 case UPDATE: 934 tgt.setValue(CapabilityStatement.TypeRestfulInteraction.UPDATE); 935 break; 936 case DELETE: 937 tgt.setValue(CapabilityStatement.TypeRestfulInteraction.DELETE); 938 break; 939 case HISTORYINSTANCE: 940 tgt.setValue(CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE); 941 break; 942 case HISTORYTYPE: 943 tgt.setValue(CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE); 944 break; 945 case CREATE: 946 tgt.setValue(CapabilityStatement.TypeRestfulInteraction.CREATE); 947 break; 948 case SEARCHTYPE: 949 tgt.setValue(CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE); 950 break; 951 default: 952 tgt.setValue(CapabilityStatement.TypeRestfulInteraction.NULL); 953 break; 954 } 955 } 956 return tgt; 957 } 958 959 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> convertConformanceEventMode(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode> src) throws FHIRException { 960 if (src == null || src.isEmpty()) return null; 961 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityModeEnumFactory()); 962 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 963 if (src.getValue() == null) { 964 tgt.setValue(null); 965} else { 966 switch(src.getValue()) { 967 case SENDER: 968 tgt.setValue(CapabilityStatement.EventCapabilityMode.SENDER); 969 break; 970 case RECEIVER: 971 tgt.setValue(CapabilityStatement.EventCapabilityMode.RECEIVER); 972 break; 973 default: 974 tgt.setValue(CapabilityStatement.EventCapabilityMode.NULL); 975 break; 976 } 977} 978 return tgt; 979 } 980 981 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode> convertConformanceEventMode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode> src) throws FHIRException { 982 if (src == null || src.isEmpty()) return null; 983 org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Conformance.ConformanceEventModeEnumFactory()); 984 ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt); 985 if (src.getValue() == null) { 986 tgt.setValue(null); 987} else { 988 switch(src.getValue()) { 989 case SENDER: 990 tgt.setValue(Conformance.ConformanceEventMode.SENDER); 991 break; 992 case RECEIVER: 993 tgt.setValue(Conformance.ConformanceEventMode.RECEIVER); 994 break; 995 default: 996 tgt.setValue(Conformance.ConformanceEventMode.NULL); 997 break; 998 } 999} 1000 return tgt; 1001 } 1002}