java.lang.Object
org.openehealth.ipf.platform.camel.hl7.HL7v2

public final class HL7v2 extends Object
Factory class for commonly used HL7-related expressions, predicates and processors.
  • Method Details

    • get

      public static org.apache.camel.builder.ValueBuilder get(String terserSpec)
      Returns:
      Expression that extracts data from HL7 messages based on a HAPI Terser expression
    • set

      public static Expression set(String terserSpec, Expression value)
      Returns:
      Expression that sets data in a HL7 messages based on a HAPI Terser expression
    • ack

      public static org.apache.camel.builder.ValueBuilder ack()
      Returns:
      Expression that creates an acknowledgement to a message
    • ack

      public static org.apache.camel.builder.ValueBuilder ack(AcknowledgmentCode acknowledgmentCode)
      Returns:
      Expression that creates an acknowledgement to a message using a given code
    • ack

      public static org.apache.camel.builder.ValueBuilder ack(AcknowledgmentCode acknowledgmentCode, String message, ErrorCode errorCode)
      Returns:
      Expression that creates an acknowledgement to a message using a given code, message and error details
    • response

      public static org.apache.camel.builder.ValueBuilder response(String eventType, String triggerEvent)
      Returns a response to the message in the body, using the provided event type and trigger event
      Parameters:
      eventType - event type, e.g. ADT
      triggerEvent - trigger event, e.g. A01
      Returns:
      expression that generates the response for the body message
    • staticResponse

      public static org.apache.camel.builder.ValueBuilder staticResponse(String message)
      Returns a constant response message. Useful for mocks and tests only
      Parameters:
      message - constant message
      Returns:
      expression that generates a static message using the same HapiContext as the message in the body
    • validatingProcessor

      public static Processor validatingProcessor()
      Returns a validating Camel processor for a message. The actual validation rules to be used is defined in the message's HapiContext. Unlike messageConforms(), this processor throws an exception with details about the validation result instead of just returning true or false.
      Returns:
      a validating Camel processor for a message
    • validatingProcessor

      public static Processor validatingProcessor(HapiContext context)
      Returns a validating Camel processor for a message. The actual validation rules to be used is defined in the message's HapiContext. Unlike messageConforms(), this processor throws an exception with details about the validation result instead of just returning true or false.
      Parameters:
      context - HAPI context
      Returns:
      a validating Camel processor for a message
    • messageConforms

      public static Predicate messageConforms()
      Returns:
      Predicate that returns true if the message validates successfully
    • messageConformsTo

      public static Predicate messageConformsTo(HapiContext hapiContext)
      Returns:
      Predicate that returns true if the message validates successfully using a dedicated HapiContext
    • messageConformsTo

      public static Predicate messageConformsTo(Expression expression)
      Returns:
      Predicate that returns true if the message validates successfully using an expression that returns a ValidationContext.
    • bodyMessage

      public static Message bodyMessage(Exchange exchange) throws HL7Exception
      Returns the HAPI Message from the message body. If the body is a string, it is parsed on the fly
      Parameters:
      exchange - exchange
      Returns:
      HAPI message
      Throws:
      HL7Exception