cdac.medinfo.sdk.hl7282.baselibs

## Class CompositeDataType

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.baselibs.CompositeDataType

- All Implemented Interfaces:
    IDataType
  Direct Known Subclasses:
    AD, AUI, CCD, CCP, CD, CF, CNE, CNN, CP, CQ, CSU, CWE, CX, DDI, DIN, DLD, DLN, DLT, DR, DTN, ED, EI, EIP, ERL, FC, FN, HD, ICD, JCC, MA, MO, MOC, MOP, MSG, NA, NDL, NR, OCD, OG, OSP, PIP, PL, PLN, PPN, PRL, PT, PTA, QIP, QSC, RCD, RFR, RI, RMC, RP, RPT, SAD, SCV, SN, SPD, SRT, UVC, VH, VID, VR, WVI, WVS, XAD, XCN, XON, XPN, XTN

      public abstract class CompositeDataType
      extends java.lang.Object
      implements IDataType

  The class is Extended from DataType class. Used as the base class for all the composite dataTypes.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompositeDataType(IDataTypeKey objIDataTypeKey)` constructor for the Class CompositeDataType
    `CompositeDataType(IDataTypeKey objIDataTypeKey, int iComponentType, IDataTypeMap objIDataTypeMap)` Constructor for CompositeDataType which takes three arguments and sets the value in the respective member variable.
    `CompositeDataType(IDataTypeKey objIDataTypeKey, int iMinLength, int iMaxLength, java.lang.String strCLength, int iComponentType)` Constructor for CompositeDataType which takes five arguments and sets the value in the respective member variable.
    `CompositeDataType(IDataTypeKey objIDataTypeKey, int iMinLength, int iMaxLength, java.lang.String strCLength, int iComponentType, IDataTypeMap objIDataTypeMap)` Constructor for CompositeDataType which takes six arguments and sets the value in the respective member variable.
    `CompositeDataType(IDataTypeKey objIDataTypeKey, int iMinLength, int iMaxLength, java.lang.String strCLength, int iTableNo, int iComponentType)` Constructor for CompositeDataType which takes six arguments and sets the value in the respective member variable.
    `CompositeDataType(IDataTypeKey objIDataTypeKey, int iMinLength, int iMaxLength, java.lang.String strCLength, int iTableNo, int iComponentType, IDataTypeMap objIDataTypeMap)` Constructor for CompositeDataType which takes seven arguments and sets the value in the respective member variable.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `copy(IDataType objDataType, IDelimiter objDelimiter)` This will create replicate of existing Data Type.
    `void` | `dumpDataType(IHL7Stream objIHL7Stream, IDelimiter objIDelimiter, int iLevel)` Serializes Composite Data Type information like it name, Attribute name and its values.
    `IMultiValuedPairedCollection<java.lang.Integer,IDataType>` | `getAttributes()` Gets The Attribute List of Composite Datatype.
    `IDataTypeKey` | `getDataTypeName()` This method returns the name of Data Type.
    `int` | `getLength()` This will return the length of DataType.
    `java.lang.Object` | `getValue()` This will return the object.
    `boolean` | `isPrimitive()` This method returns the state for Data Type whether it is primitive Data Type or composite DataType.
    `int` | `read(java.lang.String strAttributeData, IDelimiter objIDelimiter)` Read data from string
    `void` | `setValue(java.lang.Object obj)` This sets the object value on DataType.
    `boolean` | `validate()` Validates the composite data type for its required components.
    `int` | `write(IHL7Stream objIHL7Stream, IDelimiter objIDelimiter)` Method writes the data to the Stream.
    `int` | `writeToXML(javax.xml.stream.XMLEventWriter eventWriter)` Method writes the data to the Stream.

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

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

- - ### Constructor Detail

    - #### CompositeDataType

          public CompositeDataType(IDataTypeKey objIDataTypeKey)

      constructor for the Class CompositeDataType

    - #### CompositeDataType

          public CompositeDataType(IDataTypeKey objIDataTypeKey,
                           int iMinLength,
                           int iMaxLength,
                           java.lang.String strCLength,
                           int iComponentType)

      Constructor for CompositeDataType which takes five arguments and sets the value in the respective member variable.
      Parameters:
        `objIDataTypeKey` - object of IDataTypeKey.
        `iMinLength` - The Minimum length the DataType can have.
        `iMaxLength` - The Maximum length the DataType can have.
        `iCLength` - The Conformance length the DataType can have.
        `iComponentType` - The Type of the component i.e Component or a subcomponent.

    - #### CompositeDataType

          public CompositeDataType(IDataTypeKey objIDataTypeKey,
                           int iMinLength,
                           int iMaxLength,
                           java.lang.String strCLength,
                           int iTableNo,
                           int iComponentType)

      Constructor for CompositeDataType which takes six arguments and sets the value in the respective member variable.
      Parameters:
        `iTableNo` - integer value of Table no.
        `objIDataTypeKey` - object of IDataTypeKey.
        `iMinLength` - The Minimum length the DataType can have.
        `iMaxLength` - The Maximum length the DataType can have.
        `iCLength` - The Conformance length the DataType can have.
        `iComponentType` - The Type of the component i.e Component or a subcomponent.

    - #### CompositeDataType

          public CompositeDataType(IDataTypeKey objIDataTypeKey,
                           int iComponentType,
                           IDataTypeMap objIDataTypeMap)

      Constructor for CompositeDataType which takes three arguments and sets the value in the respective member variable.
      Parameters:
        `iTableNo` - integer value of Table no.
        `objIDataTypeKey` - object of IDataTypeKey.
        `iMinLength` - The Minimum length the DataType can have.
        `iMaxLength` - The Maximum length the DataType can have.
        `iCLength` - The Conformance length the DataType can have.
        `iComponentType` - The Type of the component i.e Component or a subcomponent.
        `objIDataTypeMap` - object of DataTypeMap

    - #### CompositeDataType

          public CompositeDataType(IDataTypeKey objIDataTypeKey,
                           int iMinLength,
                           int iMaxLength,
                           java.lang.String strCLength,
                           int iComponentType,
                           IDataTypeMap objIDataTypeMap)

      Constructor for CompositeDataType which takes six arguments and sets the value in the respective member variable.
      Parameters:
        `iTableNo` - integer value of Table no.
        `objIDataTypeKey` - object of IDataTypeKey.
        `iMinLength` - The Minimum length the DataType can have.
        `iMaxLength` - The Maximum length the DataType can have.
        `iCLength` - The Conformance length the DataType can have.
        `iComponentType` - The Type of the component i.e Component or a subcomponent.
        `objIDataTypeMap` - object of DataTypeMap

    - #### CompositeDataType

          public CompositeDataType(IDataTypeKey objIDataTypeKey,
                           int iMinLength,
                           int iMaxLength,
                           java.lang.String strCLength,
                           int iTableNo,
                           int iComponentType,
                           IDataTypeMap objIDataTypeMap)

      Constructor for CompositeDataType which takes seven arguments and sets the value in the respective member variable.
      Parameters:
        `iTableNo` - integer value of Table no.
        `objIDataTypeKey` - object of IDataTypeKey.
        `iMinLength` - The Minimum length the DataType can have.
        `iMaxLength` - The Maximum length the DataType can have.
        `iCLength` - The Conformance length the DataType can have.
        `iComponentType` - The Type of the component i.e Component or a subcomponent.
        `objIDataTypeMap` - object of DataTypeMap

  - ### Method Detail

    - #### getDataTypeName

          public IDataTypeKey getDataTypeName()

      This method returns the name of Data Type.
      Specified by:
        `getDataTypeName` in interface `IDataType`
      Returns:
        IDataTypeKey - Name of the Data Type.

    - #### write

          public int write(IHL7Stream objIHL7Stream,
                  IDelimiter objIDelimiter)
                    throws DelimiterMissingException,
                           java.io.IOException

      Method writes the data to the Stream.
      Specified by:
        `write` in interface `IDataType`
      Parameters:
        `objIHL7Stream` - Object of HL7Stream
        `objIDelimiter` - Object of class Delimiter
      Returns:
        int - Success or failure of the read.
      Throws:
        `DelimiterMissingException` - - if Delimiter is absent.
        `java.io.IOException` - - if IO operation fails

    - #### writeToXML

          public int writeToXML(javax.xml.stream.XMLEventWriter eventWriter)
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException

      Method writes the data to the Stream.
      Parameters:
        `eventWriter` - Object of XMLEventWriter
      Returns:
        int - Success or failure of the read.
      Throws:
        `java.io.IOException` - - if IO operation fails
        `javax.xml.stream.XMLStreamException`

    - #### read

          public int read(java.lang.String strAttributeData,
                 IDelimiter objIDelimiter)
                   throws DelimiterMissingException,
                          InvalidDelimiterException,
                          InvalidDataTypeException,
                          java.io.IOException

      Read data from string
      Specified by:
        `read` in interface `IDataType`
      Parameters:
        `strAttributeData` - String of segment
        `objIDelimiter` - object of class Delimiter
      Returns:
        integer - Number of bytes read. - Fail if data read is not valid.
      Throws:
        `DelimiterMissingException` - - if Delimiter is absent.
        `InvalidDelimiterException` - - if Delimiter is not valid
        `java.io.IOException` - - if IO operation fails.
        `InvalidDataTypeException`

    - #### validate

          public boolean validate()
                           throws InvalidDataTypeException

      Validates the composite data type for its required components.
      Specified by:
        `validate` in interface `IDataType`
      Returns:
        boolean - true or false.
      Throws:
        `InvalidDataTypeException` - - if Invalid values is entered or Mandatory field is missing.

    - #### getValue

          public java.lang.Object getValue()

      This will return the object. in case of Composite Data Type it will return the IMultivaluedPairedCollection and for primitive dataType it will return the Object as String.
      Specified by:
        `getValue` in interface `IDataType`
      Returns:
        strValue

    - #### getAttributes

          public IMultiValuedPairedCollection<java.lang.Integer,IDataType> getAttributes()

      Gets The Attribute List of Composite Datatype.
      Returns:
        IMultiValuedPairedCollection - returns the Multi-Valued PairedCollection of index and IDataType

    - #### getLength

          public int getLength()

      This will return the length of DataType.
      Specified by:
        `getLength` in interface `IDataType`

    - #### setValue

          public void setValue(java.lang.Object obj)

      This sets the object value on DataType. in case of composite Data Type it will be set as MultivaluedPairedCollecxtion and for primitive Data Type it will be set as String.
      Specified by:
        `setValue` in interface `IDataType`

    - #### isPrimitive

          public boolean isPrimitive()

      This method returns the state for Data Type whether it is primitive Data Type or composite DataType.
      Specified by:
        `isPrimitive` in interface `IDataType`
      Returns:
        false for all Composite DataType.

    - #### copy

          public void copy(IDataType objDataType,
                  IDelimiter objDelimiter)
                    throws java.io.IOException

      This will create replicate of existing Data Type.
      Parameters:
        `objDataType` - object of Data Type.
        `objDelimiter` - object of Delimiter.
      Throws:
        `java.io.IOException` - - if IO operation fails.

    - #### dumpDataType

          public void dumpDataType(IHL7Stream objIHL7Stream,
                          IDelimiter objIDelimiter,
                          int iLevel)
                            throws DumpException,
                                   java.io.IOException

      Serializes Composite Data Type information like it name, Attribute name and its values.
      Parameters:
        `objHL7Stream` - Object of IHL7Stream
        `objDelimiter` - Object of IDelimiter
        `iLevel` - integer shows level of an attribute.
      Throws:
        `DumpException` - Signals that dump operation is failed
        `java.io.IOException` - Signals that an I/O exception of some sort has occurred.