Package in.cdac.medinfo.csnotk.csnolib.disb.agent

## Class DISBAgent

- java.lang.Object
- - in.cdac.medinfo.csnotk.csnolib.disb.agent.DISBAgent

- All Implemented Interfaces:
    `IDISBAgent`, `java.io.Serializable`

      public class DISBAgent
      extends java.lang.Object
      implements IDISBAgent

  A concrete implementation of `IDISBAgent` Library for application. It provides the basic methods to query the DISB for retrieving JSON for known concept identifiers.
  See Also:
    `SubstanceDetail`, `MedicineDetail`, `GenericDrug`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DISBAgent()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getGenericDetail​(java.lang.String conceptId)` | Retrives data from DISB
    `GenericDrug` | `getGenericDetailObj​(java.lang.String conceptId)` | Retrives data from DISB
    `java.lang.String` | `getMedicineDetail​(java.lang.String conceptId)` | Retrives data from DISB
    `MedicineDetail` | `getMedicineDetailObj​(java.lang.String conceptId)` | Retrives data from DISB
    `java.lang.String` | `getSubstanceDetail​(java.lang.String conceptId)` | Retrives data from DISB
    `SubstanceDetail` | `getSubstanceDetailObj​(java.lang.String conceptId)` | Retrives data from DISB
    `void` | `init()` | The method will configure the properties to default values. Protocol for sending request to DISB (default protocol: http). Hostname for remote application DISB (default hostname: localhost). Port for accessing on port to DISB (default port: 9090). Context for requesting to DISB (default context: dis). Location for logs.
    `void` | `init​(java.lang.String protocol, java.lang.String hostname, java.lang.Integer port, java.lang.String context, java.lang.String errorLogDir)` | The method will configure properties by values provided in parameters
    `void` | `testDISBConnection()` | For testing connnection with DISB on entered init properties.

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

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

- - ### Constructor Detail

    - #### DISBAgent

          public DISBAgent()

  - ### Method Detail

    - #### getSubstanceDetail

          public java.lang.String getSubstanceDetail​(java.lang.String conceptId)
                                              throws java.lang.IllegalArgumentException

      Retrives data from DISB
      Specified by:
        `getSubstanceDetail` in interface `IDISBAgent`
      Parameters:
        `conceptId` - SNOMED CT concept identifier for Substance
      Returns:
        JSON string of `SubstanceDetail` model
      Throws:
        `java.lang.IllegalArgumentException` - if invalid concept id is passed

    - #### getSubstanceDetailObj

          public SubstanceDetail getSubstanceDetailObj​(java.lang.String conceptId)
                                                throws java.lang.IllegalArgumentException

      Retrives data from DISB
      Specified by:
        `getSubstanceDetailObj` in interface `IDISBAgent`
      Parameters:
        `conceptId` - SNOMED CT concept identifier for Substance
      Returns:
        `SubstanceDetail` model
      Throws:
        `java.lang.IllegalArgumentException` - if invalid concept id is passed

    - #### getMedicineDetail

          public java.lang.String getMedicineDetail​(java.lang.String conceptId)
                                             throws java.lang.IllegalArgumentException

      Retrives data from DISB
      Specified by:
        `getMedicineDetail` in interface `IDISBAgent`
      Parameters:
        `conceptId` - SNOMED CT concept identifier for Substance
      Returns:
        JSON string of `MedicineDetail` model
      Throws:
        `java.lang.IllegalArgumentException` - if invalid concept id is passed

    - #### getMedicineDetailObj

          public MedicineDetail getMedicineDetailObj​(java.lang.String conceptId)
                                              throws java.lang.IllegalArgumentException

      Retrives data from DISB
      Specified by:
        `getMedicineDetailObj` in interface `IDISBAgent`
      Parameters:
        `conceptId` - SNOMED CT concept identifier for Medicine
      Returns:
        `MedicineDetail` model
      Throws:
        `java.lang.IllegalArgumentException` - if invalid concept id is passed

    - #### getGenericDetail

          public java.lang.String getGenericDetail​(java.lang.String conceptId)
                                            throws java.lang.IllegalArgumentException

      Retrives data from DISB
      Specified by:
        `getGenericDetail` in interface `IDISBAgent`
      Parameters:
        `conceptId` - SNOMED CT concept identifier for Generic
      Returns:
        JSON string of `GenericDrug` model
      Throws:
        `java.lang.IllegalArgumentException` - if invalid concept id is passed

    - #### getGenericDetailObj

          public GenericDrug getGenericDetailObj​(java.lang.String conceptId)
                                          throws java.lang.IllegalArgumentException

      Retrives data from DISB
      Specified by:
        `getGenericDetailObj` in interface `IDISBAgent`
      Parameters:
        `conceptId` - SNOMED CT concept identifier for Generic
      Returns:
        `SubstanceDetail` model
      Throws:
        `java.lang.IllegalArgumentException` - if invalid concept id is passed

    - #### init

          public void init()

      The method will configure the properties to default values.
      Protocol for sending request to DISB (default protocol: http).
      Hostname for remote application DISB (default hostname: localhost).
      Port for accessing on port to DISB (default port: 9090).
      Context for requesting to DISB (default context: dis).
      Location for logs. (default errorLogDir: user directory).
      Specified by:
        `init` in interface `IDISBAgent`

    - #### init

          public void init​(java.lang.String protocol,
                           java.lang.String hostname,
                           java.lang.Integer port,
                           java.lang.String context,
                           java.lang.String errorLogDir)

      The method will configure properties by values provided in parameters
      Specified by:
        `init` in interface `IDISBAgent`
      Parameters:
        `protocol` - for sending request to DISB (default: http)
        `hostname` - for remote application DISB (default: localhost)
        `port` - for accessing on port to DISB (default: 9090)
        `context` - for requesting to DISB (default: dis)
        `errorLogDir` - location for logs. (default: user directory/ same directory which have given at the time of configuring csnolib)

    - #### testDISBConnection

          public void testDISBConnection()
                                  throws java.lang.IllegalArgumentException

      For testing connnection with DISB on entered init properties. If init() is being used then it will use default properties for DISB.
      Specified by:
        `testDISBConnection` in interface `IDISBAgent`
      Throws:
        `java.lang.IllegalArgumentException`