Search in sources :

Example 21 with IssueType

use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project org.hl7.fhir.core by hapifhir.

the class BaseValidator method warningOrHint.

/**
 * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
 *
 * @param thePass
 *          Set this parameter to <code>false</code> if the validation does not pass
 * @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
 */
protected boolean warningOrHint(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, boolean warning, String msg, Object... theMessageArguments) {
    if (!thePass) {
        String message = context.formatMessage(msg, theMessageArguments);
        IssueSeverity lvl = warning ? IssueSeverity.WARNING : IssueSeverity.INFORMATION;
        if (doingLevel(lvl)) {
            addValidationMessage(errors, type, -1, -1, path, message, lvl, null);
        }
    }
    return thePass;
}
Also used : IssueSeverity(org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity)

Example 22 with IssueType

use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project org.hl7.fhir.core by hapifhir.

the class BaseValidator method txRule.

protected boolean txRule(List<ValidationMessage> errors, String txLink, IssueType type, int line, int col, String path, boolean thePass, String theMessage, Object... theMessageArguments) {
    if (!thePass && doingErrors()) {
        String message = context.formatMessage(theMessage, theMessageArguments);
        ValidationMessage vm = new ValidationMessage(Source.TerminologyEngine, type, line, col, path, message, IssueSeverity.ERROR).setMessageId(theMessage);
        if (checkMsgId(theMessage, vm)) {
            errors.add(vm.setTxLink(txLink));
        }
    }
    return thePass;
}
Also used : ValidationMessage(org.hl7.fhir.utilities.validation.ValidationMessage)

Example 23 with IssueType

use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project org.hl7.fhir.core by hapifhir.

the class BaseValidator method suppressedwarning.

/**
 * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
 *
 * @param thePass
 *          Set this parameter to <code>false</code> if the validation does not pass
 * @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
 */
protected boolean suppressedwarning(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, String msg, String html) {
    if (!thePass && doingWarnings()) {
        IssueSeverity severity = IssueSeverity.INFORMATION;
        addValidationMessage(errors, type, path, msg, html, severity, null);
    }
    return thePass;
}
Also used : IssueSeverity(org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity)

Example 24 with IssueType

use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project nia-patient-switching-standard-adaptor by NHSDigital.

the class OperationOutcomeUtils method createOperationOutcome.

public static OperationOutcome createOperationOutcome(IssueType type, IssueSeverity severity, CodeableConcept details, String diagnostics) {
    var operationOutcome = new OperationOutcome();
    Meta meta = new Meta();
    meta.setProfile(Collections.singletonList(new UriType(URI_TYPE)));
    operationOutcome.setMeta(meta);
    operationOutcome.addIssue().setCode(type).setSeverity(severity).setDetails(details).setDiagnostics(diagnostics);
    return operationOutcome;
}
Also used : Meta(org.hl7.fhir.dstu3.model.Meta) OperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome) UriType(org.hl7.fhir.dstu3.model.UriType)

Example 25 with IssueType

use of org.hl7.fhir.r4.model.OperationOutcome.IssueType in project MobileAccessGateway by i4mi.

the class BasePMIRResponseConverter 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;
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome)

Aggregations

ValidationMessage (org.hl7.fhir.utilities.validation.ValidationMessage)8 OperationOutcome (org.hl7.fhir.r4.model.OperationOutcome)6 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)5 FHIRException (org.hl7.fhir.exceptions.FHIRException)4 OperationOutcomeIssueComponent (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent)4 IssueSeverity (org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity)4 IssueType (org.hl7.fhir.utilities.validation.ValidationMessage.IssueType)4 OperationOutcome (org.hl7.fhir.dstu3.model.OperationOutcome)2 OperationOutcomeIssueComponent (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent)2 BaseServerResponseException (ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Nonnull (javax.annotation.Nonnull)1 BooleanType (org.hl7.fhir.dstu3.model.BooleanType)1 ConceptDefinitionComponent (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 Coding (org.hl7.fhir.dstu3.model.Coding)1 Meta (org.hl7.fhir.dstu3.model.Meta)1 Parameters (org.hl7.fhir.dstu3.model.Parameters)1