Class FragmentationUtils
java.lang.Object
org.openehealth.ipf.platform.camel.ihe.mllp.core.FragmentationUtils
Helper methods for segment fragmentation, unsolicited request fragmentation,
and interactive response continuation in HL7v2-based transactions.
- Author:
- Dmytro Rud
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendSegments
(StringBuilder sb, List<String> segments, int startIndex, int endIndex) Appends segments from startIndex to endIndex-1 to the given StringBuilder.static void
appendSplitSegment
(StringBuilder sb, List<String> fields, char fieldSeparator) Appends a split segment to the given StringBuilder.static String
ensureMaximalSegmentsLength
(String message, int maxLength) Ensures that all segments in the given HL7 message string representation are not longer than the given value (-1 means positive infinity).static CharSequence
joinSegments
(List<String> segments, int startIndex, int endIndex) Joins segments from startIndex to endIndex-1.static String
Creates a single key string from the given key pieces.splitString
(String s, char c) Splits the given String at occurrences of the given character.static String
uniqueId()
Returns an unique value which can be used, for example, as an HL7v2 message ID.
-
Constructor Details
-
FragmentationUtils
public FragmentationUtils()
-
-
Method Details
-
splitString
Splits the given String at occurrences of the given character. -
ensureMaximalSegmentsLength
Ensures that all segments in the given HL7 message string representation are not longer than the given value (-1 means positive infinity). If needed, splits long segments by means of ADD segments, as described in paragraph 2.10.2.1 of the HL7 v.2.5 specification.'\r'
characters are not considered in the length computation.
- Parameters:
message
- string representation of the source HL7 message.maxLength
- maximal segment length, must be either -1 or greater than 4.- Returns:
- string representation of a semantically equivalent message, whose segments are not longer than the given value.
-
appendSplitSegment
Appends a split segment to the given StringBuilder. -
appendSegments
public static void appendSegments(StringBuilder sb, List<String> segments, int startIndex, int endIndex) Appends segments from startIndex to endIndex-1 to the given StringBuilder. -
joinSegments
Joins segments from startIndex to endIndex-1. -
keyString
Creates a single key string from the given key pieces. -
uniqueId
Returns an unique value which can be used, for example, as an HL7v2 message ID.
-