Merge pull request #1230 from hapifhir/MapValidationStuff

Fix IG Loader problems where map conversion no longer works with a 'n…
This commit is contained in:
Grahame Grieve 2023-04-26 22:24:51 +10:00 committed by GitHub
commit 1f76c6e944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);