use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project MobileAccessGateway by i4mi.
the class Iti78ResponseConverter method error.
public OperationOutcome error(IssueType type, String diagnostics) {
OperationOutcome result = new OperationOutcome();
OperationOutcomeIssueComponent issue = result.addIssue();
issue.setSeverity(OperationOutcome.IssueSeverity.ERROR);
issue.setCode(type);
issue.setDiagnostics(diagnostics);
return result;
}
use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project summary-care-record-api by NHSDigital.
the class ScrTest method verifyOperationOutcome.
private void verifyOperationOutcome(String responseBody, IssueType code, IssueSeverity severity) {
var response = parser.parseResource(responseBody);
assertThat(response).isInstanceOf(OperationOutcome.class);
OperationOutcome operationOutcome = (OperationOutcome) response;
assertThat(operationOutcome.getIssueFirstRep().getCode()).isEqualTo(code);
assertThat(operationOutcome.getIssueFirstRep().getSeverity()).isEqualTo(severity);
}
use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project org.hl7.fhir.core by hapifhir.
the class ParserBase method logError.
public void logError(int line, int col, String path, IssueType type, String message, IssueSeverity level) throws FHIRFormatError {
if (policy == ValidationPolicy.EVERYTHING) {
ValidationMessage msg = new ValidationMessage(Source.InstanceValidator, type, line, col, path, message, level);
errors.add(msg);
} else if (level == IssueSeverity.FATAL || (level == IssueSeverity.ERROR && policy == ValidationPolicy.QUICK))
throw new FHIRFormatError(message + String.format(" at line %d col %d", line, col));
}
use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project org.hl7.fhir.core by hapifhir.
the class ParserBase method logError.
public void logError(int line, int col, String path, IssueType type, String message, IssueSeverity level) throws FHIRFormatError {
if (policy == ValidationPolicy.EVERYTHING) {
ValidationMessage msg = new ValidationMessage(Source.InstanceValidator, type, line, col, path, message, level);
errors.add(msg);
} else if (level == IssueSeverity.FATAL || (level == IssueSeverity.ERROR && policy == ValidationPolicy.QUICK))
throw new FHIRFormatError(message + String.format(" at line %d col %d", line, col));
}
use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method processValidationResult.
public ValidationResult processValidationResult(Parameters pOut) {
boolean ok = false;
String message = "No Message returned";
String display = null;
String system = null;
String code = null;
TerminologyServiceErrorClass err = TerminologyServiceErrorClass.UNKNOWN;
for (ParametersParameterComponent p : pOut.getParameter()) {
if (p.hasValue()) {
if (p.getName().equals("result")) {
ok = ((BooleanType) p.getValue()).getValue().booleanValue();
} else if (p.getName().equals("message")) {
message = ((StringType) p.getValue()).getValue();
} else if (p.getName().equals("display")) {
display = ((StringType) p.getValue()).getValue();
} else if (p.getName().equals("system")) {
system = ((StringType) p.getValue()).getValue();
} else if (p.getName().equals("code")) {
code = ((StringType) p.getValue()).getValue();
} else if (p.getName().equals("cause")) {
try {
IssueType it = IssueType.fromCode(((StringType) p.getValue()).getValue());
if (it == IssueType.UNKNOWN) {
err = TerminologyServiceErrorClass.UNKNOWN;
} else if (it == IssueType.NOTFOUND) {
err = TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED;
} else if (it == IssueType.NOTSUPPORTED) {
err = TerminologyServiceErrorClass.VALUESET_UNSUPPORTED;
} else {
err = null;
}
} catch (FHIRException e) {
}
}
}
}
if (!ok) {
return new ValidationResult(IssueSeverity.ERROR, message + " (from " + txClient.getAddress() + ")", err).setTxLink(txLog.getLastId());
} else if (message != null && !message.equals("No Message returned")) {
return new ValidationResult(IssueSeverity.WARNING, message + " (from " + txClient.getAddress() + ")", system, new ConceptDefinitionComponent().setDisplay(display).setCode(code)).setTxLink(txLog.getLastId());
} else if (display != null) {
return new ValidationResult(system, new ConceptDefinitionComponent().setDisplay(display).setCode(code)).setTxLink(txLog.getLastId());
} else {
return new ValidationResult(system, new ConceptDefinitionComponent().setCode(code)).setTxLink(txLog.getLastId());
}
}
Aggregations