From f4f978941d97ea8ee6689d26a85d10ed5f66186a Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 12 Aug 2024 05:59:10 +0800 Subject: [PATCH] add isUnknownLocalReferencesNotLinks to RenderingContext --- .../org/hl7/fhir/r5/renderers/ResourceRenderer.java | 2 +- .../hl7/fhir/r5/renderers/utils/RenderingContext.java | 10 ++++++++++ .../tests/ExternalTerminologyServiceTests.java | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java index 284b74660..b899fd8f1 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java @@ -341,7 +341,7 @@ public abstract class ResourceRenderer extends DataRenderer { ResourceWithReference rr = resolveReference(actual); if (rr == null) { String disp = display != null && display.hasPrimitiveValue() ? displayDataType(display) : actual.primitiveValue(); - if (Utilities.isAbsoluteUrl(actual.primitiveValue())) { + if (Utilities.isAbsoluteUrl(actual.primitiveValue()) || !context.isUnknownLocalReferencesNotLinks()) { x.ah(context.prefixLocalHref(actual.primitiveValue())).tx(disp); } else { x.code().tx(disp); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/RenderingContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/RenderingContext.java index 06e3a0fee..572523a1e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/RenderingContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/RenderingContext.java @@ -274,6 +274,7 @@ public class RenderingContext extends RenderingI18nContext { private boolean shortPatientForm; private String uniqueLocalPrefix; private Set anchors = new HashSet<>(); + private boolean unknownLocalReferencesNotLinks; /** * @@ -342,6 +343,7 @@ public class RenderingContext extends RenderingI18nContext { if (copyAnchors) { res.anchors = anchors; } + res.unknownLocalReferencesNotLinks = unknownLocalReferencesNotLinks; return res; } @@ -1023,4 +1025,12 @@ public class RenderingContext extends RenderingI18nContext { public void clearAnchors() { anchors.clear(); } + + public boolean isUnknownLocalReferencesNotLinks() { + return unknownLocalReferencesNotLinks; + } + + public void setUnknownLocalReferencesNotLinks(boolean unknownLocalReferencesNotLinks) { + this.unknownLocalReferencesNotLinks = unknownLocalReferencesNotLinks; + } } \ No newline at end of file diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/ExternalTerminologyServiceTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/ExternalTerminologyServiceTests.java index ef09843f1..077b5faa7 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/ExternalTerminologyServiceTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/terminology/tests/ExternalTerminologyServiceTests.java @@ -94,6 +94,10 @@ public class ExternalTerminologyServiceTests implements ITxTesterLoader { if (tester == null) { tester = new TxTester(this, SERVER, true, externals); } + + if (setup.suite.asBoolean("disabled") || setup.test.asBoolean("disabled")) { + return; + } String err = tester.executeTest(setup.suite, setup.test, modes); Assertions.assertTrue(err == null, err); } else {