cdac.medinfo.sdk.hl7282.baselibs.segments

## Class FHS

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

- All Implemented Interfaces:
    ISegment

      public class FHS
      extends Segment

  FHS - File header segment

  The FHS segment defines the intent, source, destination, and some specifics of the syntax of a File.

  Represents an HL7 FHS File header segment. This segment has the following fields:

  FHS-1: Field Separator (ST)Required
  FHS-2: Encoding Characters (ST)Required
  FHS-3: Sending Application (HD)Optional
  FHS-4: Sending Facility (HD)Optional
  FHS-5: Receiving Application (HD)Optional
  FHS-6: Receiving Facility (HD)Optional
  FHS-7: Date/Time Of File (DTM)Optional
  FHS-8: File Security (ST)Optional
  FHS-9: File Type (ST)Optional
  FHS-10: File Comment (ST)Optional
  FHS-11: File Control ID (ST)Optional
  FHS-12: Reference File Control ID (ST)Optional
  FHS-13: File Sending Network Address (HD)Optional
  FHS-14: File 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
    `FHS()` Constructs the FHS segment.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `DTM` | `getDateTimeOfFile()` Retrieves the Date Time Of File.
    `IDelimiter` | `getDelimiter()` Retrieves the Delimiter.
    `ST` | `getEncodingChar()` Retrieves the Encoding Char.
    `ST` | `getFieldSeparator()` Retrieves the Field Separator.
    `ST` | `getFileControlID()` Retrieves the File Control ID.
    `ST` | `getFileHeaderComment()` Retrieves the File Comment.
    `ST` | `getFileName()` Retrieves the File Type.
    `HD` | `getFileReceivingNetworkAddress()` Retrieves the File Receiving Network Address.
    `HD` | `getFileSendingNetworkAddress()` Retrieves the File Sending Network Address.
    `HD` | `getReceivingApplication()` Retrieves the Receiving Application.
    `HD` | `getReceivingFacility()` Retrieves the Receiving Facility.
    `ST` | `getReferenceFileControlID()` Retrieves the Reference File Control ID.
    `ST` | `getSecurity()` Retrieves the Security.
    `HD` | `getSendingApplication()` Retrieves the Sending Application.
    `HD` | `getSendingFacility()` Retrieves the Sending Facility.
    `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` | `setdateTimeOfFile(DTM objdateTimeOfFile)` Sets the Date Time Of File.
    `void` | `setdateTimeOfFile(java.lang.String strTime)` Set the Date Time Of File.
    `void` | `setEncodingChars(char cComponentSeparator, char cSubComponentSeparator, char cRepetitionSeparator, char cEscapeCharacter)` Set the Encoding Char.
    `void` | `setEncodingChars(ST objencodingChar)` Set the Encoding Char.
    `void` | `setFieldSeparator(char cfieldSeparator)` Set the Field Separator.
    `void` | `setFieldSeparator(ST objfieldSeparator)` Set the Field Separator.
    `void` | `setFileControlID(ST objfileControlID)` Set the File Control ID.
    `void` | `setFileControlID(java.lang.String strFileControlID)` Set the File Control ID.
    `void` | `setFileHeaderComment(ST objfileHeaderComment)` Set the file Comment.
    `void` | `setFileHeaderComment(java.lang.String strfileComment)` Set the file Comment.
    `void` | `setFileName(ST objfileName)` Set the File Type.
    `void` | `setFileName(java.lang.String strFileName)` Set the File Type.
    `void` | `setFileReceivingNetworkAddress(HD objReceivingApplication)` Set the File Receiving Network Address.
    `void` | `setFileReceivingNetworkAddress(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the File Receiving Network Address.
    `void` | `setFileSendingNetworkAddress(HD objReceivingApplication)` Set the File Sending Network Address.
    `void` | `setFileSendingNetworkAddress(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the File Sending Network Address.
    `void` | `setReceivingApplication(HD objreceivingApplication)` Set the Receiving Application.
    `void` | `setReceivingApplication(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Receiving Application.
    `void` | `setReceivingFacility(HD objreceivingFacility)` Set the Receiving Facility.
    `void` | `setReceivingFacility(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Receiving Facility.
    `void` | `setReferenceFileControlID(ST objreferenceFileControlID)` Set the Reference File Control ID.
    `void` | `setReferenceFileControlID(java.lang.String strreferenceFileControlID)` Set the Reference File Control ID.
    `void` | `setSecurity(ST objsecurity)` Set the Security.
    `void` | `setSecurity(java.lang.String strSecurity)` Set the Security.
    `void` | `setSendingApplication(HD objsendingApplication)` Set the Sending Application.
    `void` | `setSendingApplication(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Sending Application.
    `void` | `setSendingFacility(HD objsendingFacility)` Set the Sending Facility.
    `void` | `setSendingFacility(java.lang.String strNamespaceId, java.lang.String strUniversalId, java.lang.String strUniversalIdType)` Set the Sending Facility.
    `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

    - #### FHS

          public FHS()

      Constructs the FHS segment.

  - ### Method Detail

    - #### getDelimiter

          public IDelimiter getDelimiter()

      Retrieves the Delimiter.
      Returns:
        IDelimiter - delimiter.

    - #### getDateTimeOfFile

          public DTM getDateTimeOfFile()

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

    - #### getEncodingChar

          public ST getEncodingChar()

      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

    - #### getFieldSeparator

          public ST getFieldSeparator()

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

    - #### getFileControlID

          public ST getFileControlID()

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

    - #### getReceivingApplication

          public HD getReceivingApplication()

      Retrieves the Receiving Application. Identifier of the network location the message was transmitted from.
      Returns:
        HD - receivingApplication

    - #### getReceivingFacility

          public HD getReceivingFacility()

      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

    - #### getSecurity

          public ST getSecurity()

      Retrieves the Security.
      Returns:
        ST - security

    - #### getSendingApplication

          public HD getSendingApplication()

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

    - #### getSendingFacility

          public HD getSendingFacility()

      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

    - #### getFileName

          public ST getFileName()

      Retrieves the File Type. This field contains the File type
      Returns:
        ST - FileName

    - #### setFieldSeparator

          public void setFieldSeparator(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.

    - #### setFieldSeparator

          public void setFieldSeparator(ST objfieldSeparator)

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

    - #### setEncodingChars

          public void setEncodingChars(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

    - #### setEncodingChars

          public void setEncodingChars(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.

    - #### setdateTimeOfFile

          public void setdateTimeOfFile(java.lang.String strTime)

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

    - #### setdateTimeOfFile

          public void setdateTimeOfFile(DTM objdateTimeOfFile)

      Sets the Date Time Of File.
      Parameters:
        `objdateTimeOfFile` - object of Date Time Of File.

    - #### setFileControlID

          public void setFileControlID(java.lang.String strFileControlID)

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

    - #### setFileControlID

          public void setFileControlID(ST objfileControlID)

      Set the File Control ID. This field contains a number or other identifier that uniquely identifies the File.
      Parameters:
        `objfileControlID` - object of File Control ID.

    - #### setFileName

          public void setFileName(java.lang.String strFileName)

      Set the File Type. This field contains the File type for the File.
      Parameters:
        `strFileName` - Specifies the File type code.

    - #### setFileName

          public void setFileName(ST objfileName)

      Set the File Type. This field contains the File type for the File.
      Parameters:
        `objfileName` - object of File Name.

    - #### setReceivingApplication

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

      Set the Receiving Application. Identifier of the network location the message was transmitted from.
      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.

    - #### setReceivingApplication

          public void setReceivingApplication(HD objreceivingApplication)

      Set the Receiving Application. Identifier of the network location the message was transmitted from.
      Parameters:
        `objreceivingApplication` - object of Receiving Application.

    - #### setReceivingFacility

          public void setReceivingFacility(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.

    - #### setReceivingFacility

          public void setReceivingFacility(HD objreceivingFacility)

      Set the Receiving Facility. This field identify the receiving application among multiple identical instances of the application running on behalf of different organizations.
      Parameters:
        `objreceivingFacility` - object of Receiving Facility.

    - #### setSecurity

          public void setSecurity(java.lang.String strSecurity)

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

    - #### setSecurity

          public void setSecurity(ST objsecurity)

      Set the Security.
      Parameters:
        `objsecurity` - object of Security.

    - #### setSendingApplication

          public void setSendingApplication(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.

    - #### setSendingApplication

          public void setSendingApplication(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.

    - #### setSendingFacility

          public void setSendingFacility(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.

    - #### setSendingFacility

          public void setSendingFacility(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.

    - #### setFileHeaderComment

          public void setFileHeaderComment(java.lang.String strfileComment)

      Set the file Comment. This field contains the file Comment for the file.
      Parameters:
        `strfileComment` - Specifies the file Comment.

    - #### setFileHeaderComment

          public void setFileHeaderComment(ST objfileHeaderComment)

      Set the file Comment. This field contains the file Comment for the file.
      Parameters:
        `objfileHeaderComment` - object of File header Comment.

    - #### getFileHeaderComment

          public ST getFileHeaderComment()

      Retrieves the File Comment. This field contains the File type
      Returns:
        ST - FileComment

    - #### setReferenceFileControlID

          public void setReferenceFileControlID(java.lang.String strreferenceFileControlID)

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

    - #### setReferenceFileControlID

          public void setReferenceFileControlID(ST objreferenceFileControlID)

      Set the Reference File Control ID. This field contains a number or other identifier that uniquely identifies the File.
      Parameters:
        `objreferenceFileControlID` - object of Reference File Control ID.

    - #### getReferenceFileControlID

          public ST getReferenceFileControlID()

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

    - #### getFileSendingNetworkAddress

          public HD getFileSendingNetworkAddress()

      Retrieves the File Sending Network Address. Identifier of the network location the message was transmitted from.
      Returns:
        HD - receivingApplication

    - #### setFileSendingNetworkAddress

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

      Set the File Sending Network Address. Identifier of the network location the message was transmitted from.
      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.

    - #### setFileSendingNetworkAddress

          public void setFileSendingNetworkAddress(HD objReceivingApplication)

      Set the File Sending Network Address. Identifier of the network location the message was transmitted from.
      Parameters:
        `objReceivingApplication` - Object of Receiving Application.

    - #### getFileReceivingNetworkAddress

          public HD getFileReceivingNetworkAddress()

      Retrieves the File Receiving Network Address. Identifier of the network location the message was transmitted to.
      Returns:
        HD - receivingApplication

    - #### setFileReceivingNetworkAddress

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

      Set the File Receiving Network Address. Identifier of the network location the message was transmitted to.
      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.

    - #### setFileReceivingNetworkAddress

          public void setFileReceivingNetworkAddress(HD objReceivingApplication)

      Set the File Receiving Network Address. Identifier of the network location the message was transmitted to.
      Parameters:
        `objReceivingApplication` - Object of Receiving 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.