package cdac.medinfo.sdk.hl7282.hl7net.commons;

import cdac.medinfo.sdk.hl7282.baselibs.messages.Message;




/***
 * The implementor of this interface should provide all methods in it 
 * This interface should be implemented by classes for verification of message,batch 
 * and batch file while receiving and sending. 
 */
public interface ITransactionHandler 
{
	/**
	 * Initiates one operation. An operation is completed when,
	 * 1]When sending Immediate or Deferred Query.
	 * 2]When sending event.
	 * 3]When sending ACK for Deferred Query.
	 * 4]When Accepting Response for Deferred or Immediate response.
	 * This method will keep Record for sending and receiving messages.
	 * @param objMessage Message for which verification to be done.
	 * @throws InvalidTransactionException Thrown when performs invalid transaction.
	 */
	void processMessageTransaction(Message objMessage) ;
	
	/**
	 * Processes the batch or batch file and verified each batch inside it.  
	 * @param objHL7BatchFile - Batch for which to initiate Operation.
	 * @throws InvalidTransactionException Thrown when performs invalid transaction.
	 */
	void processBatchTransaction(IHL7BatchFile objHL7BatchFile);
	
	/**
	 * Retrieves the controlId for Batch or Message and removes the data
     * for The data for which exception is fetched.
	 * @param ex Exception raised
	 * @param buffer data containing error
	 */
	void processOnExceptionTransaction(Exception ex,byte[] buffer);
	
	/**
	 * Sets the batch agent on ITransactionhandler for 
	 * the processing of batch and batch-file.
	 * @param objHL7Batch Object of received batch.
	 */
	void setBatchAgent(IBatchProcessor objBatchProcessor);
}
