diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/CapabilityStatement30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/CapabilityStatement30_40.java index 81b110c18..025ebaccb 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/CapabilityStatement30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/resources30_40/CapabilityStatement30_40.java @@ -24,7 +24,6 @@ public class CapabilityStatement30_40 { if (src == null) return null; org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); - //FIXME add ignore ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); if (src.hasUrl()) tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement())); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CapabilityStatement30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CapabilityStatement30_50.java index 04788034b..19ea47cde 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CapabilityStatement30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CapabilityStatement30_50.java @@ -20,26 +20,11 @@ import org.hl7.fhir.exceptions.FHIRException; public class CapabilityStatement30_50 { - public static final String ACCEPT_UNKNOWN_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"; - public static final String PROFILE_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile"; - - public static final String ACCEPT_LANGUAGE_EXTENSION_URL = "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptLanguage"; - - private static final String[] IGNORED_R5_EXTENSION_URLS = new String[]{ - - ACCEPT_UNKNOWN_EXTENSION_URL - }; - - private static final String[] IGNORED_DSTU3_EXTENSION_URLS = new String[]{ - PROFILE_EXTENSION_URL, - ACCEPT_LANGUAGE_EXTENSION_URL - }; public static org.hl7.fhir.r5.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { if (src == null) return null; org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); - //FIXME add ignore - ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt, IGNORED_DSTU3_EXTENSION_URLS); + ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); if (src.hasUrl()) tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement())); if (src.hasVersion()) @@ -78,17 +63,14 @@ public class CapabilityStatement30_50 { if (src.hasFhirVersion()) tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(fixCode(src.getFhirVersion()))); if (src.hasAcceptUnknown()) - tgt.addExtension().setUrl(ACCEPT_UNKNOWN_EXTENSION_URL).setValue(new org.hl7.fhir.r5.model.CodeType(src.getAcceptUnknownElement().asStringValue())); + tgt.addExtension().setUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").setValue(new org.hl7.fhir.r5.model.CodeType(src.getAcceptUnknownElement().asStringValue())); for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.dstu3.model.CodeType t : src.getPatchFormat()) tgt.addPatchFormat(t.getValue()); - for (org.hl7.fhir.dstu3.model.Extension extension : src.getExtensionsByUrl(ACCEPT_LANGUAGE_EXTENSION_URL)) { - tgt.addAcceptLanguageElement().setValue(extension.getValue().primitiveValue()); - } for (org.hl7.fhir.dstu3.model.UriType t : src.getImplementationGuide()) tgt.addImplementationGuide(t.getValue()); for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertCapabilityStatementRestComponent(t)); for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addExtension(PROFILE_EXTENSION_URL, Reference30_50.convertReference(t)); + tgt.addExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile", Reference30_50.convertReference(t)); for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) @@ -108,7 +90,7 @@ public class CapabilityStatement30_50 { if (src == null) return null; org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); - ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt, IGNORED_R5_EXTENSION_URLS); + ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); if (src.hasUrl()) tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement())); if (src.hasVersion()) @@ -146,20 +128,17 @@ public class CapabilityStatement30_50 { tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); if (src.hasFhirVersion()) tgt.setFhirVersion(src.getFhirVersion().toCode()); - if (src.hasExtension(ACCEPT_UNKNOWN_EXTENSION_URL)) - tgt.setAcceptUnknown(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.fromCode(src.getExtensionByUrl(ACCEPT_UNKNOWN_EXTENSION_URL).getValue().primitiveValue())); + if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown")) + tgt.setAcceptUnknown(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue())); for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue()); for (org.hl7.fhir.r5.model.CodeType t : src.getPatchFormat()) tgt.addPatchFormat(t.getValue()); - for (org.hl7.fhir.r5.model.CodeType t : src.getAcceptLanguage()) { - tgt.addExtension(ACCEPT_LANGUAGE_EXTENSION_URL, Code30_50.convertCodeToString(t)); - } for (org.hl7.fhir.r5.model.UriType t : src.getImplementationGuide()) tgt.addImplementationGuide(t.getValue()); for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent r : src.getRest()) for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(Reference30_50.convertCanonicalToReference(t)); for (org.hl7.fhir.r5.model.Extension ext : src.getExtension()) { - if (PROFILE_EXTENSION_URL.equals(ext.getUrl())) { + if ("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile".equals(ext.getUrl())) { tgt.addProfile(Reference30_50.convertReference((org.hl7.fhir.r5.model.Reference) ext.getValue())); } } diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/CapabilityStatement30_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/CapabilityStatement30_50Test.java deleted file mode 100644 index 2f1161066..000000000 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv30_50/CapabilityStatement30_50Test.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.hl7.fhir.convertors.conv30_50; - -import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50; -import org.hl7.fhir.r5.formats.JsonParser; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class CapabilityStatement30_50Test { - - - @Test - @DisplayName("Test r5 -> dstu3 capabilityStatement conversion.") - public void testR5_DSTU3() throws IOException { - InputStream r5_input = this.getClass().getResourceAsStream("/capability_statement_50.json"); - - JsonParser r5_parser = new JsonParser(); - org.hl7.fhir.r5.model.CapabilityStatement r5_actual = (org.hl7.fhir.r5.model.CapabilityStatement) r5_parser.parse(r5_input); - org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertorFactory_30_50.convertResource(r5_actual); - - org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser(); - - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - dstu3_parser.compose(stream, dstu3_conv); - - org.hl7.fhir.dstu3.model.Resource dstu3_streamed = (org.hl7.fhir.dstu3.model.CapabilityStatement) dstu3_parser.parse(new ByteArrayInputStream(stream.toByteArray())); - org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_30_50.convertResource(dstu3_streamed); - - assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same"); - } - -} diff --git a/org.hl7.fhir.convertors/src/test/resources/capability_statement_50.json b/org.hl7.fhir.convertors/src/test/resources/capability_statement_50.json deleted file mode 100644 index fa1a4a9a2..000000000 --- a/org.hl7.fhir.convertors/src/test/resources/capability_statement_50.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "resourceType" : "CapabilityStatement", - "id" : "example", - "text" : { - "status" : "generated", - "div" : "
The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.
\n\t\t\t\nThe EHR System supports the following message: admin-notify::Person.
\n\t\t\t\nThe EHR Application has a \n \n general document profile.\n \n
\n\t\t\n