more improvements around lazy loading
This commit is contained in:
parent
a5b8346711
commit
6421226011
|
@ -1,15 +1,32 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseLoader {
|
||||
public abstract class BaseLoaderR5 {
|
||||
|
||||
public interface ILoaderKnowledgeProvider {
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
}
|
||||
|
||||
public static class NullLoaderKnowledgeProvider implements ILoaderKnowledgeProvider {
|
||||
@Override
|
||||
public String getResourcePath(Resource resource) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
protected final String URL_BASE = "http://hl7.org/fhir/";
|
||||
protected final String URL_DSTU2 = "http://hl7.org/fhir/1.0/";
|
||||
protected final String URL_DSTU2016MAY = "http://hl7.org/fhir/1.4/";
|
||||
|
@ -22,10 +39,12 @@ public abstract class BaseLoader {
|
|||
protected boolean killPrimitives;;
|
||||
|
||||
private String[] types;
|
||||
private ILoaderKnowledgeProvider lkp;
|
||||
|
||||
public BaseLoader(String[] types) {
|
||||
public BaseLoaderR5(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
super();
|
||||
this.types = types;
|
||||
this.lkp = lkp;
|
||||
}
|
||||
|
||||
public String[] getTypes() {
|
||||
|
@ -36,7 +55,7 @@ public abstract class BaseLoader {
|
|||
return patchUrls;
|
||||
}
|
||||
|
||||
public BaseLoader setPatchUrls(boolean patchUrls) {
|
||||
public BaseLoaderR5 setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
@ -45,10 +64,20 @@ public abstract class BaseLoader {
|
|||
return killPrimitives;
|
||||
}
|
||||
|
||||
public BaseLoader setKillPrimitives(boolean killPrimitives) {
|
||||
public BaseLoaderR5 setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getResourcePath(Resource resource) {
|
||||
return lkp.getResourcePath(resource);
|
||||
}
|
||||
|
||||
public void setPath(Resource r) {
|
||||
String path = lkp.getResourcePath(r);
|
||||
if (path != null) {
|
||||
r.setUserData("path", path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -55,12 +55,12 @@ import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
|||
import org.hl7.fhir.r4.model.UriType;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
|
||||
public class R2016MayToR4Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
public class R2016MayToR4Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
||||
public R2016MayToR4Loader() {
|
||||
super(new String[0]);
|
||||
super(new String[0], null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,10 +58,10 @@ 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 extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
public class R2016MayToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
|
||||
public R2016MayToR5Loader(String[] types) {
|
||||
super(types);
|
||||
public R2016MayToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
@ -122,6 +122,8 @@ public class R2016MayToR5Loader extends BaseLoader implements IContextResourceLo
|
|||
else
|
||||
r2016may = new XmlParser().parse(stream);
|
||||
org.hl7.fhir.r5.model.Resource r5 = VersionConvertor_14_50.convertResource(r2016may);
|
||||
setPath(r5);
|
||||
|
||||
if (!cslist.isEmpty()) {
|
||||
throw new FHIRException("Error: Cannot have included code systems");
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.util.UUID;
|
|||
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor30;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_30;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.dstu2.formats.JsonParser;
|
||||
import org.hl7.fhir.dstu2.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu2.model.Resource;
|
||||
|
@ -53,12 +54,12 @@ import org.hl7.fhir.dstu3.model.UriType;
|
|||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class R2ToR3Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor30 {
|
||||
public class R2ToR3Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor30 {
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
||||
public R2ToR3Loader() {
|
||||
super(new String[0]);
|
||||
super(new String[0], new NullLoaderKnowledgeProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,6 +39,7 @@ import java.util.UUID;
|
|||
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.dstu2.formats.JsonParser;
|
||||
import org.hl7.fhir.dstu2.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu2.model.Resource;
|
||||
|
@ -54,12 +55,12 @@ import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
|||
import org.hl7.fhir.r4.model.UriType;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
|
||||
public class R2ToR4Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
public class R2ToR4Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
||||
public R2ToR4Loader() {
|
||||
super(new String[0]);
|
||||
super(new String[0], new NullLoaderKnowledgeProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.util.UUID;
|
|||
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.ILoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.dstu2.formats.JsonParser;
|
||||
import org.hl7.fhir.dstu2.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu2.model.Resource;
|
||||
|
@ -57,10 +59,10 @@ 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 extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
public class R2ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
|
||||
public R2ToR5Loader(String[] types) {
|
||||
super(types);
|
||||
public R2ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
@ -121,6 +123,7 @@ public class R2ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
|||
else
|
||||
r2 = new XmlParser().parse(stream);
|
||||
org.hl7.fhir.r5.model.Resource r5 = VersionConvertor_10_50.convertResource(r2, this);
|
||||
setPath(r5);
|
||||
if (!cslist.isEmpty()) {
|
||||
throw new FHIRException("Error: Cannot have included code systems");
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ import java.util.UUID;
|
|||
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_40;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.dstu3.formats.JsonParser;
|
||||
import org.hl7.fhir.dstu3.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
|
@ -50,12 +51,12 @@ import org.hl7.fhir.r4.model.Bundle.BundleType;
|
|||
import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent;
|
||||
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
|
||||
|
||||
public class R3ToR4Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
public class R3ToR4Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor40 {
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
||||
public R3ToR4Loader() {
|
||||
super(new String[0]);
|
||||
super(new String[0], new NullLoaderKnowledgeProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.util.UUID;
|
|||
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_50;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.ILoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.dstu3.formats.JsonParser;
|
||||
import org.hl7.fhir.dstu3.formats.XmlParser;
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
|
@ -57,10 +59,10 @@ 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 extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
public class R3ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
|
||||
public R3ToR5Loader(String[] types) {
|
||||
super(types);
|
||||
public R3ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
@ -123,6 +125,8 @@ public class R3ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
|||
else
|
||||
r3 = new XmlParser().parse(stream);
|
||||
org.hl7.fhir.r5.model.Resource r5 = VersionConvertor_30_50.convertResource(r3, false);
|
||||
setPath(r5);
|
||||
|
||||
if (!cslist.isEmpty()) {
|
||||
throw new FHIRException("Error: Cannot have included code systems");
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.util.UUID;
|
|||
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.ILoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.formats.JsonParser;
|
||||
import org.hl7.fhir.r4.formats.XmlParser;
|
||||
|
@ -57,10 +59,10 @@ 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 extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
public class R4ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
|
||||
public R4ToR5Loader(String[] types) {
|
||||
super(types);
|
||||
public R4ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
@ -123,6 +125,8 @@ public class R4ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
|||
else
|
||||
r4 = new XmlParser().parse(stream);
|
||||
org.hl7.fhir.r5.model.Resource r5 = VersionConvertor_40_50.convertResource(r4);
|
||||
setPath(r5);
|
||||
|
||||
if (!cslist.isEmpty()) {
|
||||
throw new FHIRException("Error: Cannot have included code systems");
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.ILoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
import org.hl7.fhir.r5.formats.XmlParser;
|
||||
|
@ -56,10 +58,10 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
|||
import org.hl7.fhir.r5.model.UriType;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
|
||||
public class R5ToR5Loader extends BaseLoader implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
public class R5ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
|
||||
|
||||
public R5ToR5Loader(String[] types) {
|
||||
super(types);
|
||||
public R5ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
||||
private List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
@ -120,6 +122,7 @@ public class R5ToR5Loader extends BaseLoader implements IContextResourceLoader,
|
|||
r5 = new JsonParser().parse(stream);
|
||||
else
|
||||
r5 = new XmlParser().parse(stream);
|
||||
setPath(r5);
|
||||
|
||||
if (!cslist.isEmpty()) {
|
||||
throw new FHIRException("Error: Cannot have included code systems");
|
||||
|
|
|
@ -262,8 +262,8 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
switch(r.getType()) {
|
||||
case "StructureDefinition":
|
||||
StructureDefinition sd = (StructureDefinition) r.getResource();
|
||||
if ("1.4.0".equals(version)) {
|
||||
StructureDefinition sd = (StructureDefinition) r.getResource();
|
||||
fixOldSD(sd);
|
||||
}
|
||||
structures.register(r, packageInfo);
|
||||
|
|
|
@ -118,9 +118,39 @@ public interface IWorkerContext {
|
|||
}
|
||||
|
||||
public interface IContextResourceLoader {
|
||||
Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException;
|
||||
Resource loadResource(InputStream stream, boolean isJson) throws FHIRException, IOException;
|
||||
/**
|
||||
* @return List of the resource types that shoud be loaded
|
||||
*/
|
||||
String[] getTypes();
|
||||
|
||||
/**
|
||||
* Request to actually load the resources and do whatever is required
|
||||
*
|
||||
* @param stream
|
||||
* @param isJson
|
||||
* @return A bundle because some single resources become multiple resources after loading
|
||||
* @throws FHIRException
|
||||
* @throws IOException
|
||||
*/
|
||||
Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException;
|
||||
|
||||
/**
|
||||
* Load a single resources (lazy load)
|
||||
*
|
||||
* @param stream
|
||||
* @param isJson
|
||||
* @return
|
||||
* @throws FHIRException - throw this if you a single resource can't be returned - can't lazy load in this circumstance
|
||||
* @throws IOException
|
||||
*/
|
||||
Resource loadResource(InputStream stream, boolean isJson) throws FHIRException, IOException;
|
||||
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
} finally {
|
||||
f.close();
|
||||
}
|
||||
} catch (FHIRFormatError | IOException e) {
|
||||
} catch (Exception e) {
|
||||
throw new FHIRException("Error loading "+filename+": "+e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
@ -317,11 +317,19 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
logger.logDebugMessage(LogCategory.CONTEXT, "unidentified resource in " + name+" (no fullUrl)");
|
||||
}
|
||||
if (filter == null || filter.isOkToLoad(e.getResource())) {
|
||||
String path = loader != null ? loader.getResourcePath(e.getResource()) : null;
|
||||
if (path != null) {
|
||||
e.getResource().setUserData("path", path);
|
||||
}
|
||||
cacheResource(e.getResource());
|
||||
}
|
||||
}
|
||||
} else if (f instanceof CanonicalResource) {
|
||||
if (filter == null || filter.isOkToLoad(f)) {
|
||||
String path = loader != null ? loader.getResourcePath(f) : null;
|
||||
if (path != null) {
|
||||
f.setUserData("path", path);
|
||||
}
|
||||
cacheResource(f);
|
||||
}
|
||||
}
|
||||
|
@ -347,6 +355,10 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
if (f != null)
|
||||
for (BundleEntryComponent e : f.getEntry()) {
|
||||
if (filter == null || filter.isOkToLoad(e.getResource())) {
|
||||
String path = loader != null ? loader.getResourcePath(e.getResource()) : null;
|
||||
if (path != null) {
|
||||
e.getResource().setUserData("path", path);
|
||||
}
|
||||
cacheResourceFromPackage(e.getResource(), pi);
|
||||
}
|
||||
}
|
||||
|
@ -356,26 +368,6 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
loadFromStream(new CSFileInputStream(path), loader);
|
||||
}
|
||||
|
||||
// public void loadFromPackage(NpmPackage pi, IContextResourceLoader loader, ILoadFilter filter) throws IOException {
|
||||
// if (progress) {
|
||||
// System.out.println("Load Package "+pi.name()+"#"+pi.version());
|
||||
// }
|
||||
// loadedPackages.add(pi.id()+"#"+pi.version());
|
||||
// String [] types = loader != null ? loader.getTypes() : new String[] { "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem" };
|
||||
// for (PackageResourceInformation pri : pi.listIndexedResources(types)) {
|
||||
// try {
|
||||
// registerResourceFromPackage(new PackageResourceLoader(pri, loader), new PackageVersion(pi.id(), pi.version()));
|
||||
// } catch (FHIRException e) {
|
||||
// throw new FHIRException(formatMessage(I18nConstants.ERROR_READING__FROM_PACKAGE__, pri.getFilename(), pi.name(), pi.version(), e.getMessage()), e);
|
||||
// }
|
||||
// }
|
||||
// for (String s : pi.list("other")) {
|
||||
// binaries.put(s, TextFile.streamToBytes(pi.load("other", s)));
|
||||
// }
|
||||
// if (version == null) {
|
||||
// version = pi.version();
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void loadFromPackage(NpmPackage pi, IContextResourceLoader loader, String... types) throws FileNotFoundException, IOException, FHIRException {
|
||||
|
|
|
@ -82,6 +82,11 @@ public class SnapShotGenerationTests {
|
|||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResourcePath(Resource resource) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum TestFetchMode {
|
||||
|
|
|
@ -1053,6 +1053,10 @@ public class NpmPackage {
|
|||
public boolean isChangedByLoader() {
|
||||
return changedByLoader;
|
||||
}
|
||||
|
||||
public boolean isCore() {
|
||||
return "fhir.core".equals(JSONUtil.str(npm, "type"));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package org.hl7.fhir.validation;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.convertors.*;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.convertors.loaders.R2016MayToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.R2ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.R3ToR5Loader;
|
||||
|
@ -398,15 +399,15 @@ public class ValidationEngine implements IValidatorResourceFetcher {
|
|||
if (Utilities.noString(version))
|
||||
return null;
|
||||
if (version.startsWith("1.0"))
|
||||
return new R2ToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"});
|
||||
return new R2ToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
if (version.startsWith("1.4"))
|
||||
return new R2016MayToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}); // special case
|
||||
return new R2016MayToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider()); // special case
|
||||
if (version.startsWith("3.0"))
|
||||
return new R3ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"});
|
||||
return new R3ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
if (version.startsWith("4.0"))
|
||||
return new R4ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"});
|
||||
return new R4ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
if (version.startsWith("5.0"))
|
||||
return new R5ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"});
|
||||
return new R5ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ import org.hl7.fhir.convertors.loaders.R2016MayToR5Loader;
|
|||
import org.hl7.fhir.convertors.loaders.R2ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.R3ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.R4ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
|
@ -101,13 +102,13 @@ public class TestingUtilitiesX {
|
|||
if (Utilities.noString(version))
|
||||
return null;
|
||||
if (version.startsWith("1.0"))
|
||||
return new R2ToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"});
|
||||
return new R2ToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
if (version.startsWith("1.4"))
|
||||
return new R2016MayToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}); // special case
|
||||
return new R2016MayToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider()); // special case
|
||||
if (version.startsWith("3.0"))
|
||||
return new R3ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"});
|
||||
return new R3ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
if (version.startsWith("4.0"))
|
||||
return new R4ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"});
|
||||
return new R4ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue