com.ihr.xbrl.pojo.etl

## Class ExtractionEngine

- java.lang.Object
- - com.ihr.xbrl.database.common.XBRLDatabaseAccessApp
  - - com.ihr.xbrl.store.StorageService
    - - com.ihr.xbrl.pojo.etl.ExtractionEngine

- All Implemented Interfaces:
    HasEnableDisableOpenMenus, StorageEventListener

      public class ExtractionEngine
      extends StorageService
      implements StorageEventListener

  This class executes all extractions from a specific XBRLInstance (pojo) and fills in the data in the tables referenced in the extraction metadata.
  Author:
    Ignacio

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.ihr.xbrl.store.StorageService

      `StorageService.StorageStatus`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `CREATE_VIEWS` When this property is set to true, during the creation of the ExtractionEngine instance all views are created from scratch.
    `static java.lang.String` | `IDENTIFIER_QUERY` Used to obtain the identifier from the reported fact.
    `static java.lang.String` | `INSTANCE_FILTER_QUERY` Used to check if the instance document will be processed or will be skipped.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExtractionEngine(DatabaseManagerBase dbm, RegisterExtraClasses[] extra, java.util.Properties props, boolean hasGUI)` It must be public because of the way it should be initialized due to the HasURIResolverParameter interface.
    `ExtractionEngine(RegisterExtraClasses[] extra, java.util.Properties props, boolean hasGUI)` It must be public because of the way it should be initialized due to the HasURIResolverParameter interface.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `containsClass(java.lang.String name)` Contains class.
    `void` | `documentStoredEvent(StorageEvent evt)` Document stored event.
    `void` | `endUnitOfWork()` This method closes current session and allows for the creation of a new session in the next call to `getSession()`.
    `static java.lang.String` | `getDefaultIdentifierQuery()` Returns the default query used to obtain the identifier from the reported fact The query must use a parameter called "f" that will be set to the fact from which the identifier shall be obtained.
    `static java.lang.String` | `getDefaultInstanceFilterQuery()` Returns the default query to determine if the instance document is going to be processed for extraction.
    `java.lang.String` | `getIdentifierQuery()` Returns the query that is currently set to obtain the company identifier from a reported fact.
    `java.lang.String` | `getInstanceFilterQuery()` Returns the query that will be executed to determine if the instance will be processed for extractions or if it will be skipped.
    `java.lang.Throwable` | `getLastException()` Access to the last error collected on this class. returns null in case of no errors
    `static ExtractionEngine` | `getService(RegisterExtraClasses[] extra, java.util.Properties props, boolean hasGUI)` Obtains the instance of the static service class that manages storage of information into the XBRL database.
    `org.hibernate.Session` | `getSession()` Access to the session created on the extraction engine can be null in case of errors.
    `boolean` | `isNew()` Temp method to avoid the test tool to create duplicate records every time it runs.
    `void` | `processInstance(XBRLInstance instance, org.hibernate.Session dbs)` Process instance.

    - ### Methods inherited from class com.ihr.xbrl.store.StorageService

      `clear, disableOpen, doStoreDTS, doStoreDTS, doStoreDTS, enableOpen, getLastMessage, getPercentage, getStackTrace, getStatus, getStorageThreads, getTooltipMessage, isStored`

    - ### Methods inherited from class com.ihr.xbrl.database.common.XBRLDatabaseAccessApp

      `getDbUtil, getStatus, showDbSettings`

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

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

- - ### Field Detail

    - #### IDENTIFIER_QUERY

          public static final java.lang.String IDENTIFIER_QUERY

      Used to obtain the identifier from the reported fact. The default query obtains the text from the context entity identifier. Users can set a new query to obtain the value from other table if this is required
      See Also:
        Constant Field Values

    - #### INSTANCE_FILTER_QUERY

          public static final java.lang.String INSTANCE_FILTER_QUERY

      Used to check if the instance document will be processed or will be skipped. The default query accepts all instances and does not impose any filter. Users can use this query to check if the instance was "accepted" or was "rejected" even if it is stored in the database for any other purposes
      See Also:
        Constant Field Values

    - #### CREATE_VIEWS

          public static final java.lang.String CREATE_VIEWS

      When this property is set to true, during the creation of the ExtractionEngine instance all views are created from scratch. The default value of this property is "false" so, the existing views are not generated every time an instance of the ExtractionEngine is created. The DatabaseExtractor GUI changes this value from false to true so the views will be created when the model is rebuild
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ExtractionEngine

          public ExtractionEngine(RegisterExtraClasses[] extra,
                          java.util.Properties props,
                          boolean hasGUI)

      It must be public because of the way it should be initialized due to the HasURIResolverParameter interface.
      Parameters:
        `extra` - is an array of RegisterExtraClasses objects
        `props` - additional Properties object for the connection to the database
        `hasGUI` - this is true if the service can open a window to the end user. false otherwise.
      See Also:
        `RegisterExtraClasses`

    - #### ExtractionEngine

          public ExtractionEngine(DatabaseManagerBase dbm,
                          RegisterExtraClasses[] extra,
                          java.util.Properties props,
                          boolean hasGUI)

      It must be public because of the way it should be initialized due to the HasURIResolverParameter interface.
      Parameters:
        `dbm` - the database manager base to use with alternate configuration to connect to the database
        `extra` - is an array of RegisterExtraClasses objects
        `props` - additional Properties object for the connection to the database and to the pojo generarion process
        `hasGUI` - this is true if the service can open a window to the end user. false otherwise.
      See Also:
        `RegisterExtraClasses`

  - ### Method Detail

    - #### getService

          public static ExtractionEngine getService(RegisterExtraClasses[] extra,
                                    java.util.Properties props,
                                    boolean hasGUI)

      Obtains the instance of the static service class that manages storage of information into the XBRL database.

      The parameters are optional and both can be null.

      Parameters:
        `extra` - array of RegisterExtraClasses instances. The RegisterExtraClasses interface allows for extending the database model for additional objects
        `props` - extra properties that will be added to the connection to the database and to the pojo generarion process
        `hasGUI` - this is true if the service can open a window to the end user. false otherwise.
      Returns:
        the StorageSerice instance. The first time this method is called the service will be initialized with the supplied parameters. on subsequent calls the parameters are ignored. Note the constructor of the StorageService is public this allows you applications to configure multiple storage services if this is needed.
      See Also:
        `RegisterExtraClasses`

    - #### getDefaultIdentifierQuery

          public static java.lang.String getDefaultIdentifierQuery()

      Returns the default query used to obtain the identifier from the reported fact

      The query must use a parameter called "f" that will be set to the fact from which the identifier shall be obtained.

      Returns:
        query as a string statically defined in the ExtractionEngine

    - #### getDefaultInstanceFilterQuery

          public static java.lang.String getDefaultInstanceFilterQuery()

      Returns the default query to determine if the instance document is going to be processed for extraction.

      The query must use the parameter "i" that will be set to the instance document for which the decision shall be taken. The return value can be either a boolean value or a number that will be treated as true if it is different from 0 or false if it is equal to 0

      Returns:
        the default instance filter query

    - #### getIdentifierQuery

          public java.lang.String getIdentifierQuery()

      Returns the query that is currently set to obtain the company identifier from a reported fact.
      Returns:
        the queryIdentifier

    - #### getInstanceFilterQuery

          public java.lang.String getInstanceFilterQuery()

      Returns the query that will be executed to determine if the instance will be processed for extractions or if it will be skipped.
      Returns:
        the queryInstanceFilter

    - #### getLastException

          public java.lang.Throwable getLastException()

      Access to the last error collected on this class. returns null in case of no errors
      Returns:
        Throwable

    - #### processInstance

          public void processInstance(XBRLInstance instance,
                             org.hibernate.Session dbs)

      Process instance.
      Parameters:
        `instance` - the instance
        `dbs` - the dbs

    - #### documentStoredEvent

          public void documentStoredEvent(StorageEvent evt)

      Description copied from interface: `StorageEventListener`
      Document stored event.
      Specified by:
        `documentStoredEvent` in interface `StorageEventListener`
      Overrides:
        `documentStoredEvent` in class `StorageService`
      Parameters:
        `evt` - the evt

    - #### getSession

          public org.hibernate.Session getSession()

      Access to the session created on the extraction engine can be null in case of errors.
      Returns:
        Session

    - #### endUnitOfWork

          public void endUnitOfWork()

      This method closes current session and allows for the creation of a new session in the next call to `getSession()`.

    - #### containsClass

          public boolean containsClass(java.lang.String name)

      Contains class.
      Parameters:
        `name` - the name
      Returns:
        true, if successful

    - #### isNew

          public boolean isNew()

      Temp method to avoid the test tool to create duplicate records every time it runs.
      Returns:
        true, if is new