com.ihr.xbrl.manage

## Class DatabaseManagerBase

- java.lang.Object
- - com.ihr.xbrl.manage.DatabaseManagerBase

- All Implemented Interfaces:
    HasProperties

      public class DatabaseManagerBase
      extends java.lang.Object
      implements HasProperties

  This is the base class that is able to read the properties from the user preferences file and write them down. The class requires another class that implements the user interface. The idea is that the user interface can be implemented in several programming languages while this class can be reused in the different GUI frameworks.
  Author:
    Ignacio

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DatabaseManagerBase.DatabaseConfigurationInformationStatus` The Enum DatabaseConfigurationInformationStatus.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `defaultPropertiesFileName` This is the default file name for the XBRLRepository configuration.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatabaseManagerBase(boolean bCreateDefault, boolean bHasGUI)` Creates an instance of the DatabaseManagerBase using the default configuration file name.
    `DatabaseManagerBase(boolean bCreateDefault, boolean bHasGUI, java.lang.String propertiesFileName)` Creates an instance of the DatabaseManagerBase using the indicated file name.
    `DatabaseManagerBase(java.util.Properties props)` Creates an instance of the DatabaseManagerBase with properties created externally.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Properties` | `getProperties()` Access back to the properties object.
    `DatabaseManagerBase.DatabaseConfigurationInformationStatus` | `getStatus()` Gets the status.
    `void` | `loadProperties(boolean bCreateDefault, boolean bHasGUI)` If the parameter is true, a new file will be created with default values if the file is not found.
    `void` | `saveProperties()` Stores the application properties to disk.
    `void` | `setProperties(java.util.Properties p)` Sets the properties to be used.

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

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

- - ### Field Detail

    - #### defaultPropertiesFileName

          public static final java.lang.String defaultPropertiesFileName

      This is the default file name for the XBRLRepository configuration.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DatabaseManagerBase

          public DatabaseManagerBase(boolean bCreateDefault,
                             boolean bHasGUI)

      Creates an instance of the DatabaseManagerBase using the default configuration file name.
      Parameters:
        `bCreateDefault` - the b create default
        `bHasGUI` - the b has gui

    - #### DatabaseManagerBase

          public DatabaseManagerBase(boolean bCreateDefault,
                             boolean bHasGUI,
                             java.lang.String propertiesFileName)

      Creates an instance of the DatabaseManagerBase using the indicated file name.
      Parameters:
        `bCreateDefault` - the b create default
        `bHasGUI` - the b has gui
        `propertiesFileName` - the properties file name

    - #### DatabaseManagerBase

          public DatabaseManagerBase(java.util.Properties props)

      Creates an instance of the DatabaseManagerBase with properties created externally.

      The following properties MUST be set:

      - Environment.DRIVER (class name of the JDBC driver)
      - Environment.PASS (user password - optional)
      - Environment.URL (connection string, may contain user name and password and parameters) example "jdbc:postgresql:xbrl"
      - Environment.USER (Optional, user name)
      - Environment.POOL_SIZE (optional, defaults to "1")
      - Environment.DIALECT (Hibernate dialect class) example "org.hibernate.dialect.PostgreSQLDialect"
      - Environment.CURRENT_SESSION_CONTEXT_CLASS (Hibernate context) defaults to "thread"
      - Environment.CACHE_PROVIDER_CONFIG (Hibernate cache provider) defaults to "org.hibernate.cache.NoCacheProvider"
      - Environment.SHOW_SQL (log SQL statements) defaults to "false"
      Parameters:
        `props` - the props

  - ### Method Detail

    - #### loadProperties

          public void loadProperties(boolean bCreateDefault,
                            boolean bHasGUI)

      If the parameter is true, a new file will be created with default values if the file is not found. If the parameter is false, a new file will not be created if the file is not found.
      Parameters:
        `bCreateDefault` - the b create default
        `bHasGUI` - the b has gui

    - #### getStatus

          public DatabaseManagerBase.DatabaseConfigurationInformationStatus getStatus()

      Gets the status.
      Returns:
        the status

    - #### saveProperties

          public void saveProperties()

      Stores the application properties to disk.
      Specified by:
        `saveProperties` in interface `HasProperties`

    - #### getProperties

          public java.util.Properties getProperties()

      Access back to the properties object.
      Specified by:
        `getProperties` in interface `HasProperties`
      Returns:
        Properties

    - #### setProperties

          public void setProperties(java.util.Properties p)

      Sets the properties to be used. This method should be called from the setProperties method in the GUI class and it makes a call to updateAllFields in the GUI class.
      Parameters:
        `p` - the new properties