Class Hl7v2TransactionConfiguration<AuditDatasetType extends MllpAuditDataset>

java.lang.Object
org.openehealth.ipf.commons.ihe.core.TransactionConfiguration<AuditDatasetType>
org.openehealth.ipf.commons.ihe.hl7v2.Hl7v2TransactionConfiguration<AuditDatasetType>
Direct Known Subclasses:
PdqTransactionConfiguration

public class Hl7v2TransactionConfiguration<AuditDatasetType extends MllpAuditDataset> extends TransactionConfiguration<AuditDatasetType>
Endpoint-agnostic parameters of an HL7v2-based transaction.
Author:
Dmytro Rud
  • Constructor Details

    • Hl7v2TransactionConfiguration

      public Hl7v2TransactionConfiguration(String name, String description, boolean isQuery, AuditStrategy<AuditDatasetType> clientAuditStrategy, AuditStrategy<AuditDatasetType> serverAuditStrategy, Version[] hl7Versions, String sendingApplication, String sendingFacility, ErrorCode requestErrorDefaultErrorCode, ErrorCode responseErrorDefaultErrorCode, String[] allowedRequestMessageTypes, String[] allowedRequestTriggerEvents, String[] allowedResponseMessageTypes, String[] allowedResponseTriggerEvents, boolean[] auditabilityFlags, boolean[] responseContinuabilityFlags, HapiContext hapiContext)
      Constructor.
      Parameters:
      hl7Versions - HL7 versions for acceptance checks (MSH-12). The first version of this array is used for default NAKs.
      sendingApplication - sending application for default NAKs (MSH-3).
      sendingFacility - sending application for default NAKs (MSH-4).
      requestErrorDefaultErrorCode - default error code for request-related NAKs.
      responseErrorDefaultErrorCode - default error code for response-related NAKs.
      allowedRequestMessageTypes - array of allowed request message types, e.g. {"ADT", "MDM"}.
      allowedRequestTriggerEvents - array of allowed request trigger events for each request message type, e.g. {"A01 A02 A03", "T06 T07 T08"}.
      allowedResponseMessageTypes - array of allowed response message types, e.g. {"ACK", "RSP"}.
      allowedResponseTriggerEvents - array of allowed response trigger events for each message type, ignored for messages of type "ACK".
      auditabilityFlags - flags of whether the messages of corresponding message type should be audited. If null, the transaction will not perform any auditing.
      responseContinuabilityFlags - flags of whether the messages of corresponding message type should support HL7 response continuations. If null, no continuations will be supported.
      hapiContext - transaction-specific HAPI Context
    • Hl7v2TransactionConfiguration

      public Hl7v2TransactionConfiguration(String name, String description, boolean isQuery, AuditStrategy<AuditDatasetType> clientAuditStrategy, AuditStrategy<AuditDatasetType> serverAuditStrategy, Version hl7Version, String sendingApplication, String sendingFacility, ErrorCode requestErrorDefaultErrorCode, ErrorCode responseErrorDefaultErrorCode, String allowedRequestMessageType, String allowedRequestTriggerEvent, String allowedResponseMessageType, String allowedResponseTriggerEvent, boolean auditabilityFlag, boolean responseContinuabilityFlag, HapiContext hapiContext)
  • Method Details

    • isAuditable

      public boolean isAuditable(String messageType)
      Returns true when request messages of the given type are auditable.
    • isContinuable

      public boolean isContinuable(String messageType)
      Returns true when request messages of the given type can be split by means of interactive continuation.

      When this method returns true, the request message structure must be able to contain segments RCP, QPD, DSC; and the response message structure -- segments DSC, QAK.

    • isDataStartSegment

      public boolean isDataStartSegment(List<String> segments, int index)
      Returns true if the given element of the given list contains a start segment of a data record.
    • isFooterStartSegment

      public boolean isFooterStartSegment(List<String> segments, int index)
      Returns true if the given element of the given list contains a segment which belongs to segments following the data records ("footer").
    • checkRequestAcceptance

      public void checkRequestAcceptance(Message message) throws Hl7v2AcceptanceException
      Performs transaction-specific acceptance test of the given request message.
      Parameters:
      message - Message object.
      Throws:
      Hl7v2AcceptanceException
    • checkResponseAcceptance

      public void checkResponseAcceptance(Message message) throws Hl7v2AcceptanceException
      Performs transaction-specific acceptance test of the given response message.
      Parameters:
      message - Message object.
      Throws:
      Hl7v2AcceptanceException
    • checkMessageAcceptance

      public void checkMessageAcceptance(Message message, boolean isRequest) throws Hl7v2AcceptanceException
      Performs acceptance test of the given message.
      Parameters:
      message - HAPI Message object.
      isRequest - true iff the message is a request.
      Throws:
      Hl7v2AcceptanceException - when the message is not acceptable.
    • checkMessageAcceptance

      public void checkMessageAcceptance(String messageType, String triggerEvent, String messageStructure, String version, boolean isRequest) throws Hl7v2AcceptanceException
      Performs acceptance test of the message with the given attributes.
      Parameters:
      messageType - value from MSH-9-1, can be empty or null.
      triggerEvent - value from MSH-9-2, can be empty or null.
      messageStructure - value from MSH-9-3, can be empty or null.
      version - value from MSH-12, can be empty or null.
      isRequest - true iff the message under consideration is a request.
      Throws:
      Hl7v2AcceptanceException - when the message is not acceptable.
    • getParser

      public Parser getParser()
    • request

      public <M extends Message> M request(String messageType, String trigger)
      Makes a valid request for this transaction. Note that the individual transaction types may overload this method, e.g. using a concrete response type.
      Parameters:
      messageType - message type, e.g. ADT
      trigger - trigger event, e.g. A01
      Returns:
      HAPI message created using the correct HapiContext
      Throws:
      HL7v2Exception - if the message type or trigger event is not valid for this transaction
    • request

      public <M extends Message> M request(String trigger)
      Like request(String, String), but uses the first configured request message type as default.
    • request

      public <M extends Message> M request()
      Like request(String, String), but uses the first configured request message type and the first configured trigger event as defaults.
    • getSendingApplication

      public String getSendingApplication()
    • getSendingFacility

      public String getSendingFacility()
    • getRequestErrorDefaultErrorCode

      public ErrorCode getRequestErrorDefaultErrorCode()
    • getResponseErrorDefaultErrorCode

      public ErrorCode getResponseErrorDefaultErrorCode()
    • getHapiContext

      public HapiContext getHapiContext()
    • getAllowedRequestMessageTypes

      public String[] getAllowedRequestMessageTypes()
    • getAllowedRequestTriggerEvents

      public String[] getAllowedRequestTriggerEvents()
    • getAllowedResponseMessageTypes

      public String[] getAllowedResponseMessageTypes()
    • getAllowedResponseTriggerEvents

      public String[] getAllowedResponseTriggerEvents()
    • getHl7Versions

      public Version[] getHl7Versions()