org.apache.camel.component.hl7
Class HL7DataFormat
java.lang.Object
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:
- marshal = from Message to String (can be used when returning as response using the HL7 MLLP codec)
- unmarshal = from String to Message (can be used when receiving streamed data from the HL7 MLLP codec).
This operation will also enrich the message by adding the MSH fields (MSH-3 to MSH-12) as headers on the message.
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):
- hl7.msh.sendingApplication = MSH-3
- hl7.msh.sendingFacility = MSH-4
- hl7.msh.receivingApplication = MSH-5
- hl7.msh.receivingFacility = MSH-6
- hl7.msh.timestamp = MSH-7
- hl7.msh.security = MSH-8
- hl7.msh.messageType = MSH-9-1
- hl7.msh.triggerEvent = MSH-9-2
- hl7.msh.messageControl = MSH-10
- hl7.msh.processingId = MSH-11
- hl7.msh.versionId = MSH-12
All headers are String types.
The HL7 spec can be downloaded as a pdf at
- See Also:
HL7MLLPCodec
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HL7DataFormat
public HL7DataFormat()
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 exchangebody - the object to be marshalledoutputStream - 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 exchangeinputStream - 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