com.corticon.eclipse.studio.vocabulary.core

## Interface IDatabaseMetadataAPI

- All Superinterfaces:
    IModelAPI

      public interface IDatabaseMetadataAPI
      extends IModelAPI

  Database Metadata API. This interface contains methods needed to load database metadata from a JDBC data source and provides various finder and helper methods for using the data.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearCache()` Clear the metadata.
    `com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.ColumnMetadata` | `findColumnMetadata(java.lang.String astrTableName, java.lang.String astrColumnName)` Return the specified ColumnMetadata object instance.
    `com.corticon.rulesemf.canonicalvocabularymodel.DatabaseAccess` | `findDatabaseAccess()` Finder for DatabaseAccess instance.
    `com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.DatabaseMetadata` | `findDatabaseMetadata()` Finder for DatabaseMetadata anchor.
    `com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.ForeignKeyMetadata` | `findForeignKeyMetadata(java.lang.String astrTableName, java.lang.String astrForeignKeyName)` Return the specified foreign key metadata object instance.
    `com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.PrimaryKeyMetadata` | `findPrimaryKeyMetadata(java.lang.String astrTableName, java.lang.String astrPrimaryKeyName)` Return the specified primary key metadata object instance.
    `com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.TableMetadata` | `findTableMetadata(java.lang.String astrTableName)` Return the specified TableMetadata object instance.
    `java.util.ArrayList` | `getAllColumnNames(java.lang.String astrTableName)` Return a list of all column names of the specified table.
    `java.util.ArrayList` | `getAllForeignKeyNames(java.lang.String astrTableName)` Return a list of all foreign key names (foreign keys that *point* to this table, not foreign keys defined for this table).
    `java.util.ArrayList` | `getAllTableNames()` Return a list of fully-qualified table names.
    `java.util.ArrayList` | `getColumnNamesForTypes(java.lang.String astrTableName, java.util.List aListJdbcDataTypes)` Return a list of column names belonging to the specified table that have the specified JDBC data type(s).
    `int` | `getColumnSize(java.lang.String astrTableName, java.lang.String astrColumnName)` Given a table name and column name, return the column size as specified in the database metadata or -1 if no information is available.
    `int` | `getDecimalDigits(java.lang.String astrTableName, java.lang.String astrColumnName)` Given a table name and column name, return the number of decimal digits specified in the database metadata or -1 if no information is available.
    `java.lang.String` | `getJdbcDataType(java.lang.String astrTableName, java.lang.String astrColumnName)` Get the JDBC data type for a given database table name and column name.
    `java.util.List` | `getJoinExpressionsInverse(java.lang.String astrSourceTable, java.lang.String astrTargetTable)` Given a source and target table, return a list of inverse join expressions.
    `java.util.List` | `getJoinExpressionsManyToMany(java.lang.String astrTableSource, java.lang.String astrTableTarget)` Return join expressions appropriate for many-to-many associations.
    `java.util.List` | `getJoinExpressionsStandard(java.lang.String astrTableSource, java.lang.String astrTableTarget)` Return join expressions appropriate for one-to-one or one-to-many associations.
    `java.util.ArrayList` | `getPrimaryKeyColumnNames(java.lang.String astrTableName)` Return a sorted list of the primary key column names for a given table name.
    `java.lang.String` | `getSqlDataType(java.lang.String astrTableName, java.lang.String astrColumnName)` Get the SQL data type for a given database table name and column name.
    `java.util.List<java.lang.String>` | `getSQLKeywords()` Get a list of SQL keywords from the current database connection.
    `boolean` | `isEmpty()` Determine whether the metadata cache is empty (i.e., database contains zero tables).
    `boolean` | `isForeignKeyColumn(java.lang.String astrTableName, java.lang.String astrColumnName)` Determine whether the specified table and column name are part of a foreign key.
    `boolean` | `isMetadataLoaded()` Determine whether any metadata has been loaded.
    `boolean` | `isSequence(IEntity aEntity, java.lang.String astrName)` Determine whether the specified name is a database sequence.
    `boolean` | `isTable(java.lang.String astrName)` Determine whether the specified name is a database table.
    `boolean` | `isValidColumn(java.lang.String astrTableName, java.lang.String astrColumnName)` Determine whether the specified column name is valid (i.e., whether there is any metadata present that describes the column).
    `boolean` | `isValidTable(java.lang.String astrTableName)` Determine whether the specified table name is valid (i.e., whether there is any metadata present that describes the table).
    `boolean` | `isView(java.lang.String astrName)` Determine whether the specified name is a database view.
    `boolean` | `load()` Load all metadata from a database connection using connection properties defined in the DatabaseAccess EMF object.
    `JoinExpression` | `parseJoinExpression(java.lang.String astrJoinExpression, java.lang.String astrSourceTableName, java.lang.String astrTargetTableName, boolean abManyToMany, boolean abPerformSemanticAnalysis)` Parse a given join expression to construct an object representation then optionally perform semantic analysis if the database metadata is available.
    `void` | `setVocabularyModelAPI(IVocabularyModelAPI aIVocabularyModelAPI)` Setter for reference to Vocabulary model API (required).
    `boolean` | `testConnection(boolean abSilent)` Test the current database connection and may optionally display a message box to indicate whether the test was successful.

    - ### Methods inherited from interface com.corticon.eclipse.core.IModelAPI

      `activate, addAnnotation, addBatchedModelListener, addLowLevelModelListener, addModelListener, addResourceListener, addView, beginTransaction, cancelTransaction, canSetSupportedLocales, closeResource, createResource, deleteAnnotation, deleteAnnotation, deleteAnnotation, deleteResource, displayMessageBox, dispose, doPostLoadValidation, doSmartValidation, endTransaction, endTransaction, flushCommandStack, formatValidationMessageLocation, formatValidationMessageText, getAllLocalesProvidingCompleteLocalization, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAPIContextObject, getAsset, getBaseAttribute, getBaseAttributeString, getBatchedModelListeners, getBuildNumber, getBuildNumberOfLastValidationRulesChange, getEditingDomain, getErrors, getErrors, getIndexByLocale, getLocale, getLocalizedAttribute, getLocalizedAttributeString, getLowLevelModelListeners, getMajorServiceNumber, getMajorVersionNumber, getMessage, getMessage, getMessageBase, getMessageBoxDelegate, getMinorServiceNumber, getMinorVersionNumber, getModelAPIState, getModelListeners, getNewResourceName, getPersistenceServicesDelegate, getPreferences, getPrimaryResource, getPrimaryResourceURI, getScrollableMessageDelegate, getSupportedLocales, getSuppressBrokenLinkValidation, getSuppressValidation, getToolTip, getUpdateStamp, getUserInterfaceInfoDelegate, getValidationMessageCount, getValidationMessageCount, getValidationMessageCount, getValidationMessageCount, getValidationMessages, getValidationMessages, getWarnings, getWarnings, handleException, hasErrors, hasErrors, hasErrors, hasErrors, hasErrors, hasErrors, hasErrorsOrWarnings, hasErrorsOrWarnings, hasErrorsOrWarnings, hasErrorsOrWarnings, hasErrorsOrWarnings, hasErrorsOrWarnings, hasWarnings, hasWarnings, hasWarnings, hasWarnings, hasWarnings, hasWarnings, isAPIStateEstablished, isEnabledRedo, isEnabledUndo, isInhibitNotification, isLoaded, isOperationModeNormal, isOperationModeRedo, isOperationModeUndo, isPassive, isPostLoadInProgress, isPrimaryResourceSet, isReadOnly, isResourceActivated, isResourceConflict, isResourceDemandLoaded, isResourceLoaded, isScrollableMessageDelegateAvailable, isShowCanonicalValidationMessages, isSuppressModifiedFlagUpdates, isSuppressPostLoad, isTransactionInProgress, isValid, isValid, loadResource, loadResource, loadResource, newInstance, noOperation, postLoad, postMethod, postMethod, postsave, preMethod, presave, redo, reloadResource, remapResource, remapResource, removeBatchedModelListener, removeLowLevelModelListener, removeModelListener, removeResource, removeResourceListener, removeView, renameResource, rollbackTransaction, saveAll, saveResource, setAnnotation, setAPIContextObject, setAPIState, setBuildNumber, setEditingDomain, setInhibitNotification, setLocale, setMajorServiceNumber, setMajorVersionNumber, setMessageBoxDelegate, setMinorServiceNumber, setMinorVersionNumber, setModelAPIState, setModelListeners, setPassive, setPersistenceServicesDelegate, setPostLoadInProgress, setPreferencesDelegate, setPrimaryResource, setReadOnly, setScrollableMessageDelegate, setSupportedLocales, setSuppressBrokenLinkValidation, setSuppressModifiedFlagUpdates, setSuppressPostLoad, setSuppressValidation, setUserInterfaceInfoDelegate, undo, unloadResource, validate, validateLicense`

- - ### Method Detail

    - #### clearCache

          void clearCache()

      Clear the metadata.

    - #### getAllColumnNames

          java.util.ArrayList getAllColumnNames(java.lang.String astrTableName)

      Return a list of all column names of the specified table.
      Parameters:
        `astrTableName` - Fully-qualified name of database table.
      Returns:
        ArrayList of database column names belonging to the specified table.

    - #### getAllTableNames

          java.util.ArrayList getAllTableNames()

      Return a list of fully-qualified table names.
      Returns:
        ArrayList of fully-qualified table names.

    - #### getAllForeignKeyNames

          java.util.ArrayList getAllForeignKeyNames(java.lang.String astrTableName)

      Return a list of all foreign key names (foreign keys that *point* to this table, not foreign keys defined for this table). The foreign key names will be sorted in alphabetical order.
      Parameters:
        `astrTableName` - Fully-qualified name of database table.
      Returns:
        ArrayList of database column names belonging to the specified table.

    - #### getColumnNamesForTypes

          java.util.ArrayList getColumnNamesForTypes(java.lang.String astrTableName,
                                                   java.util.List aListJdbcDataTypes)

      Return a list of column names belonging to the specified table that have the specified JDBC data type(s).
      Parameters:
        `astrTableName` - Fully-qualified name of database table.
        `aListJdbcDataTypes` - List of JDBC data types.
      Returns:
        ArrayList of database column names.

    - #### getJdbcDataType

          java.lang.String getJdbcDataType(java.lang.String astrTableName,
                                         java.lang.String astrColumnName)

      Get the JDBC data type for a given database table name and column name.
      Parameters:
        `astrTableName` - Fully-qualified name of database table.
        `astrColumn` - Name of database column.
      Returns:
        JDBC data type (e.g., "VARCHAR") or `null`.

    - #### getSqlDataType

          java.lang.String getSqlDataType(java.lang.String astrTableName,
                                        java.lang.String astrColumnName)

      Get the SQL data type for a given database table name and column name.
      Parameters:
        `astrTableName` - Fully-qualified name of database table.
        `astrColumn` - Name of database column.
      Returns:
        SQL data type (e.g., "LONGVARCHAR") or `null`.

    - #### getColumnSize

          int getColumnSize(java.lang.String astrTableName,
                          java.lang.String astrColumnName)

      Given a table name and column name, return the column size as specified in the database metadata or -1 if no information is available.
      Parameters:
        `astrTableName` - Fully-qualified table name.
        `astrColumnName` - Column name.
      Returns:
        Column size as specified in database metadata.

    - #### getDecimalDigits

          int getDecimalDigits(java.lang.String astrTableName,
                             java.lang.String astrColumnName)

      Given a table name and column name, return the number of decimal digits specified in the database metadata or -1 if no information is available.
      Parameters:
        `astrTableName` - Fully-qualified table name.
        `astrColumnName` - Column name.
      Returns:
        Number of decimal digits specified in database metadata.

    - #### findColumnMetadata

          com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.ColumnMetadata findColumnMetadata(java.lang.String astrTableName,
                                                                                                           java.lang.String astrColumnName)

      Return the specified ColumnMetadata object instance.
      Parameters:
        `astrTableName` - Fully-qualified table name.
        `astrColumnName` - Column name.
      Returns:
        ColumnMetadata instance matching the specified name.

    - #### findDatabaseAccess

          com.corticon.rulesemf.canonicalvocabularymodel.DatabaseAccess findDatabaseAccess()

      Finder for DatabaseAccess instance.
      Returns:
        Instance of DatabaseAccess.

    - #### findDatabaseMetadata

          com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.DatabaseMetadata findDatabaseMetadata()

      Finder for DatabaseMetadata anchor.
      Returns:
        Instance of DatabaseMetadata.

    - #### findForeignKeyMetadata

          com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.ForeignKeyMetadata findForeignKeyMetadata(java.lang.String astrTableName,
                                                                                                                   java.lang.String astrForeignKeyName)

      Return the specified foreign key metadata object instance.
      Parameters:
        `astrTableName` - Fully-qualified table name.
        `astrForeignKeyName` - Foreign key name.
      Returns:
        ForeignKeyMetadata instance matching the specified key.

    - #### findPrimaryKeyMetadata

          com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.PrimaryKeyMetadata findPrimaryKeyMetadata(java.lang.String astrTableName,
                                                                                                                   java.lang.String astrPrimaryKeyName)

      Return the specified primary key metadata object instance.
      Parameters:
        `astrTableName` - Fully-qualified table name.
        `astrPrimaryKeyName` - Primary key name.
      Returns:
        PrimaryKeyMetadata instance matching the specified key.

    - #### findTableMetadata

          com.corticon.rulesemf.canonicalvocabularymodel.metadata.database.TableMetadata findTableMetadata(java.lang.String astrTableName)

      Return the specified TableMetadata object instance.
      Parameters:
        `astrTableName` - Fully-qualified table name.
      Returns:
        TableMetadata instance matching the specified name.

    - #### getJoinExpressionsStandard

          java.util.List getJoinExpressionsStandard(java.lang.String astrTableSource,
                                                  java.lang.String astrTableTarget)

      Return join expressions appropriate for one-to-one or one-to-many associations. Given a source and target table name, this function will return a list containing the join expression(s) that identify the foreign key relationship(s) between them, traversing from the source table to the target table.

      In a one-to-many association, the source table is assumed to contain the primary key and the target table is assumed to contain the foreign key (for one-to-one associations, this distinction is not important).

      The join expressions will be returned as shown in this example:
      {CORTICON.CUSTOMER.NAME=PRODUCTORDER.FK_NAME, CORTICON.CUSTOMER.ADDRESS=PRODUCTORDER.FK_ADDRESS, CORTICON.CUSTOMER.SSNO=PRODUCTORDER.FK_SSNO}
      Parameters:
        `astrTableSource` - Fully-qualified name of source database table.
        `astrTableTarget` - fully-qualified name of target database table.
      Returns:
        List of all valid join expressions connecting source and target tables.

    - #### getJoinExpressionsInverse

          java.util.List getJoinExpressionsInverse(java.lang.String astrSourceTable,
                                                 java.lang.String astrTargetTable)

      Given a source and target table, return a list of inverse join expressions. The join expressions will be valid traversal paths from target to source.
      Parameters:
        `astrSourceTable` - Fully-qualified source table (i.e., target of inverse expressions).
        `astrTargetTable` - Fully-qualified target table (i.e., source of inverse expressions).
      Returns:
        List of inverse join expressions.

    - #### getJoinExpressionsManyToMany

          java.util.List getJoinExpressionsManyToMany(java.lang.String astrTableSource,
                                                    java.lang.String astrTableTarget)

      Return join expressions appropriate for many-to-many associations. Such join expressions involve an "intersection" (middle) table as shown in this example:
      {CORTICON.CUSTOMER.ID = CORTICON.CUSTOMER_ADDRESS.FK_CUSTOMER_ID, CORTICON.CUSTOMER_ADDRESS.FK_ADDRESS_ID = CORTICON.ADDRESS.ID}
      This process analyzes the foreign key references of the source and target tables to locate any table(s) they share in common. If such common table(s) can be found, this method builds one or more join expressions that traverse from source to intersection to target.
      Parameters:
        `astrTableSource` - Fully-qualified name of source database table.
        `astrTableTarget` - Fully-qualified name of target database table.
      Returns:
        List of all valid join expressions connecting source and target tables.

    - #### getPrimaryKeyColumnNames

          java.util.ArrayList getPrimaryKeyColumnNames(java.lang.String astrTableName)

      Return a sorted list of the primary key column names for a given table name.
      Parameters:
        `astrTableName` - Fully-qualified table name.
      Returns:
        ArrayList of primary key column names.

    - #### isEmpty

          boolean isEmpty()

      Determine whether the metadata cache is empty (i.e., database contains zero tables).
      Returns:
        `true` if loaded but table count is empty.

    - #### isForeignKeyColumn

          boolean isForeignKeyColumn(java.lang.String astrTableName,
                                   java.lang.String astrColumnName)

      Determine whether the specified table and column name are part of a foreign key.
      Parameters:
        `astrTableName` - Table Name.
        `astrColumnName` - Column Name.
      Returns:
        `true` if the column is part of a foreign key.

    - #### isMetadataLoaded

          boolean isMetadataLoaded()

      Determine whether any metadata has been loaded.
      Returns:
        `true` if metadata is present.

    - #### isTable

          boolean isTable(java.lang.String astrName)

      Determine whether the specified name is a database table.
      Parameters:
        `astrName` - Fully-qualified name of either table or view.
      Returns:
        `true` if name is a table.

    - #### isView

          boolean isView(java.lang.String astrName)

      Determine whether the specified name is a database view.
      Parameters:
        `astrName` - Fully-qualified name of either table or view.
      Returns:
        `true` if name is a table.

    - #### isSequence

          boolean isSequence(IEntity aEntity,
                           java.lang.String astrName)

      Determine whether the specified name is a database sequence.
      Parameters:
        `aEntity` - Name of an entity the sequence belongs to
        `astrName` - Name of a sequence.
      Returns:
        `true` if name is a sequence.

    - #### isValidColumn

          boolean isValidColumn(java.lang.String astrTableName,
                              java.lang.String astrColumnName)

      Determine whether the specified column name is valid (i.e., whether there is any metadata present that describes the column).
      Parameters:
        `astrTableName` - Fully-qualified name of the database table.
        `astrColumnName` - Name of the database column.
      Returns:
        `true` if metadata is available.

    - #### isValidTable

          boolean isValidTable(java.lang.String astrTableName)

      Determine whether the specified table name is valid (i.e., whether there is any metadata present that describes the table).
      Parameters:
        `astrTableName` - Fully-qualified name of the database table.
      Returns:
        `true` if metadata is available.

    - #### load

          boolean load()

      Load all metadata from a database connection using connection properties defined in the DatabaseAccess EMF object.
      Returns:
        `true` if metadata was successfully loaded.

    - #### parseJoinExpression

          JoinExpression parseJoinExpression(java.lang.String astrJoinExpression,
                                           java.lang.String astrSourceTableName,
                                           java.lang.String astrTargetTableName,
                                           boolean abManyToMany,
                                           boolean abPerformSemanticAnalysis)

      Parse a given join expression to construct an object representation then optionally perform semantic analysis if the database metadata is available. The object representation of the join expression consists of instance of the following classes:
      JoinExpression - Anchor for the join expression JoinReference - Contains source and target column names
      Both parsing and semantic analysis may generate messages which are anchored within the JoinExpression.
      Parameters:
        `astrJoinExpression` - Join expression (string).
        `astrSourceTableName` - Fully-qualified source table name.
        `astrTargetTableName` - Fully-qualified target table name.
        `abManyToMany` - `true` if join expression describes many-to-many association.
        `abPerformSemanticAnalysis` - `true` to check join expression against metadata.
      Returns:
        JoinExpression instance.

    - #### setVocabularyModelAPI

          void setVocabularyModelAPI(IVocabularyModelAPI aIVocabularyModelAPI)

      Setter for reference to Vocabulary model API (required).
      Parameters:
        `aIVocabularyModelAPI` - Vocabulary model API instance.

    - #### testConnection

          boolean testConnection(boolean abSilent)

      Test the current database connection and may optionally display a message box to indicate whether the test was successful.
      Parameters:
        `abSilent` - `true` to suppress message "connection successful" message box.
      Returns:
        `true` if connection was successful.

    - #### getSQLKeywords

          java.util.List<java.lang.String> getSQLKeywords()

      Get a list of SQL keywords from the current database connection. This list includes the SQL 2003 keywords and any other keywords supported by the specific database being used.
      Returns:
        List of keywords as a list, if the metadata is available; `null` otherwise

Copyright © 2005-2013 Progress Software Corporation and/or its subsidiaries and affiliates. All rights reserved.