tigase.db.converter

## Interface Convertible<T extends RowEntity>

- All Known Implementing Classes:
    UserCredentialsConverter

      public interface Convertible<T extends RowEntity>

  Interface for all converters of data from other servers. In principle it makes a query to database, process each row creating an object of `RowEntity` and then insets it to Tigase repository

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default Optional<Class<? extends Convertible>>` | `dependsOn()`
    `default Map<String,String>` | `getAdditionalQueriesToInitialise()` Method allows providing additional queries that needs to be initialised in `DataRepository` for future use
    `Optional<String>` | `getMainQuery()` Principal query used to retrieve data from source repository.
    `default Optional<Class>` | `getParentBean()`
    `void` | `initialise(Converter.ConverterProperties properties)` Method is responsible for initialising converter based on ConverterProperties.
    `Optional<T>` | `processResultSet(ResultSet rs)` Process `ResultSet` to produce object extending `RowEntity`
    `boolean` | `storeEntity(T entity)` Method stores `RowEntity` in the destination repositories.

- - ### Method Detail

    - #### getMainQuery

          Optional<String> getMainQuery()

      Principal query used to retrieve data from source repository. It's used to determine if implementation offers support for particular combination of source XMPP Server and database type (empty Optional indicates lack of support resulting in skipping implementation).

    - #### initialise

          void initialise(Converter.ConverterProperties properties)

      Method is responsible for initialising converter based on ConverterProperties.
      Parameters:
        `properties` - various properties allowing determine appropriate set of queries and applied processing.

    - #### processResultSet

          Optional<T> processResultSet(ResultSet rs)
                                throws Exception

      Process `ResultSet` to produce object extending `RowEntity`
      Parameters:
        `rs` - result set to be processed
      Returns:
        `RowEntity` with all data from single Row
      Throws:
        `Exception` - indicates any problem with processing of the data

    - #### storeEntity

          boolean storeEntity(T entity)
                       throws Exception

      Method stores `RowEntity` in the destination repositories.
      Parameters:
        `entity` - `RowEntity` to be stored
      Returns:
        value indicating if storing was successful
      Throws:
        `Exception` - indicates any problem with storing of the `RowEntity`

    - #### getAdditionalQueriesToInitialise

          default Map<String,String> getAdditionalQueriesToInitialise()

      Method allows providing additional queries that needs to be initialised in `DataRepository` for future use
      Returns:
        `Map` with key-value pair of query ID and actual query to be initialised

    - #### getParentBean

          default Optional<Class> getParentBean()

    - #### dependsOn

          default Optional<Class<? extends Convertible>> dependsOn()

Copyright © 2004–2021 "Tigase, Inc.". All rights reserved.