Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.quantum
Class ExternalInterface

    java.lang.Object
      com.quantum.ExternalInterface

public class ExternalInterface
extends java.lang.Object

Author:
  Julen

Constructor Summary
`ExternalInterface()`

Method Summary
`static java.sql.Connection` | `connectBookmark(java.lang.String bookmarkName, org.eclipse.swt.widgets.Shell shell)`
`static void` | `displayTable(java.lang.String bookmarkName, java.lang.String tableName)` Displays a table or view in the Table View of Quantum
`static java.lang.String[]` | `getBookmarkNames()`
`static java.lang.String[]` | `getDatabaseObjectNames(java.lang.String bookmarkName, java.lang.String schema, java.lang.String[] types, java.lang.String tableNamePrefix)` Returns an array of strings with a list of objects of the database refered by a bookmark.
`static java.lang.String[][]` | `getDataFromResultSet(int i)`
`static java.lang.String[]` | `getMatchingColumnNames(java.lang.String schemaName, java.lang.String bookmarkName, java.lang.String columnPrefix, java.lang.String tableName, boolean qualified)`
`static java.lang.String[]` | `getMatchingTableNames(java.lang.String schemaName, java.lang.String bookmarkName, java.lang.String namePrefix, java.lang.String[] types, boolean qualified)`
`static int` | `getNumberOfResultSets()`
`static boolean` | `isBookmarkConnected(java.lang.String bookmarkName)` This function tells us if the bookmark is connected.
`static boolean` | `isBookmarkInQuantum(java.lang.String bookmarkName)`
`static java.lang.String` | `xmlToString(org.w3c.dom.Node node)`

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

Constructor Detail

### ExternalInterface

    public ExternalInterface()

Method Detail

### getBookmarkNames

    public static java.lang.String[] getBookmarkNames()

  Returns:
    An array of strings with a list of the names of the bookmarks defined in the Quantum Plugin, in no particular order. There should be no duplicates, although case-sensitiveness apply.

### isBookmarkInQuantum

    public static boolean isBookmarkInQuantum(java.lang.String bookmarkName)

  Parameters:
    `bookmarkName` - The name of the bookmark
  Returns:
    true if the Bookmark name exists in Quantum, false if not. Search is case-sensitive.

### isBookmarkConnected

    public static boolean isBookmarkConnected(java.lang.String bookmarkName)

  This function tells us if the bookmark is connected. A non connected bookmark cannot give us information like the table names.

  Parameters:
    `bookmarkName` - The name of the bookmark
  Returns:
    true if the bookmark is connected, false if not.

### connectBookmark

    public static java.sql.Connection connectBookmark(java.lang.String bookmarkName,
                                                      org.eclipse.swt.widgets.Shell shell)

  Parameters:
    `bookmarkName` - The name of the bookmark
    `shell` - A shell object to communicate with the user interface. That's needed because the connection can ask the user for a password.
  Returns:
    The new connection if successful, null if not.

### getDatabaseObjectNames

    public static java.lang.String[] getDatabaseObjectNames(java.lang.String bookmarkName,
                                                            java.lang.String schema,
                                                            java.lang.String[] types,
                                                            java.lang.String tableNamePrefix)

  Returns an array of strings with a list of objects of the database refered by a bookmark. You should check that the bookmark is connected using the `isBookmarkConnected()` function, as nothing will be returned if not.

  Parameters:
    `bookmarkName` - The name of the bookmark
    `schema` - The name of the schema to limit the search. Null if we want all the schemas.
    `types` - The types to query the database for. Usually "TABLE", "VIEW", "SEQUENCE", "PROCEDURE"
    `tableNamePrefix` - An optional prefix to select the tables. Null if we want all.
  Returns:
    An array of Strings with the names of the objects. Null if the bookmarkString does not match any bookmark, or other errors.

### getMatchingColumnNames

    public static java.lang.String[] getMatchingColumnNames(java.lang.String schemaName,
                                                            java.lang.String bookmarkName,
                                                            java.lang.String columnPrefix,
                                                            java.lang.String tableName,
                                                            boolean qualified)
                                                     throws com.quantum.util.connection.NotConnectedException

  Parameters:
    `schemaName` - Optional schema name. If null, search all schemas. If empty string, search tables without schema.
    `bookmarkName` - Bookmark name. The name of an existing and connected bookmark in Quantum. If not connected throws NotConnectedException. If not existing returns null.
    `columnPrefix` - Optional column prefix. Will return only those columns that begin with the prefix. If null or empty string return all columns
    `tableName` - Optional table name. If null will return all columns.
    `qualified` - true if the column names must be returned qualified by its table name, in the form "table.column".
  Returns:
    An array of the names of the columns that match the columnPrefix, in the specified table and schema if not null. null if the bookmark does not exist, empty array if there are no columns that match the conditions
  Throws:
    `com.quantum.util.connection.NotConnectedException` - If the bookmark is not connected

### getMatchingTableNames

    public static java.lang.String[] getMatchingTableNames(java.lang.String schemaName,
                                                           java.lang.String bookmarkName,
                                                           java.lang.String namePrefix,
                                                           java.lang.String[] types,
                                                           boolean qualified)
                                                    throws com.quantum.util.connection.NotConnectedException

  Parameters:
    `schemaName` - Optional schema name. If null, search all schemas. If empty string, search tables without schema.
    `bookmarkName` - Bookmark name. The name of an existing and connected bookmark in Quantum. If not connected throws NotConnectedException. If not existing returns null.
    `namePrefix` - Optional column prefix. Will return only those columns that begin with the prefix. If null or empty string return all columns
    `types` - String array with the types to select. Typical types are "TABLE", "VIEW". If null, it's same as using `new String[] {"TABLE", "VIEW"}`
    `qualified` - true if the table names must be returned qualified by its schema name, in the form "schema.table".
  Returns:
    An array of the names of the tables that match the namePrefix, in the specified schema if not null. null if the bookmark does not exist, empty array if there are no tables that match the conditions
  Throws:
    `com.quantum.util.connection.NotConnectedException` - If the bookmark is not connected

### displayTable

    public static void displayTable(java.lang.String bookmarkName,
                                    java.lang.String tableName)
                             throws com.quantum.util.connection.NotConnectedException,
                                    java.sql.SQLException

  Displays a table or view in the Table View of Quantum

  Parameters:
    `bookmarkName` - The name of the bookmark where the table or view is
    `tableName` - the name of the table or view
  Throws:
    `com.quantum.util.connection.NotConnectedException` - If the bookmark is not connected.
    `java.sql.SQLException` - If any error accessing the database

### xmlToString

    public static java.lang.String xmlToString(org.w3c.dom.Node node)

  Parameters:
    `node` - The org.w3c.dom.Node to be converted to a string
  Returns:
    A string with the pretty-printed text of the XML Node

### getNumberOfResultSets

    public static int getNumberOfResultSets()

  Returns:
    The number of result sets displayed in the Table View

### getDataFromResultSet

    public static java.lang.String[][] getDataFromResultSet(int i)

  Parameters:
    `i` - The index (from 0 to getNumberOfResultSets()-1) of the result set we want the data from
  Returns:
    A two-dimensional array of Strings holding the data displayed in the Table View for that result set. null if the param i is out of bounds. The resulting matrix has the data stored like data[row][column], both 0-based. For example, to get the value of the second column of the tenth row or the first displayed recordset, we could use: String[][] data = ExternalInterface.getDataFromResultSet(0): String value = data[9][1]; Remember that the data returned is the data displayed, so if you cannot see the data, it won't be available. To get all the data from a recordset, use the "Show All Table Rows" from the Table View, and then get the string array

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD