Search in sources :

Example 1 with MessageValidator

use of ca.uhn.hl7v2.validation.MessageValidator in project camel by apache.

the class ValidationContextPredicate method matches.

@Override
public boolean matches(Exchange exchange) {
    try {
        Message message = exchange.getIn().getBody(Message.class);
        ValidationContext context = validatorExpression != null ? validatorExpression.evaluate(exchange, ValidationContext.class) : dynamicValidationContext(message, exchange.getIn().getHeader(HL7Constants.HL7_CONTEXT, HapiContext.class));
        MessageValidator validator = new MessageValidator(context, false);
        return validator.validate(message);
    } catch (HL7Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
Also used : Message(ca.uhn.hl7v2.model.Message) HL7Exception(ca.uhn.hl7v2.HL7Exception) MessageValidator(ca.uhn.hl7v2.validation.MessageValidator) ValidationContext(ca.uhn.hl7v2.validation.ValidationContext)

Aggregations

HL7Exception (ca.uhn.hl7v2.HL7Exception)1 Message (ca.uhn.hl7v2.model.Message)1 MessageValidator (ca.uhn.hl7v2.validation.MessageValidator)1 ValidationContext (ca.uhn.hl7v2.validation.ValidationContext)1