From c4139ae9a1e63b30045d75d8ae103fafaa53a88e Mon Sep 17 00:00:00 2001 From: azizjonh <62953099+azizjonh@users.noreply.github.com> Date: Tue, 1 Dec 2020 11:05:57 -0600 Subject: [PATCH] Load context from classpath allowing duplicates Added ability to specify whether to allow duplicates when loading context from classpath. In similar fashion to loading from package. --- .../org/hl7/fhir/r5/context/SimpleWorkerContext.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java index 14cb75b2a..dd8485983 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java @@ -243,10 +243,14 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon } public static SimpleWorkerContext fromClassPath(String name) throws IOException, FHIRException { - InputStream s = SimpleWorkerContext.class.getResourceAsStream("/"+name); - SimpleWorkerContext res = new SimpleWorkerContext(); + return fromClassPath(name, false); + } + public static SimpleWorkerContext fromClassPath(String name, boolean allowDuplicates) throws IOException, FHIRException { + InputStream s = SimpleWorkerContext.class.getResourceAsStream("/" + name); + SimpleWorkerContext res = new SimpleWorkerContext(); + res.setAllowLoadingDuplicates(allowDuplicates); res.loadFromStream(s, null); - return res; + return res; } // public static SimpleWorkerContext fromDefinitions(Map source) throws IOException, FHIRException { @@ -829,4 +833,4 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon } -} \ No newline at end of file +}