From 219e4acbbde577b746220bc705745955a8c15683 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sat, 21 Dec 2019 09:12:23 +1100 Subject: [PATCH] fix so UTG can ignore FHIR core terminology resources --- .../org/hl7/fhir/convertors/R2016MayToR5Loader.java | 6 +++++- .../java/org/hl7/fhir/convertors/R2ToR5Loader.java | 7 ++++++- .../java/org/hl7/fhir/convertors/R3ToR5Loader.java | 6 +++++- .../java/org/hl7/fhir/convertors/R4ToR5Loader.java | 6 +++++- .../org/hl7/fhir/r5/context/SimpleWorkerContext.java | 11 ++++++++--- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2016MayToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2016MayToR5Loader.java index 38c6af7f9..d9abc7b22 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2016MayToR5Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2016MayToR5Loader.java @@ -43,7 +43,11 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.ValueSet; -public class R2016MayToR5Loader implements IContextResourceLoader, VersionConvertorAdvisor50 { +public class R2016MayToR5Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 { + + public R2016MayToR5Loader(String[] types) { + super(types); + } private List cslist = new ArrayList<>(); private boolean patchUrls; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java index 0f1250e47..120640a79 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java @@ -42,7 +42,12 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.ValueSet; -public class R2ToR5Loader implements IContextResourceLoader, VersionConvertorAdvisor50 { +public class R2ToR5Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 { + + + public R2ToR5Loader(String[] types) { + super(types); + } private List cslist = new ArrayList<>(); private boolean patchUrls; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R3ToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R3ToR5Loader.java index ddda813b8..10495924d 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R3ToR5Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R3ToR5Loader.java @@ -45,7 +45,11 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.ValueSet; -public class R3ToR5Loader implements IContextResourceLoader, VersionConvertorAdvisor50 { +public class R3ToR5Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 { + + public R3ToR5Loader(String[] types) { + super(types); + } private List cslist = new ArrayList<>(); private boolean patchUrls; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R4ToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R4ToR5Loader.java index a24e00a5e..dd0c69156 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R4ToR5Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R4ToR5Loader.java @@ -45,7 +45,11 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.ValueSet; -public class R4ToR5Loader implements IContextResourceLoader, VersionConvertorAdvisor50 { +public class R4ToR5Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 { + + public R4ToR5Loader(String[] types) { + super(types); + } private List cslist = new ArrayList<>(); private boolean patchUrls; 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 0350be3ea..792c43057 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 @@ -98,6 +98,8 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon public interface IContextResourceLoader { Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException; + + String[] getTypes(); } public interface IValidatorFactory { @@ -292,15 +294,18 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon Resource r = json.parse(stream); if (r instanceof Bundle) f = (Bundle) r; - else if (filter == null || filter.isOkToLoad(f)) + else if (filter == null || filter.isOkToLoad(f)) { cacheResource(r); + } } } catch (FHIRFormatError e1) { throw new org.hl7.fhir.exceptions.FHIRFormatError(e1.getMessage(), e1); } if (f != null) for (BundleEntryComponent e : f.getEntry()) { - cacheResource(e.getResource()); + if (filter == null || filter.isOkToLoad(e.getResource())) { + cacheResource(e.getResource()); + } } } @@ -312,7 +317,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon if (progress) { System.out.println("Load Package "+pi.name()+"#"+pi.version()); } - for (String s : pi.listResources()) { + for (String s : pi.listResources(loader.getTypes())) { loadDefinitionItem(s, pi.load("package", s), loader, filter); } for (String s : pi.list("other")) {