Class ACKGenerator

java.lang.Object
com.mirth.connect.server.userutil.ACKGenerator

public class ACKGenerator extends Object
Allows users to generate HL7 v2.x acknowledgments based on an inbound message, with a specified ACK code and custom text message. This class will not work as expected if the HL7 v2.x data type plugin is disabled or uninstalled.
  • Constructor Details

    • ACKGenerator

      @Deprecated public ACKGenerator()
      Deprecated.
      Instantiates a new ACKGenerator object.
  • Method Details

    • generateAckResponse

      public static String generateAckResponse(String message, String acknowledgementCode, String textMessage) throws Exception
      Generates an HL7 v2.x acknowledgment. Assumes that the inbound message is proper ER7, and uses the default format "yyyyMMddHHmmss" for the MSH.7 message date/time.
      Parameters:
      message - The inbound HL7 v2.x message to generate the ACK for.
      acknowledgementCode - The MSA.1 ACK code to use (e.g. AA, AR, AE).
      textMessage - The MSA.3 text message to use.
      Returns:
      The generated HL7 v2.x acknowledgment.
      Throws:
      Exception - If the acknowledgement could not be generated.
    • generateAckResponse

      @Deprecated public static String generateAckResponse(String message, String dataType, String acknowledgementCode, String textMessage, String dateFormat, String errorMessage) throws Exception
      Deprecated.
      This method is deprecated and will soon be removed. Please use generateAckResponse(message, isXML, acknowledgementCode, textMessage, dateFormat, errorMessage) instead.
      Generates an HL7 v2.x acknowledgment.
      Parameters:
      message - The inbound HL7 v2.x message to generate the ACK for.
      dataType - If "XML", assumes the inbound message is formatted in XML, and the acknowledgment returned will also be XML.
      acknowledgementCode - The MSA.1 ACK code to use (e.g. AA, AR, AE).
      textMessage - The MSA.3 text message to use.
      dateFormat - The date/time format used to generate a timestamp for the MSH.7 message date/time (e.g. "yyyyMMddHHmmss").
      errorMessage - The ERR.1 error message to use. If left blank, an ERR segment will not be generated.
      Returns:
      The generated HL7 v2.x acknowledgment.
      Throws:
      Exception - If the acknowledgement could not be generated.
    • generateAckResponse

      public static String generateAckResponse(String message, boolean isXML, String acknowledgementCode, String textMessage, String dateFormat, String errorMessage) throws Exception
      Generates an HL7 v2.x acknowledgment.
      Parameters:
      message - The inbound HL7 v2.x message to generate the ACK for.
      isXML - If true, assumes the inbound message is formatted in XML, and the acknowledgment returned will also be XML.
      acknowledgementCode - The MSA.1 ACK code to use (e.g. AA, AR, AE).
      textMessage - The MSA.3 text message to use.
      dateFormat - The date/time format used to generate a timestamp for the MSH.7 message date/time (e.g. "yyyyMMddHHmmss").
      errorMessage - The ERR.1 error message to use. If left blank, an ERR segment will not be generated.
      Returns:
      The generated HL7 v2.x acknowledgment.
      Throws:
      Exception - If the acknowledgement could not be generated.