refix version

This commit is contained in:
Grahame Grieve 2019-12-20 16:44:46 +11:00
parent 74daa21ddb
commit 3f25f96aca
12 changed files with 59 additions and 27 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -49,7 +49,7 @@ public class R3ToR5Loader implements IContextResourceLoader, VersionConvertorAdv
private List<CodeSystem> cslist = new ArrayList<>(); private List<CodeSystem> cslist = new ArrayList<>();
private boolean patchUrls; private boolean patchUrls;
private boolean killPrimitives;; private boolean killPrimitives;
@Override @Override
public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException { public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException {

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -47,6 +47,7 @@ import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.conformance.ProfileUtilities; import org.hl7.fhir.r5.conformance.ProfileUtilities;
import org.hl7.fhir.r5.conformance.ProfileUtilities.ProfileKnowledgeProvider; import org.hl7.fhir.r5.conformance.ProfileUtilities.ProfileKnowledgeProvider;
import org.hl7.fhir.r5.context.IWorkerContext.ILoggingService.LogCategory; import org.hl7.fhir.r5.context.IWorkerContext.ILoggingService.LogCategory;
import org.hl7.fhir.r5.context.SimpleWorkerContext.ILoadFilter;
import org.hl7.fhir.r5.formats.IParser; import org.hl7.fhir.r5.formats.IParser;
import org.hl7.fhir.r5.formats.JsonParser; import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.formats.ParserType; import org.hl7.fhir.r5.formats.ParserType;
@ -88,6 +89,12 @@ import ca.uhn.fhir.parser.DataFormatException;
public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerContext, ProfileKnowledgeProvider { public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerContext, ProfileKnowledgeProvider {
public interface ILoadFilter {
boolean isOkToLoad(Resource resource);
}
public interface IContextResourceLoader { public interface IContextResourceLoader {
Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException; Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException;
} }
@ -142,9 +149,12 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
} }
public static SimpleWorkerContext fromPackage(NpmPackage pi, boolean allowDuplicates) throws FileNotFoundException, IOException, FHIRException { public static SimpleWorkerContext fromPackage(NpmPackage pi, boolean allowDuplicates) throws FileNotFoundException, IOException, FHIRException {
return fromPackage(pi, allowDuplicates, null);
}
public static SimpleWorkerContext fromPackage(NpmPackage pi, boolean allowDuplicates, ILoadFilter filter) throws FileNotFoundException, IOException, FHIRException {
SimpleWorkerContext res = new SimpleWorkerContext(); SimpleWorkerContext res = new SimpleWorkerContext();
res.setAllowLoadingDuplicates(allowDuplicates); res.setAllowLoadingDuplicates(allowDuplicates);
res.loadFromPackage(pi, null); res.loadFromPackage(pi, null, filter);
return res; return res;
} }
@ -191,7 +201,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
public static SimpleWorkerContext fromDefinitions(Map<String, byte[]> source) throws IOException, FHIRException { public static SimpleWorkerContext fromDefinitions(Map<String, byte[]> source) throws IOException, FHIRException {
SimpleWorkerContext res = new SimpleWorkerContext(); SimpleWorkerContext res = new SimpleWorkerContext();
for (String name : source.keySet()) { for (String name : source.keySet()) {
res.loadDefinitionItem(name, new ByteArrayInputStream(source.get(name)), null); res.loadDefinitionItem(name, new ByteArrayInputStream(source.get(name)), null, null);
} }
return res; return res;
} }
@ -200,7 +210,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
SimpleWorkerContext res = new SimpleWorkerContext(); SimpleWorkerContext res = new SimpleWorkerContext();
for (String name : source.keySet()) { for (String name : source.keySet()) {
try { try {
res.loadDefinitionItem(name, new ByteArrayInputStream(source.get(name)), loader); res.loadDefinitionItem(name, new ByteArrayInputStream(source.get(name)), loader, null);
} catch (Exception e) { } catch (Exception e) {
System.out.println("Error loading "+name+": "+e.getMessage()); System.out.println("Error loading "+name+": "+e.getMessage());
throw new FHIRException("Error loading "+name+": "+e.getMessage(), e); throw new FHIRException("Error loading "+name+": "+e.getMessage(), e);
@ -208,18 +218,18 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
} }
return res; return res;
} }
private void loadDefinitionItem(String name, InputStream stream, IContextResourceLoader loader) throws IOException, FHIRException {
private void loadDefinitionItem(String name, InputStream stream, IContextResourceLoader loader, ILoadFilter filter) throws IOException, FHIRException {
if (name.endsWith(".xml")) if (name.endsWith(".xml"))
loadFromFile(stream, name, loader); loadFromFile(stream, name, loader, filter);
else if (name.endsWith(".json")) else if (name.endsWith(".json"))
loadFromFileJson(stream, name, loader); loadFromFileJson(stream, name, loader, filter);
else if (name.equals("version.info")) else if (name.equals("version.info"))
readVersionInfo(stream); readVersionInfo(stream);
else else
loadBytes(name, stream); loadBytes(name, stream);
} }
public String connectToTSServer(TerminologyClient client, String log) { public String connectToTSServer(TerminologyClient client, String log) {
try { try {
tlog("Connect to "+client.getAddress()); tlog("Connect to "+client.getAddress());
@ -232,7 +242,11 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
} }
} }
public void loadFromFile(InputStream stream, String name, IContextResourceLoader loader) throws IOException, FHIRException { public void loadFromFile(InputStream stream, String name, IContextResourceLoader loader) throws IOException, FHIRException {
loadFromFile(stream, name, null);
}
public void loadFromFile(InputStream stream, String name, IContextResourceLoader loader, ILoadFilter filter) throws IOException, FHIRException {
Resource f; Resource f;
try { try {
if (loader != null) if (loader != null)
@ -252,15 +266,18 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
if (e.getFullUrl() == null) { if (e.getFullUrl() == null) {
logger.logDebugMessage(LogCategory.CONTEXT, "unidentified resource in " + name+" (no fullUrl)"); logger.logDebugMessage(LogCategory.CONTEXT, "unidentified resource in " + name+" (no fullUrl)");
} }
cacheResource(e.getResource()); if (filter == null || filter.isOkToLoad(e.getResource())) {
cacheResource(e.getResource());
}
} }
} else if (f instanceof MetadataResource) { } else if (f instanceof MetadataResource) {
MetadataResource m = (MetadataResource) f; if (filter == null || filter.isOkToLoad(f)) {
cacheResource(m); cacheResource(f);
}
} }
} }
private void loadFromFileJson(InputStream stream, String name, IContextResourceLoader loader) throws IOException, FHIRException { private void loadFromFileJson(InputStream stream, String name, IContextResourceLoader loader, ILoadFilter filter) throws IOException, FHIRException {
Bundle f = null; Bundle f = null;
try { try {
if (loader != null) if (loader != null)
@ -270,7 +287,7 @@ 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 else if (filter == null || filter.isOkToLoad(f))
cacheResource(r); cacheResource(r);
} }
} catch (FHIRFormatError e1) { } catch (FHIRFormatError e1) {
@ -286,6 +303,21 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
loadFromStream(new CSFileInputStream(path), loader); loadFromStream(new CSFileInputStream(path), loader);
} }
public void loadFromPackage(NpmPackage pi, IContextResourceLoader loader, ILoadFilter filter) throws FileNotFoundException, IOException, FHIRException {
if (progress) {
System.out.println("Load Package "+pi.name()+"#"+pi.version());
}
for (String s : pi.listResources()) {
loadDefinitionItem(s, pi.load("package", s), loader, filter);
}
for (String s : pi.list("other")) {
binaries.put(s, TextFile.streamToBytes(pi.load("other", s)));
}
if (version == null) {
version = pi.version();
}
}
public void loadFromPackage(NpmPackage pi, IContextResourceLoader loader, String... types) throws FileNotFoundException, IOException, FHIRException { public void loadFromPackage(NpmPackage pi, IContextResourceLoader loader, String... types) throws FileNotFoundException, IOException, FHIRException {
if (progress) { if (progress) {
System.out.println("Load Package "+pi.name()+"#"+pi.version()); System.out.println("Load Package "+pi.name()+"#"+pi.version());
@ -293,7 +325,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
if (types.length == 0) if (types.length == 0)
types = new String[] { "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}; types = new String[] { "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"};
for (String s : pi.listResources(types)) { for (String s : pi.listResources(types)) {
loadDefinitionItem(s, pi.load("package", s), loader); loadDefinitionItem(s, pi.load("package", s), loader, null);
} }
for (String s : pi.list("other")) { for (String s : pi.list("other")) {
binaries.put(s, TextFile.streamToBytes(pi.load("other", s))); binaries.put(s, TextFile.streamToBytes(pi.load("other", s)));
@ -304,14 +336,14 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
} }
public void loadFromFile(String file, IContextResourceLoader loader) throws IOException, FHIRException { public void loadFromFile(String file, IContextResourceLoader loader) throws IOException, FHIRException {
loadDefinitionItem(file, new CSFileInputStream(file), loader); loadDefinitionItem(file, new CSFileInputStream(file), loader, null);
} }
private void loadFromStream(InputStream stream, IContextResourceLoader loader) throws IOException, FHIRException { private void loadFromStream(InputStream stream, IContextResourceLoader loader) throws IOException, FHIRException {
ZipInputStream zip = new ZipInputStream(stream); ZipInputStream zip = new ZipInputStream(stream);
ZipEntry ze; ZipEntry ze;
while ((ze = zip.getNextEntry()) != null) { while ((ze = zip.getNextEntry()) != null) {
loadDefinitionItem(ze.getName(), zip, loader); loadDefinitionItem(ze.getName(), zip, loader, null);
zip.closeEntry(); zip.closeEntry();
} }
zip.close(); zip.close();

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -13,7 +13,7 @@
each other. It is fine to bump the point version of this POM without affecting each other. It is fine to bump the point version of this POM without affecting
HAPI FHIR. HAPI FHIR.
--> -->
<version>4.1.37-SNAPSHOT</version> <version>4.1.36-SNAPSHOT</version>
<properties> <properties>
<hapi_fhir_version>4.1.0</hapi_fhir_version> <hapi_fhir_version>4.1.0</hapi_fhir_version>