From 5e8f97f57c9e2fbff0fdc14f79cae39f722f3dfe Mon Sep 17 00:00:00 2001 From: Lloyd McKenzie Date: Sun, 23 Apr 2023 14:20:45 -0600 Subject: [PATCH] Fix IG Loader problems where map conversion no longer works with a 'null' context --- .../org/hl7/fhir/dstu3/context/SimpleWorkerContext.java | 5 +++++ .../java/org/hl7/fhir/r4/context/SimpleWorkerContext.java | 5 +++++ .../src/main/java/org/hl7/fhir/validation/IgLoader.java | 6 +++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/context/SimpleWorkerContext.java b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/context/SimpleWorkerContext.java index bc6b2bec3..9dcd8d253 100644 --- a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/context/SimpleWorkerContext.java +++ b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/context/SimpleWorkerContext.java @@ -140,6 +140,11 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon return res; } + public static SimpleWorkerContext fromNothing() throws FileNotFoundException, IOException, FHIRException { + SimpleWorkerContext res = new SimpleWorkerContext(); + return res; + } + public static SimpleWorkerContext fromPackage(NpmPackage pi, boolean allowDuplicates) throws FileNotFoundException, IOException, FHIRException { SimpleWorkerContext res = new SimpleWorkerContext(); res.setAllowLoadingDuplicates(allowDuplicates); diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/context/SimpleWorkerContext.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/context/SimpleWorkerContext.java index 2d273468d..5358e9233 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/context/SimpleWorkerContext.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/context/SimpleWorkerContext.java @@ -147,6 +147,11 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon return res; } + public static SimpleWorkerContext fromNothing() throws FileNotFoundException, IOException, FHIRException { + SimpleWorkerContext res = new SimpleWorkerContext(); + return res; + } + public static SimpleWorkerContext fromPackage(NpmPackage pi, boolean allowDuplicates) throws FileNotFoundException, IOException, FHIRException { SimpleWorkerContext res = new SimpleWorkerContext(); res.setAllowLoadingDuplicates(allowDuplicates); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java index 489da4564..5459d4fc3 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java @@ -785,7 +785,7 @@ public class IgLoader { else if (fn.endsWith(".json") && !fn.endsWith("template.json")) res = new org.hl7.fhir.dstu3.formats.JsonParser().parse(new ByteArrayInputStream(content)); else if (fn.endsWith(".txt") || fn.endsWith(".map") || fn.endsWith(".fml")) - res = new org.hl7.fhir.dstu3.utils.StructureMapUtilities(null).parse(new String(content)); + res = new org.hl7.fhir.dstu3.utils.StructureMapUtilities(org.hl7.fhir.dstu3.context.SimpleWorkerContext.fromNothing()).parse(new String(content)); else throw new FHIRException("Unsupported format for " + fn); r = VersionConvertorFactory_30_50.convertResource(res); @@ -796,7 +796,7 @@ public class IgLoader { else if (fn.endsWith(".json") && !fn.endsWith("template.json")) res = new org.hl7.fhir.r4.formats.JsonParser().parse(new ByteArrayInputStream(content)); else if (fn.endsWith(".txt") || fn.endsWith(".map") || fn.endsWith(".fml")) - res = new org.hl7.fhir.r4.utils.StructureMapUtilities(null).parse(new String(content), fn); + res = new org.hl7.fhir.r4.utils.StructureMapUtilities(org.hl7.fhir.r4.context.SimpleWorkerContext.fromNothing()).parse(new String(content), fn); else throw new FHIRException("Unsupported format for " + fn); r = VersionConvertorFactory_40_50.convertResource(res); @@ -807,7 +807,7 @@ public class IgLoader { else if (fn.endsWith(".json") && !fn.endsWith("template.json")) res = new org.hl7.fhir.r4b.formats.JsonParser().parse(new ByteArrayInputStream(content)); else if (fn.endsWith(".txt") || fn.endsWith(".map") || fn.endsWith(".fml")) - res = new org.hl7.fhir.r4b.utils.structuremap.StructureMapUtilities(null).parse(new String(content), fn); + res = new org.hl7.fhir.r4b.utils.structuremap.StructureMapUtilities(org.hl7.fhir.r4b.context.SimpleWorkerContext.fromNothing()).parse(new String(content), fn); else throw new FHIRException("Unsupported format for " + fn); r = VersionConvertorFactory_43_50.convertResource(res);