org.apache.camel.component.hl7
Class HL7DataFormat

java.lang.Object
  extended by org.apache.camel.component.hl7.HL7DataFormat
All Implemented Interfaces:
DataFormat

public class HL7DataFormat
extends Object
implements DataFormat

HL7 DataFormat (supports v2.x of the HL7 protocol).

This data format supports two operations:

Uses the HAPI (HL7 API) for HL7 parsing.

Uses the default PipeParser from the HAPI API. This DataFormat only supports the EDI based HL7 messages and not the XML based (their are not commonly used).

The unmarshal operation adds these MSH fields as headers on the Camel message (key, MSH-field):

All headers are String types.

The HL7 spec can be downloaded as a pdf at

See Also:
HL7MLLPCodec

Constructor Summary
HL7DataFormat()
           
 
Method Summary
 boolean isValidate()
           
 void marshal(Exchange exchange, Object body, OutputStream outputStream)
          Marshals the object to the given Stream.
 void setValidate(boolean validate)
           
 Object unmarshal(Exchange exchange, InputStream inputStream)
          Unmarshals the given stream into an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HL7DataFormat

public HL7DataFormat()
Method Detail

marshal

public void marshal(Exchange exchange,
                    Object body,
                    OutputStream outputStream)
             throws Exception
Description copied from interface: DataFormat
Marshals the object to the given Stream.

Specified by:
marshal in interface DataFormat
Parameters:
exchange - the current exchange
body - the object to be marshalled
outputStream - the output stream to write the marshalled result to
Throws:
Exception - can be thrown

unmarshal

public Object unmarshal(Exchange exchange,
                        InputStream inputStream)
                 throws Exception
Description copied from interface: DataFormat
Unmarshals the given stream into an object.

Notice: The result is set as body on the exchange OUT message. It is possible to mutate the OUT message provided in the given exchange parameter. For instance adding headers to the OUT message will be preserved.

Specified by:
unmarshal in interface DataFormat
Parameters:
exchange - the current exchange
inputStream - the input stream with the object to be unmarshalled
Returns:
the unmarshalled object
Throws:
Exception - can be thrown

isValidate

public boolean isValidate()

setValidate

public void setValidate(boolean validate)


Apache CAMEL