## org.eclipse.datatools.sqltools.sql.util
Class ModelUtil

    java.lang.Object
      org.eclipse.datatools.sqltools.sql.util.ModelUtil

    public class ModelUtil

extends java.lang.Object

Utility class to resolve the SQL model object relationships or convert SQL model into classes required by SQL Dev Tools.

Author:
  Hui Cao

Field Summary
`static java.lang.String` `EVENT_FOLDER_CLASS`

Constructor Summary
`ModelUtil()`

Method Summary
`static boolean` `equals(java.lang.String object1, java.lang.String object2, boolean caseSensitive)`
`static boolean` `equalsIgnoreNull(java.lang.String object1, java.lang.String object2, boolean caseSensitive)` Compares the two strings for equality.
`static SQLObject` `findProceduralObject(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)`
`static SQLObject` `findProceduralObject(org.eclipse.datatools.sqltools.core.ProcIdentifier proc, boolean refresh)`
`static SQLObject` `findProceduralObject(org.eclipse.datatools.sqltools.core.ProcIdentifier proc, boolean refresh, boolean caseSensitive)`
`static SQLObject` `findProceduralObject(org.eclipse.datatools.sqltools.core.ProcIdentifier proc, boolean refresh, boolean caseSensitive, boolean ignoreTableName)`
`static Schema` `findSchema(Database database, java.lang.String catalogName, java.lang.String schemaName)` Returns the schema object with the given name
`static Table` `findTableInAllSchemas(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid, java.lang.String dbname, java.lang.String tableName, boolean caseSensitive, boolean refresh)`
`static Table` `findTableObject(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid, java.lang.String dbname, java.lang.String schemaName, java.lang.String tableName)` This method is used to find the table object in existing SQL model.
`static Table` `findTableObject(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid, java.lang.String dbname, java.lang.String schemaName, java.lang.String tableName, boolean refresh)` This method is used to find the table object in existing SQL model.
`static Table` `findTableObject(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid, java.lang.String dbname, java.lang.String schemaName, java.lang.String tableName, boolean refresh, boolean caseSensitive)` This method is used to find the table object in existing SQL model.
`static Table` `findTableObject(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid, java.lang.String dbname, java.lang.String schemaName, java.lang.String tableName, boolean refresh, boolean caseSensitive, boolean findInAllCatalogs)` This method is used to find the table object in existing SQL model.
`static java.util.List` `getAuthorizationIdentifiers(SQLObject obj)` Returns all the authorization identifiers
`static Catalog` `getCatalog(org.eclipse.emf.ecore.EObject obj)` Returns the database name by taking catalog into account.
`static IConnectionProfile` `getConnectionProfile(Database database)`
`static Database` `getDatabase(Schema schema)`
`static DatabaseDefinition` `getDatabaseDefinition(SQLObject obj)`
`static java.lang.String` `getDatabaseName(org.eclipse.emf.ecore.EObject obj)` Returns the database name by taking catalog into account.
`static org.eclipse.datatools.sqltools.core.DatabaseVendorDefinitionId` `getDatabaseVendorDefinitionId(SQLObject obj)`
`static Schema` `getSchema(org.eclipse.emf.ecore.EObject obj)` Returns the schema by looking up parent in the containment service.
`static java.lang.String` `getSchemaName(org.eclipse.emf.ecore.EObject obj)` Returns the schema name by looking up parent in the containment service.
`static org.eclipse.emf.common.util.EList` `getSchemas(Database database, java.lang.String catalogName)` Returns the schema list for the database, or, if catalog feature is supported, returns the schema list for the default catalog.
`static IDatatype` `map(DatabaseDefinition databaseDefinition, DataType type, java.lang.String owner)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EVENT_FOLDER_CLASS

    public static final java.lang.String EVENT_FOLDER_CLASS

See Also:
  Constant Field Values

Constructor Detail

### ModelUtil

    public ModelUtil()

Method Detail

### map

    public static IDatatype map(DatabaseDefinition databaseDefinition,
                                DataType type,
                                java.lang.String owner)

### findProceduralObject

    public static SQLObject findProceduralObject(org.eclipse.datatools.sqltools.core.ProcIdentifier proc)

### getDatabase

    public static Database getDatabase(Schema schema)

### getDatabaseName

    public static java.lang.String getDatabaseName(org.eclipse.emf.ecore.EObject obj)

  Returns the database name by taking catalog into account.

  Parameters:
    `obj` -
  Returns:

### getCatalog

    public static Catalog getCatalog(org.eclipse.emf.ecore.EObject obj)

  Returns the database name by taking catalog into account.

  Parameters:
    `obj` -
  Returns:

### getSchemaName

    public static java.lang.String getSchemaName(org.eclipse.emf.ecore.EObject obj)

  Returns the schema name by looking up parent in the containment service.

  Parameters:
    `` -
  Returns:

### getSchema

    public static Schema getSchema(org.eclipse.emf.ecore.EObject obj)

  Returns the schema by looking up parent in the containment service.

  Parameters:
    `` -
  Returns:

### getConnectionProfile

    public static IConnectionProfile getConnectionProfile(Database database)

### getSchemas

    public static org.eclipse.emf.common.util.EList getSchemas(Database database,
                                                               java.lang.String catalogName)

  Returns the schema list for the database, or, if catalog feature is supported, returns the schema list for the default catalog.

  Parameters:
    `database` -
    `catalogName` - uses same convention as JDBC DatabaseMetaData: null returns all schema; catalog name returns schema for the specified catalog; empty string returns schema not associated with a specific catalog (use for DBs that do not support catalogs)
  Returns:

### findSchema

    public static Schema findSchema(Database database,
                                    java.lang.String catalogName,
                                    java.lang.String schemaName)

  Returns the schema object with the given name

### getDatabaseDefinition

    public static DatabaseDefinition getDatabaseDefinition(SQLObject obj)

### getDatabaseVendorDefinitionId

    public static org.eclipse.datatools.sqltools.core.DatabaseVendorDefinitionId getDatabaseVendorDefinitionId(SQLObject obj)

### getAuthorizationIdentifiers

    public static java.util.List getAuthorizationIdentifiers(SQLObject obj)

  Returns all the authorization identifiers

  Parameters:
    `authid` -
    `obj` - used to locate the catalog or database
  Returns:

### findTableObject

    public static Table findTableObject(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid,
                                        java.lang.String dbname,
                                        java.lang.String schemaName,
                                        java.lang.String tableName)

  This method is used to find the table object in existing SQL model.

  Parameters:
    `dbid` -
    `dbname` -
    `schemaName` -
    `tableName` -
  Returns:

### findTableObject

    public static Table findTableObject(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid,
                                        java.lang.String dbname,
                                        java.lang.String schemaName,
                                        java.lang.String tableName,
                                        boolean refresh)

  This method is used to find the table object in existing SQL model. Attention: the method does not support ASE non-sharable temp table.

  Parameters:
    `dbid` - Database identifier
    `dbname` - Database name
    `schemaName` - Schema name
    `tableName` - Table name
    `refresh` - Refresh
  Returns:

### findTableObject

    public static Table findTableObject(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid,
                                        java.lang.String dbname,
                                        java.lang.String schemaName,
                                        java.lang.String tableName,
                                        boolean refresh,
                                        boolean caseSensitive)

  This method is used to find the table object in existing SQL model. Attention: the method does not support ASE non-sharable temp table.

  Parameters:
    `dbid` - Database identifier
    `dbname` - Database name
    `schemaName` - Schema name
    `tableName` - Table name
    `refresh` - Refresh
    `casesensivie` - Case sensitive when compare two objects
  Returns:

### findTableObject

    public static Table findTableObject(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid,
                                        java.lang.String dbname,
                                        java.lang.String schemaName,
                                        java.lang.String tableName,
                                        boolean refresh,
                                        boolean caseSensitive,
                                        boolean findInAllCatalogs)

  This method is used to find the table object in existing SQL model. Attention: the method does not support ASE non-sharable temp table.

  Parameters:
    `dbid` - Database identifier
    `dbname` - Database name
    `schemaName` - Schema name
    `tableName` - Table name
    `refresh` - Refresh
    `casesensivie` - Case sensitive when compare two objects
    `findInAllCatalogs` - if true, find the table in all catalogs; otherwise just in current catalog
  Returns:

### findTableInAllSchemas

    public static Table findTableInAllSchemas(org.eclipse.datatools.sqltools.core.DatabaseIdentifier dbid,
                                              java.lang.String dbname,
                                              java.lang.String tableName,
                                              boolean caseSensitive,
                                              boolean refresh)

### findProceduralObject

    public static SQLObject findProceduralObject(org.eclipse.datatools.sqltools.core.ProcIdentifier proc,
                                                 boolean refresh)

  Parameters:
    `proc` -
    `refresh` - Whether to refresh the procedural object's parent folder
  Returns:

### findProceduralObject

    public static SQLObject findProceduralObject(org.eclipse.datatools.sqltools.core.ProcIdentifier proc,
                                                 boolean refresh,
                                                 boolean caseSensitive)

  Parameters:
    `proc` -
    `refresh` - Whether to refresh the procedural object's parent folder
  Returns:

### findProceduralObject

    public static SQLObject findProceduralObject(org.eclipse.datatools.sqltools.core.ProcIdentifier proc,
                                                 boolean refresh,
                                                 boolean caseSensitive,
                                                 boolean ignoreTableName)

  Parameters:
    `proc` -
    `refresh` - Whether to refresh the procedural object's parent folder
  Returns:

### equals

    public static boolean equals(java.lang.String object1,
                                 java.lang.String object2,
                                 boolean caseSensitive)

### equalsIgnoreNull

    public static boolean equalsIgnoreNull(java.lang.String object1,
                                           java.lang.String object2,
                                           boolean caseSensitive)

  Compares the two strings for equality. If either is `null` the result is `true`.

  Parameters:
    `object1` - Thing 1
    `object2` - Thing 2
    `caseSensitive` - Specifies whether the comparison is case sensitive.
  Returns:
    `true` if the strings are equal or if either is `null`, `false` otherwise.