mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-10 14:54:46 +00:00
Fix unsupportedCodeSystems updating
This commit is contained in:
parent
aa70fc1338
commit
2540755c40
@ -935,6 +935,10 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||||||
return validateCode(options, code, vs, ctxt);
|
return validateCode(options, code, vs, ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final String getCodeKey(Coding code) {
|
||||||
|
return code.hasVersion() ? code.getSystem()+"|"+code.getVersion() : code.getSystem();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValidationResult validateCode(ValidationOptions options, Coding code, ValueSet vs, ValidationContextCarrier ctxt) {
|
public ValidationResult validateCode(ValidationOptions options, Coding code, ValueSet vs, ValidationContextCarrier ctxt) {
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
@ -944,12 +948,14 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||||||
if (code.hasSystem()) {
|
if (code.hasSystem()) {
|
||||||
codeSystemsUsed.add(code.getSystem());
|
codeSystemsUsed.add(code.getSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
final CacheToken cacheToken = txCache != null ? txCache.generateValidationToken(options, code, vs) : null;
|
final CacheToken cacheToken = txCache != null ? txCache.generateValidationToken(options, code, vs) : null;
|
||||||
ValidationResult res = null;
|
ValidationResult res = null;
|
||||||
if (txCache != null) {
|
if (txCache != null) {
|
||||||
res = txCache.getValidation(cacheToken);
|
res = txCache.getValidation(cacheToken);
|
||||||
}
|
}
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
|
updateUnsupportedCodeSystems(res, code, getCodeKey(code));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
//FIXME
|
//FIXME
|
||||||
@ -969,10 +975,10 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String codeKey = code.hasVersion() ? code.getSystem()+"|"+code.getVersion() : code.getSystem();
|
|
||||||
if (!options.isUseServer()) {
|
if (!options.isUseServer()) {
|
||||||
return new ValidationResult(IssueSeverity.WARNING,formatMessage(I18nConstants.UNABLE_TO_VALIDATE_CODE_WITHOUT_USING_SERVER), TerminologyServiceErrorClass.BLOCKED_BY_OPTIONS);
|
return new ValidationResult(IssueSeverity.WARNING,formatMessage(I18nConstants.UNABLE_TO_VALIDATE_CODE_WITHOUT_USING_SERVER), TerminologyServiceErrorClass.BLOCKED_BY_OPTIONS);
|
||||||
}
|
}
|
||||||
|
String codeKey = getCodeKey(code);
|
||||||
if (unsupportedCodeSystems.contains(codeKey)) {
|
if (unsupportedCodeSystems.contains(codeKey)) {
|
||||||
return new ValidationResult(IssueSeverity.ERROR,formatMessage(I18nConstants.TERMINOLOGY_TX_SYSTEM_NOTKNOWN, code.getSystem()), TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED);
|
return new ValidationResult(IssueSeverity.ERROR,formatMessage(I18nConstants.TERMINOLOGY_TX_SYSTEM_NOTKNOWN, code.getSystem()), TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
@ -998,15 +1004,19 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage()).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR);
|
res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage()).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR);
|
||||||
}
|
}
|
||||||
if (res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED && !code.hasVersion()) {
|
updateUnsupportedCodeSystems(res, code, codeKey);
|
||||||
unsupportedCodeSystems.add(codeKey);
|
|
||||||
}
|
|
||||||
if (txCache != null) { // we never cache unsupported code systems - we always keep trying (but only once per run)
|
if (txCache != null) { // we never cache unsupported code systems - we always keep trying (but only once per run)
|
||||||
txCache.cacheValidation(cacheToken, res, TerminologyCache.PERMANENT);
|
txCache.cacheValidation(cacheToken, res, TerminologyCache.PERMANENT);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateUnsupportedCodeSystems(ValidationResult res, Coding code, String codeKey) {
|
||||||
|
if (res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED && !code.hasVersion()) {
|
||||||
|
unsupportedCodeSystems.add(codeKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setTerminologyOptions(ValidationOptions options, Parameters pIn) {
|
private void setTerminologyOptions(ValidationOptions options, Parameters pIn) {
|
||||||
if (!Utilities.noString(options.getLanguage())) {
|
if (!Utilities.noString(options.getLanguage())) {
|
||||||
pIn.addParameter("displayLanguage", options.getLanguage());
|
pIn.addParameter("displayLanguage", options.getLanguage());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user