Enum Database

java.lang.Object
java.lang.Enum<Database>
com.totvs.tjf.tenant.schema.Database
All Implemented Interfaces:
Serializable, Comparable<Database>, java.lang.constant.Constable

public enum Database extends Enum<Database>
Map the database info supported by the tenant schema library.
  • Enum Constant Details

    • POSTGRESQL

      public static final Database POSTGRESQL
    • H2

      public static final Database H2
    • MYSQL

      public static final Database MYSQL
  • Method Details

    • values

      public static Database[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Database valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getListSchemaStatement

      public String getListSchemaStatement()
      SQL statement to discover all schemas in the database.
      Returns:
      SQL statement.
    • getListSchemaRowMapper

      public org.springframework.jdbc.core.RowMapper<String> getListSchemaRowMapper()
      Map the result set row to the schema name.
      Returns:
      schema name.
    • getSetSchemaStatement

      public abstract String getSetSchemaStatement(String schema)
      Build the set schema SQL statement for the given schema.
      Parameters:
      schema - na to be set.
      Returns:
      Set schema SQL statement.
    • getSystemSchemas

      public abstract Set<String> getSystemSchemas()
      Retrieves the list of system databases schemas.
      Returns:
      list of schemas name.
    • fromName

      public static Optional<Database> fromName(String name)
      Lookup for the database instance based on the given database name.

      Note: This lookup is case insensitive.

      Parameters:
      name - to lookup the database instance.
      Returns:
      the database instance if find one, otherwise, POSTGRESQL as default.