View Javadoc

1   package ca.uhn.hl7v2.protocol;
2   
3   import java.util.Map;
4   
5   import ca.uhn.hl7v2.HL7Exception;
6   
7   /**
8    * The Interface ReceivingApplicationExceptionHandler. Allow applications to handle
9    * parsing and handling errors.
10   *
11   * @author Gabriel Landais
12   */
13  public interface ReceivingApplicationExceptionHandler {
14  
15  	/**
16  	 * Process an exception.
17  	 * 
18  	 * @param incomingMessage
19  	 *            the incoming message. This is the raw message which was
20  	 *            received from the external system
21  	 * @param incomingMetadata
22  	 *            Any metadata that accompanies the incoming message. See {@link ca.uhn.hl7v2.protocol.Transportable#getMetadata()}
23  	 * @param outgoingMessage
24  	 *            the outgoing message. The response NAK message generated by
25  	 *            HAPI.
26  	 * @param e
27  	 *            the exception which was received
28  	 * @return The new outgoing message. This can be set to the value provided
29  	 *         by HAPI in <code>outgoingMessage</code>, or may be replaced with
30  	 *         another message. <b>This method may not return <code>null</code></b>.
31  	 */
32  	// ********************************
33  	// Note, if you update the JavaDoc here, also update it in the hapi-example
34  	// file SendAndReceiveAMessage.java as it's duplicated there!
35  	// ********************************
36  	public String processException(String incomingMessage, Map<String, Object> incomingMetadata, String outgoingMessage, Exception e) throws HL7Exception;
37  
38  }