Class Hl7v2MarshalUtils
java.lang.Object
org.openehealth.ipf.platform.camel.ihe.hl7v2.Hl7v2MarshalUtils
Various helper methods for data transformation.
- Author:
- Dmytro Rud
-
Method Summary
Modifier 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 Message
convertBodyToMessage
(Message message, String defaultCharsetName, Parser parser) Converts the contents of the given Camel message to aMessage
.static String
convertBodyToString
(Message message, String charsetName, boolean defragmentSegments) Converts message contents to aString
using 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 boolean
typeSupported
(Object body) Determines whether the given object belongs to the predefined set of supported data types.
-
Method Details
-
typeSupported
Determines whether the given object belongs to the predefined set of supported data types.- Parameters:
body
- The object to check.- Returns:
true
when the type of the object is supported by the HL7v2 adapter out-of-the-box,false
otherwise.
-
convertBodyToString
public static String convertBodyToString(Message message, String charsetName, boolean defragmentSegments) throws Exception Converts message contents to aString
using 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 messagecharsetName
- charset name- Returns:
- string
- Throws:
Exception
-
convertMessageToByteArray
public 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 messagecharsetName
- charset name- Returns:
- byte array
- Throws:
Exception
-
convertBodyToByteArray
Converts 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 objectcharsetName
- charset name- Returns:
- byte array
- Throws:
Exception
-
convertBodyToMessage
public 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.
-