com.ihr.xbrl.dataloader

## Interface XBRLLoaderInterface

- All Known Implementing Classes:
    ExcelReportFactHandler, NullDriver, SQLDriver

      public interface XBRLLoaderInterface

  This is the interface for drivers responsible of handling events about data loading in repositories like excel files, databases or any other formats. The driver knows how to work with the target environment. Each driver may have a configuration file. Data loading events are generated by the loader engine and they are independent of the driver to use. XBRL data can be targeted to more that one driver.
  Author:
    Ignacio

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMap(java.lang.String mapIdentifier, java.lang.Object info, XBRLDataSource source)` Used to programmatically add an entry on this XBRLLoaderInterface.
    `XBRLTransformationResult` | `createNewResult(net.sf.saxon.s9api.Processor configuration)` Creates a new document container.
    `void` | `endOfDocument()` Called by the transformation processor to indicate the end of a document processing Usually a document footer is produced.
    `java.net.URI` | `getConfigFile()` Returns back the URI of the configuration file.
    `XBRLFilterContext` | `getFilterContext()` Returns an instance of the XBRLFilterContext class that will be used to pick up the appropriate context.
    `void` | `init()` This method is called by the loader just after object has been created and if a configuration file is set (which is an optional step only if configuration file is indicated as a parameter) This method should read the configuration file and set values for constants and things like that.
    `void` | `processContexts(java.util.Iterator<XBRLContext> contexts)` Called by the transformation processor to provide the contexts for the data that will be found later during the processing of facts the default process updates the content of some variables. or calculates number of columns, rows.
    `void` | `processFact(java.lang.String identifier, XBRLFact fact)` Called by the processor to inform about a new fact that requires processing.
    `void` | `setConfigFile(java.net.URI configFile)` This method is called by the loader when a new loader is just created and for each one of the drivers that exist on the loader configuration file and only if the driver has a parameter indicating the URL of the configuration file Next call is `init()`.
    `void` | `startOfDocument(XBRLInstance instance)` Called by the transformation processor to indicate the start of a new document.
    `void` | `writeConfigFile()` Serializes the configuration file back to the URI assigned in the configuration file from the internal data model.

- - ### Method Detail

    - #### setConfigFile

          void setConfigFile(java.net.URI configFile)

      This method is called by the loader when a new loader is just created and for each one of the drivers that exist on the loader configuration file and only if the driver has a parameter indicating the URL of the configuration file Next call is `init()`.
      Parameters:
        `configFile` - the new config file

    - #### init

          void init()
                    throws LoaderConfigurationFileException

      This method is called by the loader just after object has been created and if a configuration file is set (which is an optional step only if configuration file is indicated as a parameter) This method should read the configuration file and set values for constants and things like that. Next call is `createNewResult(Processor)`
      Throws:
        `LoaderConfigurationFileException` - the loader configuration file exception

    - #### createNewResult

          XBRLTransformationResult createNewResult(net.sf.saxon.s9api.Processor configuration)
                                                   throws FactHandlerException

      Creates a new document container. This method is the first one called when a new instance document requires to be processed. This method can be used to open connections to the target repository. Next call is `startOfDocument(XBRLInstance)`
      Parameters:
        `configuration` - Saxon s9api Processor object
      Returns:
        XBRLTransformationResult an object that implements the XBRLTransformationResult interface.
      Throws:
        `FactHandlerException` - if anything goes wrong.

    - #### startOfDocument

          void startOfDocument(XBRLInstance instance)
                               throws FactHandlerException

      Called by the transformation processor to indicate the start of a new document. Usually a document header is produced. A new template document is initialized or a transaction is created. Next call is `processContexts(Iterator)`
      Parameters:
        `instance` - the instance
      Throws:
        `FactHandlerException` - the fact handler exception

    - #### processContexts

          void processContexts(java.util.Iterator<XBRLContext> contexts)

      Called by the transformation processor to provide the contexts for the data that will be found later during the processing of facts the default process updates the content of some variables. or calculates number of columns, rows. Next call is `processFact(String, XBRLFact)` for facts that passes the filters established by the loader engine and are the true loading events.
      Parameters:
        `contexts` - Iterator<XBRLContext>

    - #### processFact

          void processFact(java.lang.String identifier,
                         XBRLFact fact)
                           throws FactHandlerException

      Called by the processor to inform about a new fact that requires processing. This is where the real loading event is handled by the driver. Next call is `endOfDocument()` when the instance document is finished and no more events needs to be generated
      Parameters:
        `identifier` - as String which is the identifier code in the loader configuration file.
        `fact` - XBRLFact the loaded fact
      Throws:
        `FactHandlerException` - if something goes wrong.

    - #### endOfDocument

          void endOfDocument()
                             throws FactHandlerException

      Called by the transformation processor to indicate the end of a document processing Usually a document footer is produced. Or the transaction is committed. There is no a next call.
      Throws:
        `FactHandlerException` - if something goes wrong

    - #### getConfigFile

          java.net.URI getConfigFile()

      Returns back the URI of the configuration file.
      Returns:
        URI

    - #### getFilterContext

          XBRLFilterContext getFilterContext()

      Returns an instance of the XBRLFilterContext class that will be used to pick up the appropriate context.
      Returns:
        XBRLFilterContext

    - #### addMap

          void addMap(java.lang.String mapIdentifier,
                    java.lang.Object info,
                    XBRLDataSource source)

      Used to programmatically add an entry on this XBRLLoaderInterface. The source parameter may be null. When the Loader is creating a new configuration from a Mapper, the source contains the source driver for data. This can be used to obtain additional properties for example the multiplier used in the excel driver and translate the multiplier to the export rules.
      Parameters:
        `mapIdentifier` - the map identifier
        `info` - the info
        `source` - the XBRLDataSource if any exists. This argument may be null.

    - #### writeConfigFile

          void writeConfigFile()
                               throws LoaderException

      Serializes the configuration file back to the URI assigned in the configuration file from the internal data model.
      Throws:
        `LoaderException` - the loader exception