improve error draft error where possible

This commit is contained in:
Grahame Grieve 2023-08-18 13:46:56 +10:00
parent 87a9a58771
commit c32492a66b
3 changed files with 23 additions and 13 deletions

View File

@ -1008,7 +1008,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
BundleEntryComponent r = resp.getEntry().get(i);
if (r.getResource() instanceof Parameters) {
t.setResult(processValidationResult((Parameters) r.getResource()));
t.setResult(processValidationResult((Parameters) r.getResource(), vs == null ? null : vs.getUrl()));
if (txCache != null) {
txCache.cacheValidation(t.getCacheToken(), t.getResult(), TerminologyCache.PERMANENT);
}
@ -1108,7 +1108,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
BundleEntryComponent r = resp.getEntry().get(i);
if (r.getResource() instanceof Parameters) {
t.setResult(processValidationResult((Parameters) r.getResource()));
t.setResult(processValidationResult((Parameters) r.getResource(), vsUrl));
if (txCache != null) {
txCache.cacheValidation(t.getCacheToken(), t.getResult(), TerminologyCache.PERMANENT);
}
@ -1412,7 +1412,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
} else {
pOut = tcc.getClient().validateVS(pin);
}
return processValidationResult(pOut);
return processValidationResult(pOut, vs == null ? null : vs.getUrl());
}
protected void addServerValidationParameters(ValueSet vs, Parameters pin, ValidationOptions options) {
@ -1485,7 +1485,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
return cache;
}
public ValidationResult processValidationResult(Parameters pOut) {
public ValidationResult processValidationResult(Parameters pOut, String vs) {
boolean ok = false;
String message = "No Message returned";
String display = null;
@ -1513,23 +1513,23 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
err = TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED;
} else if (p.getName().equals("warning-withdrawn")) {
OperationOutcomeIssueComponent iss = new OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION, org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED);
iss.getDetails().setText(formatMessage(I18nConstants.MSG_WITHDRAWN, ((PrimitiveType<?>) p.getValue()).asStringValue()));
iss.getDetails().setText(formatMessage(vs == null ? I18nConstants.MSG_WITHDRAWN : I18nConstants.MSG_WITHDRAWN_SRC, ((PrimitiveType<?>) p.getValue()).asStringValue(), vs));
issues.add(iss);
} else if (p.getName().equals("warning-deprecated")) {
OperationOutcomeIssueComponent iss = new OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION, org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED);
iss.getDetails().setText(formatMessage(I18nConstants.MSG_DEPRECATED, ((PrimitiveType<?>) p.getValue()).asStringValue()));
iss.getDetails().setText(formatMessage(vs == null ? I18nConstants.MSG_DEPRECATED : I18nConstants.MSG_DEPRECATED_SRC, ((PrimitiveType<?>) p.getValue()).asStringValue(), vs));
issues.add(iss);
} else if (p.getName().equals("warning-retired")) {
OperationOutcomeIssueComponent iss = new OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION, org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED);
iss.getDetails().setText(formatMessage(I18nConstants.MSG_RETIRED, ((PrimitiveType<?>) p.getValue()).asStringValue()));
iss.getDetails().setText(formatMessage(vs == null ? I18nConstants.MSG_RETIRED : I18nConstants.MSG_RETIRED_SRC, ((PrimitiveType<?>) p.getValue()).asStringValue(), vs));
issues.add(iss);
} else if (p.getName().equals("warning-experimental")) {
OperationOutcomeIssueComponent iss = new OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION, org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE);
iss.getDetails().setText(formatMessage(I18nConstants.MSG_EXPERIMENTAL, ((PrimitiveType<?>) p.getValue()).asStringValue()));
iss.getDetails().setText(formatMessage(vs == null ? I18nConstants.MSG_EXPERIMENTAL : I18nConstants.MSG_EXPERIMENTAL_SRC, ((PrimitiveType<?>) p.getValue()).asStringValue(), vs));
issues.add(iss);
} else if (p.getName().equals("warning-draft")) {
OperationOutcomeIssueComponent iss = new OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION, org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE);
iss.getDetails().setText(formatMessage(I18nConstants.MSG_DRAFT, ((PrimitiveType<?>) p.getValue()).asStringValue()));
iss.getDetails().setText(formatMessage(vs == null ? I18nConstants.MSG_DRAFT : I18nConstants.MSG_DRAFT_SRC, ((PrimitiveType<?>) p.getValue()).asStringValue(), vs));
issues.add(iss);
} else if (p.getName().equals("cause")) {
try {

View File

@ -954,10 +954,15 @@ public class I18nConstants {
public static final String MSG_DEPRECATED = "MSG_DEPRECATED";
public static final String MSG_WITHDRAWN = "MSG_WITHDRAWN";
public static final String MSG_RETIRED = "MSG_RETIRED";
public static final String INACTIVE_CODE_WARNING = "INACTIVE_CODE_WARNING";
public static final String SD_EXTENSION_URL_MISSING = "SD_EXTENSION_URL_MISSING";
public static final String MSG_EXPERIMENTAL = "MSG_EXPERIMENTAL";
public static final String MSG_DRAFT = "MSG_DRAFT";
public static final String MSG_DEPRECATED_SRC = "MSG_DEPRECATED_SRC";
public static final String MSG_WITHDRAWN_SRC = "MSG_WITHDRAWN_SRC";
public static final String MSG_RETIRED_SRC = "MSG_RETIRED_SRC";
public static final String MSG_DRAFT_SRC = "MSG_DRAFT_SRC";
public static final String MSG_EXPERIMENTAL_SRC = "MSG_EXPERIMENTAL_SRC";
public static final String INACTIVE_CODE_WARNING = "INACTIVE_CODE_WARNING";
public static final String SD_EXTENSION_URL_MISSING = "SD_EXTENSION_URL_MISSING";
public static final String MSG_DEPENDS_ON_DEPRECATED = "MSG_DEPENDS_ON_DEPRECATED";
public static final String MSG_DEPENDS_ON_WITHDRAWN = "MSG_DEPENDS_ON_WITHDRAWN";
public static final String MSG_DEPENDS_ON_RETIRED = "MSG_DEPENDS_ON_RETIRED";

View File

@ -1009,11 +1009,16 @@ FHIRPATH_OFTYPE_IMPOSSIBLE = The type specified in ofType is {1} which is not a
ED_SEARCH_EXPRESSION_ERROR = Error in search expression ''{0}'': {1}
SD_EXTENSION_URL_MISMATCH = The fixed value for the extension URL is {1} which doesn''t match the canonical URL {0}
SD_EXTENSION_URL_MISSING = The value of Extension.url is not fixed to the extension URL {0}
MSG_DEPRECATED = Reference to deprecated item {0}
MSG_DEPRECATED = Reference to deprecated item {0}
MSG_WITHDRAWN = Reference to withdrawn item {0}
MSG_RETIRED = Reference to retired item {0}
MSG_RETIRED = Reference to retired item {0}
MSG_EXPERIMENTAL = Reference to experimental item {0}
MSG_DRAFT = Reference to draft item {0}
MSG_DEPRECATED_SRC = Reference to deprecated item {0} from {1}
MSG_WITHDRAWN_SRC = Reference to withdrawn item {0} from {1}
MSG_RETIRED_SRC = Reference to retired item {0} from {1}
MSG_EXPERIMENTAL_SRC = Reference to experimental item {0} from {1}
MSG_DRAFT_SRC = Reference to draft item {0} from {1}
INACTIVE_CODE_WARNING = The code ''{0}'' is valid but is not active
SD_ED_TYPE_PROFILE_WRONG_TYPE_one = The type {0} is not in the list of allowed type {1} in the profile {2}
SD_ED_TYPE_PROFILE_WRONG_TYPE_other = The type {0} is not in the list of allowed types {1} in the profile {2}