cdac.medinfo.sdk.hl7282.baselibs.segments

## Class BHS

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.baselibs.segments.Segment
  - - cdac.medinfo.sdk.hl7282.baselibs.segments.BHS

- All Implemented Interfaces:
    ISegment

      public class BHS
      extends Segment

  BHS - batch header segment

  The BHS segment defines the intent, source, destination, and some specifics of the syntax of a Batch.

  Represents an HL7 BHS Batch header segment. This segment has the following fields:

  BHS-1: Field Separator (ST)Required
  BHS-2: Encoding Characters (ST)Required
  BHS-3: Sending Application (HD)Optional
  BHS-4: Sending Facility (HD)Optional
  BHS-5: Receiving Application (HD)Optional
  BHS-6: Receiving Facility (HD)Optional
  BHS-7: Date/Time Of Batch (DTM)Optional
  BHS-8: Batch Security (ST)Optional
  BHS-9: Batch Type (ST)Optional
  BHS-10: Batch Comment (ST)Optional
  BHS-11: Batch Control ID (ST)Optional
  BHS-12: Reference Batch Control ID (ST)Optional
  BHS-13: Batch Sending Network Address (HD)Optional
  BHS-14: Batch Receiving Network Address (HD)Optional

  This class provides mechanism to validate message against HL7 v 2.8.2 standard. The class provides accessors & mutators for the elements mentioned above. The class has validate method which validates Message against HL7 v 2.8.2 standard.

  User can also create Segment through `SegmentFactory`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BHS()` Constructs the BHS segment.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ST` | `getBatchComment()` Retrieves the Batch Comment.
    `ST` | `getBatchControlID()` Retrieves the Batch Control ID.
    `DTM` | `getBatchCreationDateTime()` Retrieves the Date Time Of Batch.
    `ST` | `getBatchEncodingChar()` Retrieves the Encoding Char.
    `ST` | `getBatchFieldSeparator()` Retrieves the Field Separator.
    `ST` | `getBatchName_ID_Type()` Retrieves the Batch Type.
    `HD` | `getBatchReceivingApplication()` Retrieves the Receiving Application.
    `HD` | `getBatchReceivingFacility()` Retrieves the Receiving Facility.
    `HD` | `getBatchReceivingNetworkAddressn()` Retrieves the Batch Receiving Network Address.
    `ST` | `getBatchSecurity()` Retrieves the Security.
    `HD` | `getBatchSendingApplication()` Retrieves the Sending Application.
    `HD` | `getBatchSendingFacility()` Retrieves the Sending Facility.
    `HD` | `getBatchSendingNetworkAddressn()` Retrieves the Batch Sending Network Address.
    `IDelimiter` | `getDelimiter()` Retrieves the Delimiter.
    `ST` | `getReferenceBatchControlID()` Retrieves the Reference Batch Control ID.
    `int` | `parse(java.lang.String strSegmentStream, IDelimiter objIDelimiter)` Parses HL7 Segment Strings from any Stream into HL7 Segment object.
    `int` | `serialize(IHL7Stream objIHL7Stream, IDelimiter objIDelimiter)` Serializes HL7 Message objects.
    `void` | `setBatchComment(ST objBatchComment)` Set the Batch Comment.
    `void` | `setBatchComment(java.lang.String strBatchComment)` Set the Batch Comment.
    `void` | `setBatchControlID(ST objBatchControlID)` Set the Batch Control ID.
    `void` | `setBatchControlID(java.lang.String strbatchControlID)` Set the Batch Control ID.
    `void` | `setBatchCreationDateTime(DTM objDateTimeOfBatch)` Set the Date Time Of Batch.
    `void` | `setBatchCreationDateTime(java.lang.String strTime)` Set the Date Time Of Batch.
    `void` | `setBatchEncodingChars(char cComponentSeparator, char cSubComponentSeparator, char cRepetitionSeparator, char cEscapeCharacter)` Set the Encoding Char.
    `void` | `setBatchEncodingChars(ST objencodingChar)` Set the Encoding Char.
    `void` | `setBatchFieldSeparator(char cfieldSeparator)` Set the Field Separator.
    `void` | `setBatchFieldSeparator(ST objfieldSeparator)` Set the Field Separator.
    `void` | `setBatchName_ID_Type(ST objBatchType)` Set the Batch Type.
    `void` | `setBatchName_ID_Type(java.lang.String strBatchType)` Set the Batch Type.
    `void` | `setBatchReceivingApplication(HD objReceivingApplication)` Set the Receiving Application.
    `void` | `setBatchReceivingApplication(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Receiving Application.
    `void` | `setBatchReceivingFacility(HD objReceivingFacility)` Set the Receiving Facility.
    `void` | `setBatchReceivingFacility(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Receiving Facility.
    `void` | `setBatchReceivingNetworkAddress(HD objBatchReceivingNetworkAddress)` Set the Batch Receiving Network Address.
    `void` | `setBatchReceivingNetworkAddress(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Batch Receiving Network Address.
    `void` | `setBatchSecurity(ST objSecurity)` Set the Security.
    `void` | `setBatchSecurity(java.lang.String strSecurity)` Set the Security.
    `void` | `setBatchSendingApplication(HD objSendingApplication)` Set the Sending Application.
    `void` | `setBatchSendingApplication(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Sending Application.
    `void` | `setBatchSendingFacility(HD objSendingFacility)` Set the Sending Facility.
    `void` | `setBatchSendingFacility(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Sending Facility.
    `void` | `setBatchSendingNetworkAddress(HD objBatchSendingNetworkAddress)` Set the Batch Sending Network Address.
    `void` | `setBatchSendingNetworkAddress(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Batch Sending Network Address.
    `void` | `setReferenceBatchControlID(ST objReferenceBatchControlID)` Set the Reference Batch Control ID.
    `void` | `setReferenceBatchControlID(java.lang.String strReferenceBatchControlID)` Set the Reference Batch Control ID.
    `boolean` | `validate()` Validates HL7 Message objects .

    - ### Methods inherited from class cdac.medinfo.sdk.hl7282.baselibs.segments.Segment

      `addUnRecognizedField, dumpSegment, getFields, getName, getUnrecognizedFields, moveToNextSegment, removeDataElement, removeDataElement, setName, setUnRecognizedField, updateDataElement, updateDataElement, writeToXML`

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

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

- - ### Constructor Detail

    - #### BHS

          public BHS()

      Constructs the BHS segment.

  - ### Method Detail

    - #### getDelimiter

          public IDelimiter getDelimiter()

      Retrieves the Delimiter.
      Returns:
        IDelimiter - delimiter.

    - #### getBatchCreationDateTime

          public DTM getBatchCreationDateTime()

      Retrieves the Date Time Of Batch. This field contains the date/time that the sending system created the Batch.
      Returns:
        DTM - dateTimeOfBatch

    - #### getBatchEncodingChar

          public ST getBatchEncodingChar()

      Retrieves the Encoding Char. This field contains the four characters in the following order: the component separator, repetition separator, escape character, and subcomponent separator.
      Returns:
        ST - encodingChar

    - #### getBatchFieldSeparator

          public ST getBatchFieldSeparator()

      Retrieves the Field Separator. This field contains the separator between the segment ID and the first real field.
      Returns:
        ST - fieldSeparator

    - #### getBatchControlID

          public ST getBatchControlID()

      Retrieves the Batch Control ID. This field contains a number or other identifier that uniquely identifies the Batch.
      Returns:
        ST - BatchControlID

    - #### getReferenceBatchControlID

          public ST getReferenceBatchControlID()

      Retrieves the Reference Batch Control ID. This field contains a number or other identifier that uniquely identifies the Batch.
      Returns:
        ST - referenceBatchControlID

    - #### getBatchReceivingApplication

          public HD getBatchReceivingApplication()

      Retrieves the Receiving Application. This field uniquely identify the receiving application among all other applications within the network enterprise
      Returns:
        HD - receivingApplication

    - #### getBatchReceivingFacility

          public HD getBatchReceivingFacility()

      Retrieves the Receiving Facility. This field identify the receiving application among multiple identical instances of the application running on behalf of different organizations.
      Returns:
        HD - receivingFacility

    - #### getBatchSecurity

          public ST getBatchSecurity()

      Retrieves the Security.
      Returns:
        ST - security

    - #### getBatchSendingApplication

          public HD getBatchSendingApplication()

      Retrieves the Sending Application. This field uniquely identifies the sending application among all other applications within the network enterprise.
      Returns:
        HD - sendingApplication

    - #### getBatchSendingFacility

          public HD getBatchSendingFacility()

      Retrieves the Sending Facility. This field used as the HL7 identifier for the user-defined table of values for the first component.
      Returns:
        HD - sendingFacility

    - #### getBatchName_ID_Type

          public ST getBatchName_ID_Type()

      Retrieves the Batch Type. This field contains the Batch type, trigger event, and the Batch structure ID for the Batch.
      Returns:
        ST - batchType

    - #### getBatchComment

          public ST getBatchComment()

      Retrieves the Batch Comment. This field contains the Batch type
      Returns:
        ST - batchComment

    - #### getBatchSendingNetworkAddressn

          public HD getBatchSendingNetworkAddressn()

      Retrieves the Batch Sending Network Address. This identifies the network location the message was transmitted from.
      Returns:
        HD - batchSendingNetworkAddress

    - #### getBatchReceivingNetworkAddressn

          public HD getBatchReceivingNetworkAddressn()

      Retrieves the Batch Receiving Network Address. This identifies the network location the message was transmitted to. Identified by an OID or text string. (e.g., URL).
      Returns:
        HD - batchReceivingNetworkAddress

    - #### setBatchFieldSeparator

          public void setBatchFieldSeparator(char cfieldSeparator)

      Set the Field Separator. This field contains the separator between the segment ID and the first real field.
      Parameters:
        `cfieldSeparator` - Use as cfieldSeparator.

    - #### setBatchFieldSeparator

          public void setBatchFieldSeparator(ST objfieldSeparator)

      Set the Field Separator. This field contains the separator between the segment ID and the first real field.
      Parameters:
        `objfieldSeparator` - object of fieldSeparator.

    - #### setBatchEncodingChars

          public void setBatchEncodingChars(char cComponentSeparator,
                                   char cSubComponentSeparator,
                                   char cRepetitionSeparator,
                                   char cEscapeCharacter)

      Set the Encoding Char. This field contains the four characters in the following order: the component separator, repetition separator, escape character, and subcomponent separator.
      Parameters:
        `cComponentSeparator` - Delimiter Use as ComponentSeparator
        `cSubComponentSeparator` - Delimiter Use as SubComponentSeparator
        `cRepetitionSeparator` - Delimiter Use as RepetitionSeparator
        `cEscapeCharacter` - Delimiter Use as EscapeCharacter

    - #### setBatchEncodingChars

          public void setBatchEncodingChars(ST objencodingChar)

      Set the Encoding Char. This field contains the four characters in the following order: the component separator, repetition separator, escape character, and subcomponent separator.
      Parameters:
        `objencodingChar` - object of Encoding Char.

    - #### setBatchCreationDateTime

          public void setBatchCreationDateTime(java.lang.String strTime)

      Set the Date Time Of Batch. This field contains the date/time that the sending system created the Batch.
      Parameters:
        `strTime` - Specifies a point in time using a 24-hour clock notation.

    - #### setBatchCreationDateTime

          public void setBatchCreationDateTime(DTM objDateTimeOfBatch)

      Set the Date Time Of Batch. This field contains the date/time that the sending system created the Batch.
      Parameters:
        `objDateTimeOfBatch` - Object of Date Time Of Batch.

    - #### setBatchControlID

          public void setBatchControlID(java.lang.String strbatchControlID)

      Set the Batch Control ID. This field contains a number or other identifier that uniquely identifies the Batch.
      Parameters:
        `strbatchControlID` - Specifies a number or other identifier that uniquely identifies the Batch.

    - #### setBatchControlID

          public void setBatchControlID(ST objBatchControlID)

      Set the Batch Control ID. This field contains a number or other identifier that uniquely identifies the Batch.
      Parameters:
        `objBatchControlID` - Object of Batch Control ID.

    - #### setReferenceBatchControlID

          public void setReferenceBatchControlID(java.lang.String strReferenceBatchControlID)

      Set the Reference Batch Control ID. This field contains a number or other identifier that uniquely identifies the Batch.
      Parameters:
        `strReferenceBatchControlID` - Specifies a number or other identifier that uniquely identifies the Batch.

    - #### setReferenceBatchControlID

          public void setReferenceBatchControlID(ST objReferenceBatchControlID)

      Set the Reference Batch Control ID. This field contains a number or other identifier that uniquely identifies the Batch.
      Parameters:
        `objReferenceBatchControlID` - Object of Reference Batch Control ID.

    - #### setBatchName_ID_Type

          public void setBatchName_ID_Type(java.lang.String strBatchType)

      Set the Batch Type. This field contains the Batch type for the Batch.
      Parameters:
        `strBatchType` - Specifies the Batch type code.

    - #### setBatchName_ID_Type

          public void setBatchName_ID_Type(ST objBatchType)

      Set the Batch Type. This field contains the Batch type for the Batch.
      Parameters:
        `objBatchType` - Object of Batch Type.

    - #### setBatchComment

          public void setBatchComment(java.lang.String strBatchComment)

      Set the Batch Comment. This field contains the Batch Comment for the Batch.
      Parameters:
        `strBatchComment` - Specifies the Batch Comment.

    - #### setBatchComment

          public void setBatchComment(ST objBatchComment)

      Set the Batch Comment. This field contains the Batch Comment for the Batch.
      Parameters:
        `objBatchComment` - Object of Batch Comment.

    - #### setBatchReceivingApplication

          public void setBatchReceivingApplication(java.lang.String strNamespaceId,
                                          java.lang.String strUniversalId,
                                          java.lang.String strUniversalIdType)

      Set the Receiving Application. This field uniquely identify the receiving application among all other applications within the network enterprise
      Parameters:
        `strNamespaceId` - Specifies Specifies the HL7 identifier for the user-defined table of values for this component.[Refer Table No.300]
        `strUniversalId` - Specifies a string formatted according to the scheme defined by the component, (UID type).
        `strUniversalIdType` - Governs the interpretation of the strUniversalId.

    - #### setBatchReceivingApplication

          public void setBatchReceivingApplication(HD objReceivingApplication)

      Set the Receiving Application. This field uniquely identify the receiving application among all other applications within the network enterprise.
      Parameters:
        `objReceivingApplication` - Object of Receiving Application.

    - #### setBatchReceivingFacility

          public void setBatchReceivingFacility(java.lang.String strNamespaceId,
                                       java.lang.String strUniversalId,
                                       java.lang.String strUniversalIdType)

      Set the Receiving Facility. This field identify the receiving application among multiple identical instances of the application running on behalf of different organizations.
      Parameters:
        `strNamespaceId` - Specifies Specifies the HL7 identifier for the user-defined table of values for this component.[Refer Table No.300]
        `strUniversalId` - Specifies a string formatted according to the scheme defined by the component, (UID type).
        `strUniversalIdType` - Governs the interpretation of the strUniversalId.

    - #### setBatchReceivingFacility

          public void setBatchReceivingFacility(HD objReceivingFacility)

      Set the Receiving Facility. This field identify the receiving application among multiple identical instances of
      Parameters:
        `objReceivingFacility` - Object of Receiving Facility.

    - #### setBatchSecurity

          public void setBatchSecurity(java.lang.String strSecurity)

      Set the Security.
      Parameters:
        `strSecurity` - Specifies a field ,that is used to implement security features.

    - #### setBatchSecurity

          public void setBatchSecurity(ST objSecurity)

      Set the Security.
      Parameters:
        `objSecurity` - Object of Security.

    - #### setBatchSendingApplication

          public void setBatchSendingApplication(java.lang.String strNamespaceId,
                                        java.lang.String strUniversalId,
                                        java.lang.String strUniversalIdType)

      Set the Sending Application. This field uniquely identifies the sending application among all other applications within the network enterprise.
      Parameters:
        `strNamespaceId` - Specifies Specifies the HL7 identifier for the user-defined table of values for this component.[Refer Table No.300]
        `strUniversalId` - Specifies a string formatted according to the scheme defined by the component, (UID type).
        `strUniversalIdType` - Governs the interpretation of the strUniversalId.

    - #### setBatchSendingApplication

          public void setBatchSendingApplication(HD objSendingApplication)

      Set the Sending Application. This field uniquely identifies the sending application among all other applications within the network enterprise.
      Parameters:
        `objSendingApplication` - object of Sending Application

    - #### setBatchSendingFacility

          public void setBatchSendingFacility(java.lang.String strNamespaceId,
                                     java.lang.String strUniversalId,
                                     java.lang.String strUniversalIdType)

      Set the Sending Facility. This field used as the HL7 identifier for the user-defined table of values for the first component.
      Parameters:
        `strNamespaceId` - Specifies Specifies the HL7 identifier for the user-defined table of values for this component.[Refer Table No.300]
        `strUniversalId` - Specifies a string formatted according to the scheme defined by the component, (UID type).
        `strUniversalIdType` - Governs the interpretation of the strUniversalId.

    - #### setBatchSendingFacility

          public void setBatchSendingFacility(HD objSendingFacility)

      Set the Sending Facility. This field used as the HL7 identifier for the user-defined table of values for the first component.
      Parameters:
        `objSendingFacility` - object of Sending Facility.

    - #### setBatchSendingNetworkAddress

          public void setBatchSendingNetworkAddress(java.lang.String strNamespaceId,
                                           java.lang.String strUniversalId,
                                           java.lang.String strUniversalIdType)

      Set the Batch Sending Network Address. This field uniquely identifies the sending application among all other applications within the network enterprise.
      Parameters:
        `strNamespaceId` - Specifies Specifies the HL7 identifier for the user-defined table of values for this component.[Refer Table No.300]
        `strUniversalId` - Specifies a string formatted according to the scheme defined by the component, (UID type).
        `strUniversalIdType` - Governs the interpretation of the strUniversalId.

    - #### setBatchSendingNetworkAddress

          public void setBatchSendingNetworkAddress(HD objBatchSendingNetworkAddress)

      Set the Batch Sending Network Address. This field uniquely identifies the sending application among all other applications within the network enterprise.
      Parameters:
        `objBatchSendingNetworkAddress` - object of Sending Application

    - #### setBatchReceivingNetworkAddress

          public void setBatchReceivingNetworkAddress(java.lang.String strNamespaceId,
                                             java.lang.String strUniversalId,
                                             java.lang.String strUniversalIdType)

      Set the Batch Receiving Network Address. This field identifies the network location the message was transmitted to. Identified by an OID or text string. (e.g., URL).
      Parameters:
        `strNamespaceId` - Specifies Specifies the HL7 identifier for the user-defined table of values for this component.[Refer Table No.300]
        `strUniversalId` - Specifies a string formatted according to the scheme defined by the component, (UID type).
        `strUniversalIdType` - Governs the interpretation of the strUniversalId.

    - #### setBatchReceivingNetworkAddress

          public void setBatchReceivingNetworkAddress(HD objBatchReceivingNetworkAddress)

      Set the Batch Receiving Network Address. This field identifies the network location the message was transmitted to. Identified by an OID or text string. (e.g., URL).
      Parameters:
        `objBatchReceivingNetworkAddress` - object of Sending Application

    - #### validate

          public boolean validate()
                           throws InvalidSegmentException

      Validates HL7 Message objects . Validate method checks for validation each and every segments in side the Message object against specified message Structure. Validation chcecks include optionality of segment or group. It also verifies the number of times segment or group is repeated in message. e.g {PSH} while parsing PSH segment validate method will check for its mandatory presence. [PSH] in this case validate will throw exception if one tries to enter more than one PSH segment.
      Specified by:
        `validate` in interface `ISegment`
      Overrides:
        `validate` in class `Segment`
      Returns:
        boolean - true or false.
      Throws:
        `InvalidSegmentException` - Thrown when Any of required filed is missing.

    - #### serialize

          public int serialize(IHL7Stream objIHL7Stream,
                      IDelimiter objIDelimiter)
                        throws SerializeException,
                               java.io.IOException

      Serializes HL7 Message objects. Before serializaton it validates Message as per HL7 v2.5 standard. For successfull serialization , Message Object should follow order of segments as per its corresponding Message Structure. Serialize method fails if given stream is null. It mandates presence of required segments and the number of occurences specified by the standard. This method also checks for presence of Mandatory Groups.It also verifies repeatability of Group.
      Specified by:
        `serialize` in interface `ISegment`
      Overrides:
        `serialize` in class `Segment`
      Parameters:
        `objIHL7Stream` - Object of IHL7Stream.
        `objIDelimiter` - Object of class Delimiter.
      Returns:
        int - [failure or success].
      Throws:
        `SerializeException` - Thrown when serialization of Message fails.
        `java.io.IOException` - Signals that an I/O exception of some sort has occurred.

    - #### parse

          public int parse(java.lang.String strSegmentStream,
                  IDelimiter objIDelimiter)
                    throws InvalidSegmentException,
                           java.io.IOException

      Parses HL7 Segment Strings from any Stream into HL7 Segment object. This method checks for the Repetition of the fields in the Segment. It also checks for the optionality of the fields as whether they are mandatory or optional. Successful parsing of the segment populates the object with the data present on the stream and provides easy accessor and mutator methods to navigate the message. It also leads to failure if version of given HL7 Message is not 2.8.2. This method raises exception if there is Segment which is not valid as per HL7 v 2.8.2 standard.
      Specified by:
        `parse` in interface `ISegment`
      Overrides:
        `parse` in class `Segment`
      Parameters:
        `strSegmentStream` - String of HL7Stream.
        `objIDelimiter` - Object of class Delimiter.
      Returns:
        int - Success if segment is valid. - Fail if segment in not valid
      Throws:
        `InvalidSegmentException` - Thrown when Field Validation Fails.
        `java.io.IOException` - Signals that an I/O exception of some sort has occurred.