cdac.medinfo.sdk.hl7282.hl7net.auxiliaryprotocol.transactionhandler

## Class TransactionHandler

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.hl7net.auxiliaryprotocol.transactionhandler.TransactionHandler

- All Implemented Interfaces:
    ITransactionHandler

      public class TransactionHandler
      extends java.lang.Object
      implements ITransactionHandler

  TransactionHandler validates the message on client side. It validates message according to its MessageControllerID and Query with QueryID.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransactionHandler()` Instantiates ClientSideTransactionHandler

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the Client Side ClientSideTransactionHandler
    `EnumMessageCode` | `getMessageCodeByQueryIdentifier(java.lang.String strQueryIdentifier)` This method returns the messageCode for message by Queryidentifier.
    `java.lang.String` | `getQueryIdentifierByMessageControllerID(java.lang.String strMessageControllerID)` Retrieves Query Identifier for Message ControllerID
    `java.lang.String` | `getTriggerEventByMessageControllerID(java.lang.String strMessageControllerID)` Retrieves Trigger Event ID for Message ControllerID.
    `java.lang.String` | `getTriggerEventByQueryIdentifier(java.lang.String strQueryIdentifier)` Retrieves Trigger Event for Query Identifier.
    `boolean` | `isDeferred(Message message)` Checks whether Query Priority is Deferred or Immediate.
    `boolean` | `isDeferredByQueryIdentifier(java.lang.String strQueryIdentifier)` Retrieves priority of query for QueryIdentifier.if Query identifier is not present returns false.
    `boolean` | `isMessageControllerIDPresent(java.lang.String strMessageControllerID)` Check for Presence MessageControllerID.
    `boolean` | `isQueryIdentifierPresent(java.lang.String strQueryIdentifier)` Check for Presence QueryIdentifier.
    `void` | `processBatchTransaction(IHL7BatchFile objHL7BatchFile)` Processes the batchfile and verified each batch in it.
    `void` | `processMessageTransaction(Message objMessage)` This method initiates one operation.
    `void` | `processOnExceptionTransaction(java.lang.Exception e, byte[] objBytebuffer)` This method takes byte buffer in retrieves the batch control id from it and checks that any data related to this batch or message is exist then remove it.
    `void` | `removeByMessageControllerID(java.lang.String strMessageControllerID)` Removes MessageData depending upon MessageControllerID.
    `void` | `setBatchAgent(IBatchProcessor objBatchProcessor)` This set the batch agent on transaction handler.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TransactionHandler

          public TransactionHandler()

      Instantiates ClientSideTransactionHandler

  - ### Method Detail

    - #### processMessageTransaction

          public void processMessageTransaction(Message objMessage)
                                         throws InvalidTransactionException

      This method initiates one operation. An operation is completed when, 1]When sending Immediate or Deffered Query. 2]When sending event. 3]When sending ACK for Deferred Query. 4]When Accepting Response for Deffered or Immediate response. This method will keep Record for sending and receiving messsages.
      Specified by:
        `processMessageTransaction` in interface `ITransactionHandler`
      Parameters:
        `objMessage` - Message for which to perform validation.
      Throws:
        `InvalidTransactionException` - Thrown when message validation fails.

    - #### processBatchTransaction

          public void processBatchTransaction(IHL7BatchFile objHL7BatchFile)
                                       throws InvalidTransactionException

      Processes the batchfile and verified each batch in it.
      Specified by:
        `processBatchTransaction` in interface `ITransactionHandler`
      Parameters:
        `objHL7BatchFile` - - BatchFile for which to perform verification.
      Throws:
        `InvalidTransactionException` - Thrown when batch transaction fails.

    - #### processOnExceptionTransaction

          public void processOnExceptionTransaction(java.lang.Exception e,
                                           byte[] objBytebuffer)

      This method takes byte buffer in retrieves the batch control id from it and checks that any data related to this batch or message is exist then remove it.
      Specified by:
        `processOnExceptionTransaction` in interface `ITransactionHandler`
      Parameters:
        `e-` - Exception Occoured.
        `objBytebuffer` - - error byte buffer.

    - #### isMessageControllerIDPresent

          public boolean isMessageControllerIDPresent(java.lang.String strMessageControllerID)

      Check for Presence MessageControllerID.
      Parameters:
        `strMessageControllerID` - - String of Message ControllerID
      Returns:
        boolean - true, if Message Controller ID is present.

    - #### removeByMessageControllerID

          public void removeByMessageControllerID(java.lang.String strMessageControllerID)

      Removes MessageData depending upon MessageControllerID.
      Parameters:
        `strMessageControllerID` -

    - #### isQueryIdentifierPresent

          public boolean isQueryIdentifierPresent(java.lang.String strQueryIdentifier)

      Check for Presence QueryIdentifier.
      Parameters:
        `strQueryIdentifier` - specified Query IDenfitifer
      Returns:
        boolean - true , if Query Identifier is present.

    - #### isDeferredByQueryIdentifier

          public boolean isDeferredByQueryIdentifier(java.lang.String strQueryIdentifier)

      Retrieves priority of query for QueryIdentifier.if Query identifier is not present returns false.
      Parameters:
        `strQueryIdentifier` - specified Query Identifier.
      Returns:
        boolean - false if priority with this query id is not set else return the status.

    - #### getQueryIdentifierByMessageControllerID

          public java.lang.String getQueryIdentifierByMessageControllerID(java.lang.String strMessageControllerID)

      Retrieves Query Identifier for Message ControllerID
      Parameters:
        `strMessageControllerID` - specified Message Controller ID
      Returns:
        String - String of Query Identifier

    - #### getTriggerEventByMessageControllerID

          public java.lang.String getTriggerEventByMessageControllerID(java.lang.String strMessageControllerID)

      Retrieves Trigger Event ID for Message ControllerID.
      Parameters:
        `strMessageControllerID` - specified Message Controller ID
      Returns:
        String - Trigger Event ID for Message ControllerID.

    - #### getTriggerEventByQueryIdentifier

          public final java.lang.String getTriggerEventByQueryIdentifier(java.lang.String strQueryIdentifier)

      Retrieves Trigger Event for Query Identifier.
      Parameters:
        `strQueryIdentifier` - specified Query Identifier
      Returns:
        String - Trigger Event for Query Identifier.

    - #### getMessageCodeByQueryIdentifier

          public EnumMessageCode getMessageCodeByQueryIdentifier(java.lang.String strQueryIdentifier)

      This method returns the messageCode for message by Queryidentifier.
      Parameters:
        `strQueryIdentifier` - received query identifier.
      Returns:
        enumMessageCode MessageCode for query identifier.

    - #### isDeferred

          public boolean isDeferred(Message message)

      Checks whether Query Priority is Deferred or Immediate.
      Parameters:
        `message` - Message, which Query Priority to be checked.
      Returns:
        boolean - true, if Query Priority is Deferred either false.

    - #### close

          public void close()

      Closes the Client Side ClientSideTransactionHandler

    - #### setBatchAgent

          public void setBatchAgent(IBatchProcessor objBatchProcessor)

      This set the batch agent on transaction handler.
      Specified by:
        `setBatchAgent` in interface `ITransactionHandler`
      Parameters:
        `objBatchProcessor` - - object of batch agent.