cdac.medinfo.sdk.hl7282.baselibs.segments

## Class QPD

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

- All Implemented Interfaces:
    ISegment

      public class QPD
      extends Segment

  QPD - query parameter definition

  The QPD segment defines the parameters of the query.

  Represents an HL7 QPD message segment. This segment has the following fields:

  QPD-1: Message Query Name (CWE)Required
  QPD-2: Query Tag (ST)Conditional
  QPD-3: User Parameters (in successive fields) (varies)

  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
    `QPD()` Constructs the QPD segment.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `CWE` | `getMessageQueryName()` Retrieves the Message Query Name.
    `ST` | `getQueryTag()` Retrieves the Query Tag.
    `ISingleCollection<IDataType>` | `getUserParameters()` Retrieves the User Parameters.
    `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` | `setMessageQueryName(CWE messageQueryName)` Set the Message Query Name.
    `void` | `setMessageQueryName(java.lang.String strIdentifier, java.lang.String strText, java.lang.String strNameOfCodingSystem, java.lang.String strAlternateIdentifier, java.lang.String strAlternateText, java.lang.String strNameOfAlternateCodingSystem, java.lang.String strCodingSystemVersionID, java.lang.String strAlternateCodingSystemVersionId, java.lang.String strOriginalText, java.lang.String strSecondAlternateIdentifier, java.lang.String strSecondAlternateText, java.lang.String strNameofSecondAlternateCodingSystem, java.lang.String strSecondAlternateCodingSystemVersionID, java.lang.String strCodingSystemOID, java.lang.String strValueSetOID, java.lang.String strValueSetVersionID, java.lang.String strAlternateCodingSystemOID, java.lang.String strAlternateValueSetOID, java.lang.String strAlternateValueSetVersionID, java.lang.String strSecondAlternateCodingSystemOID, java.lang.String strSecondAlternateValueSetOID, java.lang.String strSecondAlternateValueSetVersionID)` Set the Message Query Name.
    `void` | `setQueryTag(ST queryTag)` Set the Query Tag.
    `void` | `setQueryTag(java.lang.String strQueryTag)` Set the Query Tag.
    `void` | `setUserParameters(ISingleCollection<IDataType> userParameters)` Set the User Parameters.
    `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

    - #### QPD

          public QPD()

      Constructs the QPD segment.

  - ### Method Detail

    - #### getMessageQueryName

          public CWE getMessageQueryName()

      Retrieves the Message Query Name.
      Returns:
        CWE - messageQueryName

    - #### getQueryTag

          public ST getQueryTag()

      Retrieves the Query Tag. This field value the initiating system to identify the query and used to match response messages to the originating query.
      Returns:
        ISingleCollection - queryTag

    - #### getUserParameters

          public ISingleCollection<IDataType> getUserParameters()

      Retrieves the User Parameters.
      Returns:
        DataType - userParameters

    - #### setMessageQueryName

          public void setMessageQueryName(java.lang.String strIdentifier,
                                 java.lang.String strText,
                                 java.lang.String strNameOfCodingSystem,
                                 java.lang.String strAlternateIdentifier,
                                 java.lang.String strAlternateText,
                                 java.lang.String strNameOfAlternateCodingSystem,
                                 java.lang.String strCodingSystemVersionID,
                                 java.lang.String strAlternateCodingSystemVersionId,
                                 java.lang.String strOriginalText,
                                 java.lang.String strSecondAlternateIdentifier,
                                 java.lang.String strSecondAlternateText,
                                 java.lang.String strNameofSecondAlternateCodingSystem,
                                 java.lang.String strSecondAlternateCodingSystemVersionID,
                                 java.lang.String strCodingSystemOID,
                                 java.lang.String strValueSetOID,
                                 java.lang.String strValueSetVersionID,
                                 java.lang.String strAlternateCodingSystemOID,
                                 java.lang.String strAlternateValueSetOID,
                                 java.lang.String strAlternateValueSetVersionID,
                                 java.lang.String strSecondAlternateCodingSystemOID,
                                 java.lang.String strSecondAlternateValueSetOID,
                                 java.lang.String strSecondAlternateValueSetVersionID)

      Set the Message Query Name.
      Parameters:
        `strIdentifier` - Specifies of characters (the code) that uniquely identifies the item being referenced.
        `strText` - Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction.
        `strNameOfCodingSystem` - Identifies the coding scheme being used in the identifier component.
        `strAlternateIdentifier` - Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
        `strAlternateText` - Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
        `strNameOfAlternateCodingSystem` - Identifies the coding scheme being used in the alternate identifier component.
        `strCodingSystemVersionID` - A sequence of characters that uniquely identifies a second alternate code.
        `strAlternateCodingSystemVersionId` - This component carries the version for the coding system identified by components 4-6.
        `strOriginalText` - The text as seen and/or selected by the user who entered the data.
        `strSecondAlternateIdentifier` - A sequence of characters that uniquely identifies a second alternate code.
        `strSecondAlternateText` - The descriptive or textual name of the alternate identifier.
        `strNameofSecondAlternateCodingSystem` - Identifies the coding scheme being used in the alternate identifier component.
        `strSecondAlternateCodingSystemVersionID` - This component carries the version for the coding system identified by components 10-12.
        `strCodingSystemOID` - This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
        `strValueSetOID` - This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
        `strValueSetVersionID` - This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
        `strAlternateCodingSystemOID` - This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
        `strAlternateValueSetOID` - This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
        `strAlternateValueSetVersionID` - This component carries the version for the value set identified by CWE.18. The version is a date.
        `strSecondAlternateCodingSystemOID` - This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
        `strSecondAlternateValueSetOID` - This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
        `strSecondAlternateValueSetVersionID` - This component carries the version for the value set identified by CWE.21. The version is a date.

    - #### setMessageQueryName

          public void setMessageQueryName(CWE messageQueryName)

      Set the Message Query Name.
      Parameters:
        `messageQueryName` - Object of Message Query Name.

    - #### setQueryTag

          public void setQueryTag(java.lang.String strQueryTag)

      Set the Query Tag. This field value the initiating system to identify the query and used to match response messages to the originating query.
      Parameters:
        `strQueryTag` - Use as QueryTag.

    - #### setQueryTag

          public void setQueryTag(ST queryTag)

      Set the Query Tag. This field value the initiating system to identify the query and used to match response messages to the originating query.
      Parameters:
        `queryTag` - Object of Query Tag.

    - #### setUserParameters

          public void setUserParameters(ISingleCollection<IDataType> userParameters)

      Set the User Parameters.
      Parameters:
        `userParameters` - Use as userParameters.

    - #### 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:
        `objIHL7Stream` - Object of HL7Stream.
        `objIDelimiter` - Object of class Delimiter.
      Returns:
        int - Success if segment is valid. - Fail if segment in not valid.
      Throws:
        `InvalidSegmentException` - Thrown when Segment Validation Fails.
        `java.io.IOException` - Signals that an I/O exception of some sort has occurred.

    - #### 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 successfully 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 occurrences 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 HL7Stream class
        `objIDelimiter` - Object of Delimiter class present as inner class in MSG class
      Returns:
        int - function status [success/failure].
      Throws:
        `SerializeException` - Thrown when serialization of Message fails.
        `java.io.IOException` - Signals that an I/O exception of some sort has occurred.

    - #### 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 checks 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` - Throws when Segment Validation fails.