fix so UTG can ignore FHIR core terminology resources

This commit is contained in:
Grahame Grieve 2019-12-21 09:12:23 +11:00
parent 7bc95ade09
commit 219e4acbbd
5 changed files with 29 additions and 7 deletions

View File

@ -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.UriType;
import org.hl7.fhir.r5.model.ValueSet; 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<CodeSystem> cslist = new ArrayList<>(); private List<CodeSystem> cslist = new ArrayList<>();
private boolean patchUrls; private boolean patchUrls;

View File

@ -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.UriType;
import org.hl7.fhir.r5.model.ValueSet; 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<CodeSystem> cslist = new ArrayList<>(); private List<CodeSystem> cslist = new ArrayList<>();
private boolean patchUrls; private boolean patchUrls;

View File

@ -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.UriType;
import org.hl7.fhir.r5.model.ValueSet; 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<CodeSystem> cslist = new ArrayList<>(); private List<CodeSystem> cslist = new ArrayList<>();
private boolean patchUrls; private boolean patchUrls;

View File

@ -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.UriType;
import org.hl7.fhir.r5.model.ValueSet; 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<CodeSystem> cslist = new ArrayList<>(); private List<CodeSystem> cslist = new ArrayList<>();
private boolean patchUrls; private boolean patchUrls;

View File

@ -98,6 +98,8 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
public interface IContextResourceLoader { public interface IContextResourceLoader {
Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException; Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException;
String[] getTypes();
} }
public interface IValidatorFactory { public interface IValidatorFactory {
@ -292,16 +294,19 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
Resource r = json.parse(stream); Resource r = json.parse(stream);
if (r instanceof Bundle) if (r instanceof Bundle)
f = (Bundle) r; f = (Bundle) r;
else if (filter == null || filter.isOkToLoad(f)) else if (filter == null || filter.isOkToLoad(f)) {
cacheResource(r); cacheResource(r);
} }
}
} catch (FHIRFormatError e1) { } catch (FHIRFormatError e1) {
throw new org.hl7.fhir.exceptions.FHIRFormatError(e1.getMessage(), e1); throw new org.hl7.fhir.exceptions.FHIRFormatError(e1.getMessage(), e1);
} }
if (f != null) if (f != null)
for (BundleEntryComponent e : f.getEntry()) { for (BundleEntryComponent e : f.getEntry()) {
if (filter == null || filter.isOkToLoad(e.getResource())) {
cacheResource(e.getResource()); cacheResource(e.getResource());
} }
}
} }
private void loadFromPack(String path, IContextResourceLoader loader) throws FileNotFoundException, IOException, FHIRException { private void loadFromPack(String path, IContextResourceLoader loader) throws FileNotFoundException, IOException, FHIRException {
@ -312,7 +317,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
if (progress) { if (progress) {
System.out.println("Load Package "+pi.name()+"#"+pi.version()); 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); loadDefinitionItem(s, pi.load("package", s), loader, filter);
} }
for (String s : pi.list("other")) { for (String s : pi.list("other")) {