fix conflicts
This commit is contained in:
commit
73d10799eb
|
@ -7,3 +7,5 @@
|
|||
* Consistent use of string values for primitive type conversions
|
||||
* Fix problem with generated NPM Packages
|
||||
* Fix URls when processing markdown while generating snapshots
|
||||
* Default output to console, with additional output available via -debug option in CLI.
|
||||
* Bump jackson-databind version to fix security vulnerability.
|
||||
|
|
|
@ -53,9 +53,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.exceptions.NoTerminologyServiceException;
|
||||
import org.hl7.fhir.exceptions.TerminologyServiceException;
|
||||
import org.hl7.fhir.r5.conformance.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.context.BaseWorkerContext.ResourceProxy;
|
||||
import org.hl7.fhir.r5.context.CanonicalResourceManager.CanonicalResourceProxy;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.PackageVersion;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ILoggingService.LogCategory;
|
||||
import org.hl7.fhir.r5.context.TerminologyCache.CacheToken;
|
||||
import org.hl7.fhir.r5.model.BooleanType;
|
||||
|
@ -128,7 +126,7 @@ import org.hl7.fhir.utilities.validation.ValidationOptions.ValueSetMode;
|
|||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class BaseWorkerContext extends I18nBase implements IWorkerContext{
|
||||
|
||||
|
@ -234,7 +232,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
private boolean canRunWithoutTerminology;
|
||||
protected boolean noTerminologyServer;
|
||||
private int expandCodesLimit = 1000;
|
||||
protected ILoggingService logger;
|
||||
protected ILoggingService logger = new SystemOutLoggingService();
|
||||
protected Parameters expParameters;
|
||||
private TranslationServices translator = new NullTranslator();
|
||||
|
||||
|
@ -244,7 +242,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
private boolean tlogging = true;
|
||||
private ICanonicalResourceLocator locator;
|
||||
protected String userAgent;
|
||||
|
||||
|
||||
protected BaseWorkerContext() throws FileNotFoundException, IOException, FHIRException {
|
||||
setValidationMessageLanguage(getLocale());
|
||||
clock = new TimeTracker();
|
||||
|
@ -405,7 +403,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
CanonicalResource m = (CanonicalResource) r;
|
||||
String url = m.getUrl();
|
||||
if (!allowLoadingDuplicates && hasResource(r.getClass(), url)) {
|
||||
// spcial workaround for known problems with existing packages
|
||||
// special workaround for known problems with existing packages
|
||||
if (Utilities.existsInList(url, "http://hl7.org/fhir/SearchParameter/example")) {
|
||||
return;
|
||||
}
|
||||
|
@ -603,19 +601,19 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
if (txcaps == null) {
|
||||
try {
|
||||
log("Terminology server: Check for supported code systems for "+system);
|
||||
logger.logMessage("Terminology server: Check for supported code systems for "+system);
|
||||
final TerminologyCapabilities capabilityStatement = txCache.hasTerminologyCapabilities() ? txCache.getTerminologyCapabilities() : txClient.getTerminologyCapabilities();
|
||||
txCache.cacheTerminologyCapabilities(capabilityStatement);
|
||||
setTxCaps(capabilityStatement);
|
||||
} catch (Exception e) {
|
||||
if (canRunWithoutTerminology) {
|
||||
noTerminologyServer = true;
|
||||
log("==============!! Running without terminology server !! ==============");
|
||||
logger.logMessage("==============!! Running without terminology server !! ==============");
|
||||
if (txClient!=null) {
|
||||
log("txServer = "+txClient.getAddress());
|
||||
log("Error = "+e.getMessage()+"");
|
||||
logger.logMessage("txServer = "+txClient.getAddress());
|
||||
logger.logMessage("Error = "+e.getMessage()+"");
|
||||
}
|
||||
log("=====================================================================");
|
||||
logger.logMessage("=====================================================================");
|
||||
return false;
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
|
@ -631,22 +629,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
}
|
||||
|
||||
private void log(String message) {
|
||||
if (logger != null) {
|
||||
logger.logMessage(message);
|
||||
} else {
|
||||
System.out.println(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void tlog(String msg) {
|
||||
|
||||
|
||||
protected void txLog(String msg) {
|
||||
if (tlogging ) {
|
||||
if (logger != null) {
|
||||
logger.logDebugMessage(LogCategory.TX, msg);
|
||||
} else {
|
||||
System.out.println("-tx: "+msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,7 +687,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("_limit", Integer.toString(expandCodesLimit ));
|
||||
params.put("_incomplete", "true");
|
||||
tlog("$expand on "+txCache.summary(vs));
|
||||
txLog("$expand on "+txCache.summary(vs));
|
||||
try {
|
||||
ValueSet result = txClient.expandValueset(vs, p, params);
|
||||
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
|
||||
|
@ -792,7 +781,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("_limit", Integer.toString(expandCodesLimit ));
|
||||
params.put("_incomplete", "true");
|
||||
tlog("$expand on "+txCache.summary(vs));
|
||||
txLog("$expand on "+txCache.summary(vs));
|
||||
try {
|
||||
ValueSet result = txClient.expandValueset(vs, p, params);
|
||||
if (!result.hasUrl()) {
|
||||
|
@ -901,7 +890,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
}
|
||||
if (batch.getEntry().size() > 0) {
|
||||
tlog("$batch validate for "+batch.getEntry().size()+" codes on systems "+systems.toString());
|
||||
txLog("$batch validate for "+batch.getEntry().size()+" codes on systems "+systems.toString());
|
||||
if (txClient == null) {
|
||||
throw new FHIRException(formatMessage(I18nConstants.ATTEMPT_TO_USE_TERMINOLOGY_SERVER_WHEN_NO_TERMINOLOGY_SERVER_IS_AVAILABLE));
|
||||
}
|
||||
|
@ -989,9 +978,9 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
String csumm = txCache != null ? txCache.summary(code) : null;
|
||||
if (txCache != null) {
|
||||
tlog("$validate "+csumm+" for "+ txCache.summary(vs));
|
||||
txLog("$validate "+csumm+" for "+ txCache.summary(vs));
|
||||
} else {
|
||||
tlog("$validate "+csumm+" before cache exists");
|
||||
txLog("$validate "+csumm+" before cache exists");
|
||||
}
|
||||
try {
|
||||
Parameters pIn = constructParameters(options, code);
|
||||
|
@ -1113,7 +1102,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
if (noTerminologyServer) {
|
||||
return new ValidationResult(IssueSeverity.ERROR, "Error validating code: running without terminology services", TerminologyServiceErrorClass.NOSERVICE);
|
||||
}
|
||||
tlog("$validate "+txCache.summary(code)+" for "+ txCache.summary(vs));
|
||||
txLog("$validate "+txCache.summary(code)+" for "+ txCache.summary(vs));
|
||||
try {
|
||||
Parameters pIn = constructParameters(options, code);
|
||||
res = validateOnServer(vs, pIn, options);
|
||||
|
@ -1297,7 +1286,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
this.canRunWithoutTerminology = canRunWithoutTerminology;
|
||||
}
|
||||
|
||||
public void setLogger(ILoggingService logger) {
|
||||
public void setLogger(@Nonnull ILoggingService logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,11 @@
|
|||
package org.hl7.fhir.r5.context;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.CanonicalResourceManager.CanonicalResourceProxy;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.PackageVersion;
|
||||
import org.hl7.fhir.r5.model.CanonicalResource;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.DomainResource;
|
||||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
|
||||
|
@ -28,6 +19,11 @@ import org.hl7.fhir.utilities.VersionUtilities;
|
|||
|
||||
public class CanonicalResourceManager<T extends CanonicalResource> {
|
||||
|
||||
private final String[] INVALID_TERMINOLOGY_URLS = {
|
||||
"http://snomed.info/sct",
|
||||
"http://nucc.org/provider-taxonomy"
|
||||
};
|
||||
|
||||
public static abstract class CanonicalResourceProxy {
|
||||
private String type;
|
||||
private String id;
|
||||
|
@ -219,7 +215,11 @@ public class CanonicalResourceManager<T extends CanonicalResource> {
|
|||
|
||||
public void see(CachedCanonicalResource<T> cr) {
|
||||
// ignore UTG NUCC erroneous code system
|
||||
if (cr.getPackageInfo() != null && cr.getPackageInfo().getId() != null && cr.getPackageInfo().getId().startsWith("hl7.terminology") && "http://nucc.org/provider-taxonomy".equals(cr.getUrl())) {
|
||||
if (cr.getPackageInfo() != null
|
||||
&& cr.getPackageInfo().getId() != null
|
||||
&& cr.getPackageInfo().getId().startsWith("hl7.terminology")
|
||||
&& Arrays.stream(INVALID_TERMINOLOGY_URLS).anyMatch((it)->it.equals(cr.getUrl()))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,8 @@ import org.hl7.fhir.utilities.validation.ValidationOptions;
|
|||
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* This is the standard interface used for access to underlying FHIR
|
||||
|
@ -802,7 +804,7 @@ public interface IWorkerContext {
|
|||
public void logDebugMessage(LogCategory category, String message); // verbose; only when debugging
|
||||
}
|
||||
|
||||
public void setLogger(ILoggingService logger);
|
||||
public void setLogger(@Nonnull ILoggingService logger);
|
||||
public ILoggingService getLogger();
|
||||
|
||||
public boolean isNoTerminologyServer();
|
||||
|
|
|
@ -201,6 +201,9 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
@With
|
||||
private final boolean allowLoadingDuplicates;
|
||||
|
||||
@With
|
||||
private final IWorkerContext.ILoggingService loggingService;
|
||||
|
||||
public SimpleWorkerContextBuilder() {
|
||||
cacheTerminologyClientErrors = false;
|
||||
alwaysUseTerminologyServer = false;
|
||||
|
@ -209,6 +212,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
locale = null;
|
||||
userAgent = null;
|
||||
allowLoadingDuplicates = false;
|
||||
loggingService = new SystemOutLoggingService();
|
||||
}
|
||||
|
||||
private SimpleWorkerContext getSimpleWorkerContextInstance() throws IOException {
|
||||
|
@ -227,6 +231,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
private SimpleWorkerContext build(SimpleWorkerContext context) throws IOException {
|
||||
context.initTS(terminologyCachePath);
|
||||
context.setUserAgent(userAgent);
|
||||
context.setLogger(loggingService);
|
||||
return context;
|
||||
}
|
||||
|
||||
|
@ -314,7 +319,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
|
||||
public String connectToTSServer(TerminologyClient client, String log) {
|
||||
try {
|
||||
tlog("Connect to "+client.getAddress());
|
||||
txLog("Connect to "+client.getAddress());
|
||||
txClient = client;
|
||||
if (log != null && log.endsWith(".txt")) {
|
||||
txLog = new TextClientLogger(log);
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package org.hl7.fhir.r5.context;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class SystemOutLoggingService implements IWorkerContext.ILoggingService {
|
||||
|
||||
private final boolean debug;
|
||||
|
||||
public SystemOutLoggingService() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logMessage(String message) {
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logDebugMessage(LogCategory category, String message) {
|
||||
if (debug) {
|
||||
System.out.println(" -" + category.name().toLowerCase() + ": " + message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.r5.context;
|
||||
package org.hl7.fhir.r5.test.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
|
@ -114,6 +114,11 @@ public class TestingUtilities extends BaseTestingUtilities {
|
|||
IWorkerContext fcontext = getWorkerContext(pcm.loadPackage(VersionUtilities.packageForVersion(version), version));
|
||||
fcontext.setUcumService(new UcumEssenceService(TestingUtilities.loadTestResourceStream("ucum", "ucum-essence.xml")));
|
||||
fcontext.setExpansionProfile(new Parameters());
|
||||
if (!fcontext.hasPackage("hl7.terminology", null)) {
|
||||
NpmPackage utg = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION).loadPackage("hl7.terminology");
|
||||
System.out.println("Loading THO: "+utg.name()+"#"+utg.version());
|
||||
fcontext.loadFromPackage(utg, new TestPackageLoader(new String[]{"CodeSystem", "ValueSet"}));
|
||||
}
|
||||
return fcontext;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -132,24 +132,24 @@ public class NarrativeGenerationTests {
|
|||
}
|
||||
|
||||
XhtmlNode x = RendererFactory.factory(source, rc).build(source);
|
||||
String target = TextFile.streamToString(TestingUtilities.loadTestResourceStream("r5", "narrative", test.getId() + ".html"));
|
||||
String output = HEADER+new XhtmlComposer(true, true).compose(x)+FOOTER;
|
||||
String tfn = TestingUtilities.tempFile("narrative", test.getId() + ".target.html");
|
||||
String ofn = TestingUtilities.tempFile("narrative", test.getId() + ".output.html");
|
||||
TextFile.stringToFile(target, tfn);
|
||||
TextFile.stringToFile(output, ofn);
|
||||
String msg = TestingUtilities.checkXMLIsSame(ofn, tfn);
|
||||
String expected = TextFile.streamToString(TestingUtilities.loadTestResourceStream("r5", "narrative", test.getId() + ".html"));
|
||||
String actual = HEADER+new XhtmlComposer(true, true).compose(x)+FOOTER;
|
||||
String expectedFileName = TestingUtilities.tempFile("narrative", test.getId() + ".expected.html");
|
||||
String actualFileName = TestingUtilities.tempFile("narrative", test.getId() + ".actual.html");
|
||||
TextFile.stringToFile(expected, expectedFileName);
|
||||
TextFile.stringToFile(actual, actualFileName);
|
||||
String msg = TestingUtilities.checkXMLIsSame(actualFileName, expectedFileName);
|
||||
Assertions.assertTrue(msg == null, "Output does not match expected: "+msg);
|
||||
|
||||
if (test.isMeta()) {
|
||||
org.hl7.fhir.r5.elementmodel.Element e = Manager.parseSingle(context, TestingUtilities.loadTestResourceStream("r5", "narrative", test.getId() + ".xml"), FhirFormat.XML);
|
||||
x = RendererFactory.factory(source, rc).render(new ElementWrappers.ResourceWrapperMetaElement(rc, e));
|
||||
|
||||
target = TextFile.streamToString(TestingUtilities.loadTestResourceStream("r5", "narrative", test.getId() + "-meta.html"));
|
||||
output = HEADER+new XhtmlComposer(true, true).compose(x)+FOOTER;
|
||||
ofn = TestingUtilities.tempFile("narrative", test.getId() + "-meta.output.html");
|
||||
TextFile.stringToFile(output, ofn);
|
||||
msg = TestingUtilities.checkXMLIsSame(ofn, tfn);
|
||||
expected = TextFile.streamToString(TestingUtilities.loadTestResourceStream("r5", "narrative", test.getId() + "-meta.html"));
|
||||
actual = HEADER+new XhtmlComposer(true, true).compose(x)+FOOTER;
|
||||
actualFileName = TestingUtilities.tempFile("narrative", test.getId() + "-meta.actual.html");
|
||||
TextFile.stringToFile(actual, actualFileName);
|
||||
msg = TestingUtilities.checkXMLIsSame(actualFileName, expectedFileName);
|
||||
Assertions.assertTrue(msg == null, "Meta output does not match expected: "+msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.hl7.fhir.exceptions.FHIRFormatError;
|
|||
import org.hl7.fhir.exceptions.PathEngineException;
|
||||
import org.hl7.fhir.r5.conformance.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.conformance.ProfileUtilities.ProfileKnowledgeProvider;
|
||||
import org.hl7.fhir.r5.context.TestPackageLoader;
|
||||
import org.hl7.fhir.r5.test.utils.TestPackageLoader;
|
||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
import org.hl7.fhir.r5.formats.XmlParser;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.hl7.fhir.r5.test;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -13,7 +12,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
|||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.TestPackageLoader;
|
||||
import org.hl7.fhir.r5.test.utils.TestPackageLoader;
|
||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
import org.hl7.fhir.r5.formats.XmlParser;
|
||||
|
@ -109,13 +108,8 @@ public class VocabTests {
|
|||
/* Do NOT get a shared worker context from Testing Utilities or else the terminology package loaded below
|
||||
will appear in tests where it causes failures.
|
||||
*/
|
||||
context = TestingUtilities.getWorkerContext(VersionUtilities.getMajMin(TestingUtilities.DEFAULT_CONTEXT_VERSION));
|
||||
if (!context.hasPackage("hl7.terminology", null)) {
|
||||
|
||||
NpmPackage utg = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION).loadPackage("hl7.terminology");
|
||||
System.out.println("Loading THO: "+utg.name()+"#"+utg.version());
|
||||
context.loadFromPackage(utg, new TestPackageLoader(new String[]{"CodeSystem", "ValueSet"}));
|
||||
}
|
||||
context = TestingUtilities.getSharedWorkerContext(VersionUtilities.getMajMin(TestingUtilities.DEFAULT_CONTEXT_VERSION));
|
||||
|
||||
}
|
||||
|
||||
@ParameterizedTest(name = "{index}: file {0}")
|
||||
|
@ -150,13 +144,13 @@ public class VocabTests {
|
|||
if (outcome.isOk()) {
|
||||
outcome.getValueset().getExpansion().setIdentifier(null);
|
||||
outcome.getValueset().getExpansion().setTimestamp(null);
|
||||
String target = new XmlParser().setOutputStyle(OutputStyle.PRETTY).composeString(targetVS);
|
||||
String output = new XmlParser().setOutputStyle(OutputStyle.PRETTY).composeString(outcome.getValueset());
|
||||
String tfn = TestingUtilities.tempFile("vocab", test.getId() + ".target.html");
|
||||
String ofn = TestingUtilities.tempFile("vocab", test.getId() + ".output.html");
|
||||
TextFile.stringToFile(target, tfn);
|
||||
TextFile.stringToFile(output, ofn);
|
||||
String msg = TestingUtilities.checkXMLIsSame(ofn, tfn);
|
||||
String expected = new XmlParser().setOutputStyle(OutputStyle.PRETTY).composeString(targetVS);
|
||||
String actual = new XmlParser().setOutputStyle(OutputStyle.PRETTY).composeString(outcome.getValueset());
|
||||
String expectedFileName = TestingUtilities.tempFile("vocab", test.getId() + ".expected.html");
|
||||
String actualFileName = TestingUtilities.tempFile("vocab", test.getId() + ".actual.html");
|
||||
TextFile.stringToFile(expected, expectedFileName);
|
||||
TextFile.stringToFile(actual, actualFileName);
|
||||
String msg = TestingUtilities.checkXMLIsSame(actualFileName, expectedFileName);
|
||||
Assertions.assertTrue(msg == null, "Output does not match expected: "+msg);
|
||||
} else {
|
||||
Assertions.fail("Expansion Failed: "+outcome.getError());
|
||||
|
|
|
@ -190,7 +190,7 @@
|
|||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.10.5.1</version>
|
||||
<version>2.12.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
|
|
|
@ -12,9 +12,11 @@ import org.hl7.fhir.convertors.txClient.TerminologyClientFactory;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.conformance.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.ICanonicalResourceLocator;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.PackageVersion;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SystemOutLoggingService;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||
|
@ -207,6 +209,10 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
@With
|
||||
private final boolean canRunWithoutTerminologyServer;
|
||||
|
||||
@With
|
||||
private final IWorkerContext.ILoggingService loggingService;
|
||||
|
||||
|
||||
public ValidationEngineBuilder() {
|
||||
terminologyCachePath = null;
|
||||
userAgent = null;
|
||||
|
@ -216,9 +222,10 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
txVersion = null;
|
||||
timeTracker = null;
|
||||
canRunWithoutTerminologyServer = false;
|
||||
loggingService = new SystemOutLoggingService();
|
||||
}
|
||||
|
||||
public ValidationEngineBuilder(String terminologyCachePath, String userAgent, String version, String txServer, String txLog, FhirPublication txVersion, TimeTracker timeTracker, boolean canRunWithoutTerminologyServer) {
|
||||
public ValidationEngineBuilder(String terminologyCachePath, String userAgent, String version, String txServer, String txLog, FhirPublication txVersion, TimeTracker timeTracker, boolean canRunWithoutTerminologyServer, IWorkerContext.ILoggingService loggingService) {
|
||||
this.terminologyCachePath = terminologyCachePath;
|
||||
this.userAgent = userAgent;
|
||||
this.version = version;
|
||||
|
@ -227,15 +234,16 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
this.txVersion = txVersion;
|
||||
this.timeTracker = timeTracker;
|
||||
this.canRunWithoutTerminologyServer = canRunWithoutTerminologyServer;
|
||||
this.loggingService = loggingService;
|
||||
}
|
||||
|
||||
public ValidationEngineBuilder withTxServer(String txServer, String txLog, FhirPublication txVersion) {
|
||||
return new ValidationEngineBuilder(terminologyCachePath, userAgent, version, txServer, txLog, txVersion,timeTracker, canRunWithoutTerminologyServer);
|
||||
return new ValidationEngineBuilder(terminologyCachePath, userAgent, version, txServer, txLog, txVersion,timeTracker, canRunWithoutTerminologyServer, loggingService);
|
||||
}
|
||||
|
||||
public ValidationEngine fromNothing() throws IOException {
|
||||
ValidationEngine engine = new ValidationEngine();
|
||||
SimpleWorkerContext.SimpleWorkerContextBuilder contextBuilder = new SimpleWorkerContext.SimpleWorkerContextBuilder();
|
||||
SimpleWorkerContext.SimpleWorkerContextBuilder contextBuilder = new SimpleWorkerContext.SimpleWorkerContextBuilder().withLoggingService(loggingService);
|
||||
if (terminologyCachePath != null)
|
||||
contextBuilder = contextBuilder.withTerminologyCachePath(terminologyCachePath);
|
||||
engine.setContext(contextBuilder.build());
|
||||
|
@ -246,7 +254,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
|
||||
public ValidationEngine fromSource(String src) throws IOException, URISyntaxException {
|
||||
ValidationEngine engine = new ValidationEngine();
|
||||
engine.loadCoreDefinitions(src, false, terminologyCachePath, userAgent, timeTracker);
|
||||
engine.loadCoreDefinitions(src, false, terminologyCachePath, userAgent, timeTracker, loggingService);
|
||||
engine.getContext().setCanRunWithoutTerminology(canRunWithoutTerminologyServer);
|
||||
|
||||
if (txServer != null) {
|
||||
|
@ -258,11 +266,11 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
}
|
||||
}
|
||||
|
||||
private void loadCoreDefinitions(String src, boolean recursive, String terminologyCachePath, String userAgent, TimeTracker tt) throws FHIRException, IOException {
|
||||
private void loadCoreDefinitions(String src, boolean recursive, String terminologyCachePath, String userAgent, TimeTracker tt, IWorkerContext.ILoggingService loggingService) throws FHIRException, IOException {
|
||||
NpmPackage npm = getPcm().loadPackage(src, null);
|
||||
if (npm != null) {
|
||||
version = npm.fhirVersion();
|
||||
SimpleWorkerContext.SimpleWorkerContextBuilder contextBuilder = new SimpleWorkerContext.SimpleWorkerContextBuilder();
|
||||
SimpleWorkerContext.SimpleWorkerContextBuilder contextBuilder = new SimpleWorkerContext.SimpleWorkerContextBuilder().withLoggingService(loggingService);
|
||||
if (terminologyCachePath != null)
|
||||
contextBuilder = contextBuilder.withTerminologyCachePath(terminologyCachePath);
|
||||
if (userAgent != null) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.hl7.fhir.validation.cli.services;
|
|||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SystemOutLoggingService;
|
||||
import org.hl7.fhir.r5.context.TerminologyCache;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager;
|
||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||
|
@ -329,6 +330,7 @@ public class ValidationService {
|
|||
String txver = validator.setTerminologyServer(cliContext.getTxServer(), cliContext.getTxLog(), ver);
|
||||
System.out.println(" - Version " + txver + " (" + tt.milestone() + ")");
|
||||
validator.setDebug(cliContext.isDoDebug());
|
||||
validator.getContext().setLogger(new SystemOutLoggingService(cliContext.isDoDebug()));
|
||||
for (String src : cliContext.getIgs()) {
|
||||
igLoader.loadIg(validator.getIgs(), validator.getBinaries(), src, cliContext.isRecursive());
|
||||
}
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -19,7 +19,7 @@
|
|||
|
||||
<properties>
|
||||
<hapi_fhir_version>5.4.0</hapi_fhir_version>
|
||||
<validator_test_case_version>1.1.94</validator_test_case_version>
|
||||
<validator_test_case_version>1.1.95</validator_test_case_version>
|
||||
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
||||
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
|
||||
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
|
||||
|
|
Loading…
Reference in New Issue