Class Hl7Util
java.lang.Object
org.apache.camel.component.mllp.internal.Hl7Util
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final SimpleDateFormat
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendBytesAsPrintFriendlyString
(StringBuilder builder, byte[] phiBytes) void
appendBytesAsPrintFriendlyString
(StringBuilder builder, byte[] phiBytes, int startPosition, int endPosition) Append a PHI byte[] to a StringBuilder, replacing specific non-printable characters with readable strings.bytesToPrintFriendlyStringBuilder
(byte[] phiBytes) Convert a PHI byte[] to a StringBuilder, replacing specific non-printable characters with readable strings.bytesToPrintFriendlyStringBuilder
(byte[] phiBytes, int startPosition, int endPosition) Convert a PHI byte[] to a StringBuilder, replacing specific non-printable characters with readable strings.convertToPrintFriendlyString
(byte[] phiBytes) convertToPrintFriendlyString
(byte[] phiBytes, int startPosition, int endPosition) Convert a PHI byte[] to a String, replacing specific non-printable characters with readable strings.convertToPrintFriendlyString
(String phiString) findFieldSeparatorIndicesInSegment
(byte[] hl7MessageBytes, int startingIndex) Find the field separator indices in the Segment.Find the String value of MSH-18 (Character set).void
generateAcknowledgementPayload
(MllpSocketBuffer mllpSocketBuffer, byte[] hl7MessageBytes, String acknowledgementCode) void
generateAcknowledgementPayload
(MllpSocketBuffer mllpSocketBuffer, byte[] hl7MessageBytes, String acknowledgementCode, String msa3) generateInvalidPayloadExceptionMessage
(byte[] hl7Bytes) static String
generateInvalidPayloadExceptionMessage
(byte[] hl7Bytes, int length) Verifies that the HL7 payload arraystatic String
int
-
Field Details
-
NULL_REPLACEMENT_VALUE
- See Also:
-
EMPTY_REPLACEMENT_VALUE
- See Also:
-
CHARACTER_REPLACEMENTS
-
TIMESTAMP_FORMAT
-
-
Constructor Details
-
Hl7Util
public Hl7Util(int logPhiMaxBytes, boolean logPhi)
-
-
Method Details
-
getLogPhiMaxBytes
public int getLogPhiMaxBytes() -
generateInvalidPayloadExceptionMessage
-
generateInvalidPayloadExceptionMessage
Verifies that the HL7 payload arrayThe MLLP protocol does not allow embedded START_OF_BLOCK or END_OF_BLOCK characters. The END_OF_DATA character is allowed (and expected) because it is also the segment delimiter for an HL7 message
- Parameters:
hl7Bytes
- the HL7 payload to validate- Returns:
- If the payload is invalid, an error message suitable for inclusion in an exception is returned. If the payload is valid, null is returned;
-
findFieldSeparatorIndicesInSegment
public static List<Integer> findFieldSeparatorIndicesInSegment(byte[] hl7MessageBytes, int startingIndex) Find the field separator indices in the Segment. NOTE: The last element of the list will be the index of the end of the segment.- Parameters:
hl7MessageBytes
- the HL7 binary messagestartingIndex
- index of the beginning of the HL7 Segment- Returns:
- List of the field separator indices, which may be empty.
-
findMsh18
Find the String value of MSH-18 (Character set).- Parameters:
hl7Message
- the HL7 binary data to search- Returns:
- the String value of MSH-18, or an empty String if not found.
-
generateAcknowledgementPayload
public void generateAcknowledgementPayload(MllpSocketBuffer mllpSocketBuffer, byte[] hl7MessageBytes, String acknowledgementCode) throws MllpAcknowledgementGenerationException -
generateAcknowledgementPayload
public void generateAcknowledgementPayload(MllpSocketBuffer mllpSocketBuffer, byte[] hl7MessageBytes, String acknowledgementCode, String msa3) throws MllpAcknowledgementGenerationException -
convertToPrintFriendlyString
-
convertToPrintFriendlyString
-
convertToPrintFriendlyString
Convert a PHI byte[] to a String, replacing specific non-printable characters with readable strings. NOTE: this conversion uses the default character set, so not all characters my convert correctly.- Parameters:
phiBytes
- the PHI byte[] to logstartPosition
- the starting position/index of the dataendPosition
- the ending position/index of the data - will not be included in String- Returns:
- a String representation of the byte[]
-
bytesToPrintFriendlyStringBuilder
Convert a PHI byte[] to a StringBuilder, replacing specific non-printable characters with readable strings. NOTE: this conversion uses the default character set, so not all characters my convert correctly.- Parameters:
phiBytes
- the PHI byte[] to log- Returns:
-
bytesToPrintFriendlyStringBuilder
public StringBuilder bytesToPrintFriendlyStringBuilder(byte[] phiBytes, int startPosition, int endPosition) Convert a PHI byte[] to a StringBuilder, replacing specific non-printable characters with readable strings. NOTE: this conversion uses the default character set, so not all characters my convert correctly.- Parameters:
phiBytes
- the PHI byte[] to logstartPosition
- the starting position/index of the dataendPosition
- the ending position/index of the data - will not be included in StringBuilder- Returns:
- a String representation of the byte[]
-
appendBytesAsPrintFriendlyString
-
appendBytesAsPrintFriendlyString
public void appendBytesAsPrintFriendlyString(StringBuilder builder, byte[] phiBytes, int startPosition, int endPosition) Append a PHI byte[] to a StringBuilder, replacing specific non-printable characters with readable strings. NOTE: this conversion uses the default character set, so not all characters my convert correctly.- Parameters:
phiBytes
- the PHI byte[] to logstartPosition
- the starting position/index of the dataendPosition
- the ending position/index of the data - will not be included in String
-
getCharacterAsPrintFriendlyString
-