cdac.medinfo.sdk.hl7282.baselibs.messages

## Class MessageFactory

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.baselibs.messages.MessageFactory

-     public final class MessageFactory
      extends java.lang.Object

  MessageFactory class provides support for creation and population of messages. It creates and populates supported message according to the available list of Source and Recipient.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMessageRecepient(IMessageRecepient objIMessageRecepient)` Adds given Collection of Message Recipients to Message Factory.
    `void` | `addMessageRecepients(ISingleCollection<IMessageRecepient> objIMessageRecepientCollection)` Adds given Message Recipient to Message Factory.
    `void` | `addMessageSource(IMessageSource objIMessageSource)` Adds given Message Source to Message Factory.
    `void` | `addMessageSources(ISingleCollection<IMessageSource> objIMessageSourceCollection)` Adds given Collection of Message Sources to Message Factory.
    `static MessageFactory` | `createInstance()`
    `Message` | `createSendSupportedMessage(java.lang.String strMessageCode, java.lang.String strTriggerEvent)` Creates instance of message for which sending is supported through available sources and recipients.
    `LocalExtensionAgent` | `getLocalExtensionAgent()` Retrieves Local Extension Agent.
    `ISingleCollection<IMessageRecepient>` | `getMessageRecepients()` Retrieves Message Recipients from Message Factory.
    `ISingleCollection<IMessageSource>` | `getMessageSources()` Retrieves SingleCollection of Message Sources from Message Factory.
    `IMessageRecepient` | `getReceiveSupportedRecepient(EnumMessageCode enumMessageCode, EnumTriggerEvent enumTriggerEvent)` Verifies whether given message code and trigger event is supported by recipients for receiving.
    `IMessageSource` | `getReceiveSupportedSource(EnumMessageCode enumMessageCode, EnumTriggerEvent enumTriggerEvent)` Verifies whether given message code and trigger event is supported by sources for receiving.
    `IMessageRecepient` | `getSendSupportedRecepient(EnumMessageCode enumMessageCode, EnumTriggerEvent enumTriggerEvent)` Verifies whether given message code and trigger event is supported by recipients for sending.
    `IMessageSource` | `getSendSupportedSource(EnumMessageCode enumMessageCode, EnumTriggerEvent enumTriggerEvent)` Verifies whether given message code and trigger event is supported by sources for sending.
    `boolean` | `isMessageSendSupported(Message messageToSend)` Checks whether the message is supported for sending using available sources.
    `IMessageRecepient` | `isReceiveSupportedByRecepient(EnumMessageCode enumMessageCode, EnumTriggerEvent enumTriggerEvent)` Verifies whether given message code and trigger event is supported by recipients for receiving.
    `IMessageSource` | `isReceiveSupportedBySource(EnumMessageCode enumMessageCode, EnumTriggerEvent enumTriggerEvent)` Verifies whether given message code and trigger event is supported by sources for receiving.
    `IMessageRecepient` | `isSendSupportedByRecepient(EnumMessageCode enumMessageCode, EnumTriggerEvent enumTriggerEvent)` Verifies whether given message code and trigger event is supported by recipients for sending.
    `IMessageSource` | `isSendSupportedBySource(EnumMessageCode enumMessageCode, EnumTriggerEvent enumTriggerEvent)` Verifies whether given message code and trigger event is supported by sources for sending.
    `Message` | `populateReceiveSupportedMessage(java.lang.String strMessageCode, java.lang.String strTriggerEvent, ISegmentSet objISegmentSet)` Populates instance of message using provided SegmentSet.
    `void` | `setLocalExtensionAgent(LocalExtensionAgent objAgent)` Sets LocalExtensionAgent.

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

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

- - ### Method Detail

    - #### createInstance

          public static MessageFactory createInstance()

    - #### setLocalExtensionAgent

          public void setLocalExtensionAgent(LocalExtensionAgent objAgent)

      Sets LocalExtensionAgent. Local Extension Agent provides support for extended messages
      Parameters:
        `objAgent` - instance of Local Extension Agent

    - #### getLocalExtensionAgent

          public LocalExtensionAgent getLocalExtensionAgent()

      Retrieves Local Extension Agent.
      Returns:
        LocalExtensionAgent - instance of Local Extension Agent

    - #### addMessageSource

          public void addMessageSource(IMessageSource objIMessageSource)

      Adds given Message Source to Message Factory.
      Parameters:
        `objIMessageSource` - Given Message Source

    - #### addMessageSources

          public void addMessageSources(ISingleCollection<IMessageSource> objIMessageSourceCollection)

      Adds given Collection of Message Sources to Message Factory.
      Parameters:
        `objIMessageSourceCollection` - Given Collection of Message Sources

    - #### getMessageSources

          public ISingleCollection<IMessageSource> getMessageSources()

      Retrieves SingleCollection of Message Sources from Message Factory.
      Returns:
        ISingleCollection- Given Collection of Message Sources

    - #### addMessageRecepient

          public void addMessageRecepient(IMessageRecepient objIMessageRecepient)

      Adds given Collection of Message Recipients to Message Factory.
      Parameters:
        `objIMessageRecepient` - Given Message Recipient

    - #### addMessageRecepients

          public void addMessageRecepients(ISingleCollection<IMessageRecepient> objIMessageRecepientCollection)

      Adds given Message Recipient to Message Factory.
      Parameters:
        `objIMessageRecepientCollection` - Given Collection of Message Recipients

    - #### getMessageRecepients

          public ISingleCollection<IMessageRecepient> getMessageRecepients()

      Retrieves Message Recipients from Message Factory.
      Returns:
        ISingleCollection- Given Collection of Message Recipients

    - #### createSendSupportedMessage

          public Message createSendSupportedMessage(java.lang.String strMessageCode,
                                           java.lang.String strTriggerEvent)
                                             throws MessageNotSupportedException

      Creates instance of message for which sending is supported through available sources and recipients.
      Parameters:
        `strMessageCode` - value of Message Code
        `strTriggerEvent` - value of Trigger Event
      Returns:
        Message - instance of Message
      Throws:
        `MessageNotSupportedException` - If message is not supported through available Sources and Recipients

    - #### populateReceiveSupportedMessage

          public Message populateReceiveSupportedMessage(java.lang.String strMessageCode,
                                                java.lang.String strTriggerEvent,
                                                ISegmentSet objISegmentSet)
                                                  throws MessageNotSupportedException

      Populates instance of message using provided SegmentSet. Population checks for support capability of available sources and recipients.
      Parameters:
        `strMessageCode` - value of Message Code
        `strTriggerEvent` - value of Trigger Event
        `objISegmentSet` - instance of SegmentSet
      Returns:
        Message - instance of Message
      Throws:
        `MessageNotSupportedException`

    - #### isSendSupportedBySource

          public IMessageSource isSendSupportedBySource(EnumMessageCode enumMessageCode,
                                               EnumTriggerEvent enumTriggerEvent)

      Verifies whether given message code and trigger event is supported by sources for sending. It retrieves the Message Source if message is supported else returns null.
      Parameters:
        `enumMessageCode` - value of message code
        `enumTriggerEvent` - value of trigger event
      Returns:
        IMessageSource instance of Message Source

    - #### getSendSupportedSource

          public IMessageSource getSendSupportedSource(EnumMessageCode enumMessageCode,
                                              EnumTriggerEvent enumTriggerEvent)

      Verifies whether given message code and trigger event is supported by sources for sending. It retrieves the Message Source if message is supported else returns null.
      Parameters:
        `enumMessageCode` - value of message code
        `enumTriggerEvent` - value of trigger event
      Returns:
        IMessageSource instance of Message Source

    - #### isSendSupportedByRecepient

          public IMessageRecepient isSendSupportedByRecepient(EnumMessageCode enumMessageCode,
                                                     EnumTriggerEvent enumTriggerEvent)

      Verifies whether given message code and trigger event is supported by recipients for sending. It retrieves the Message Recipient if message is supported else returns null.
      Parameters:
        `enumMessageCode` - value of message code
        `enumTriggerEvent` - value of trigger event
      Returns:
        IMessageRecepient instance of Message Recipient

    - #### getSendSupportedRecepient

          public IMessageRecepient getSendSupportedRecepient(EnumMessageCode enumMessageCode,
                                                    EnumTriggerEvent enumTriggerEvent)

      Verifies whether given message code and trigger event is supported by recipients for sending. It retrieves the Message Recipient if message is supported else returns null.
      Parameters:
        `enumMessageCode` - value of message code
        `enumTriggerEvent` - value of trigger event
      Returns:
        IMessageRecepient instance of Message Recipient

    - #### isReceiveSupportedBySource

          public IMessageSource isReceiveSupportedBySource(EnumMessageCode enumMessageCode,
                                                  EnumTriggerEvent enumTriggerEvent)

      Verifies whether given message code and trigger event is supported by sources for receiving. It retrieves the Message Source if message is supported else returns null.
      Parameters:
        `enumMessageCode` - value of message code
        `enumTriggerEvent` - value of trigger event
      Returns:
        IMessageSource instance of Message Source

    - #### getReceiveSupportedSource

          public IMessageSource getReceiveSupportedSource(EnumMessageCode enumMessageCode,
                                                 EnumTriggerEvent enumTriggerEvent)

      Verifies whether given message code and trigger event is supported by sources for receiving. It retrieves the Message Source if message is supported else returns null.
      Parameters:
        `enumMessageCode` - value of message code
        `enumTriggerEvent` - value of trigger event
      Returns:
        IMessageSource instance of Message Source

    - #### isReceiveSupportedByRecepient

          public IMessageRecepient isReceiveSupportedByRecepient(EnumMessageCode enumMessageCode,
                                                        EnumTriggerEvent enumTriggerEvent)

      Verifies whether given message code and trigger event is supported by recipients for receiving. It retrieves the Message Recipient if message is supported else returns null.
      Parameters:
        `enumMessageCode` - value of message code
        `enumTriggerEvent` - value of trigger event
      Returns:
        IMessageRecepient instance of Message Recipient

    - #### getReceiveSupportedRecepient

          public IMessageRecepient getReceiveSupportedRecepient(EnumMessageCode enumMessageCode,
                                                       EnumTriggerEvent enumTriggerEvent)

      Verifies whether given message code and trigger event is supported by recipients for receiving. It retrieves the Message Recipient if message is supported else returns null.
      Parameters:
        `enumMessageCode` - value of message code
        `enumTriggerEvent` - value of trigger event
      Returns:
        IMessageRecepient instance of Message Recipient

    - #### isMessageSendSupported

          public boolean isMessageSendSupported(Message messageToSend)

      Checks whether the message is supported for sending using available sources. For ack it checks for available recipients also.
      Parameters:
        `messageToSend` - instance of message
      Returns:
        true - if supported false - otherwise