Class Hl7v2MarshalUtils
java.lang.Object
org.openehealth.ipf.platform.camel.ihe.hl7v2.Hl7v2MarshalUtils
Various helper methods for data transformation.
- Author:
- Dmytro Rud
- 
Method SummaryModifier and TypeMethodDescriptionstatic byte[]convertBodyToByteArray(Object body, String charsetName) Converts HL7 object to a Byte Array using the given character set (statically or in MSH-18).static MessageconvertBodyToMessage(Message message, String defaultCharsetName, Parser parser) Converts the contents of the given Camel message to aMessage.static StringconvertBodyToString(Message message, String charsetName, boolean defragmentSegments) Converts message contents to aStringusing the given character set (statically or in MSH-18) and replaces all '\n''s with '\r''s.static byte[]convertMessageToByteArray(Message message, String charsetName) Converts Camel message to a Byte Array using the given character set (statically or in MSH-18).static booleantypeSupported(Object body) Determines whether the given object belongs to the predefined set of supported data types.
- 
Method Details- 
typeSupportedDetermines whether the given object belongs to the predefined set of supported data types.- Parameters:
- body- The object to check.
- Returns:
- truewhen the type of the object is supported by the HL7v2 adapter out-of-the-box,- falseotherwise.
 
- 
convertBodyToStringpublic static String convertBodyToString(Message message, String charsetName, boolean defragmentSegments) throws Exception Converts message contents to aStringusing the given character set (statically or in MSH-18) and replaces all '\n''s with '\r''s.If requested, segments will be defragmented as well. - Parameters:
- message- Camel message
- charsetName- charset name
- Returns:
- string
- Throws:
- Exception
 
- 
convertMessageToByteArraypublic static byte[] convertMessageToByteArray(Message message, String charsetName) throws Exception Converts Camel message to a Byte Array using the given character set (statically or in MSH-18). This is necessary before a HL7 message object or string is remotely transferred to have full control over the encoding.- Parameters:
- message- Camel message
- charsetName- charset name
- Returns:
- byte array
- Throws:
- Exception
 
- 
convertBodyToByteArrayConverts HL7 object to a Byte Array using the given character set (statically or in MSH-18). This is necessary before a HL7 message object or string is remotely transferred to have full control over the encoding.- Parameters:
- body- HL7 object
- charsetName- charset name
- Returns:
- byte array
- Throws:
- Exception
 
- 
convertBodyToMessagepublic static Message convertBodyToMessage(Message message, String defaultCharsetName, Parser parser) throws Exception Converts the contents of the given Camel message to aMessage. This is necessary when either a transferred HL7 message is unmarshalled or we need to access message details for further processing in interceptors.
 
-