Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.ide.db.model
Class DBObjectNodeUtil

java.lang.Object
  extended by oracle.ide.db.model.DBObjectNodeUtil

public final class DBObjectNodeUtil
extends java.lang.Object

Utility methods for dealing with DBObjectNode instances. The various methods can make the job of handling DnD of nodes easier by providing quick test methods to see if the object in question is a valid node that matches a given object type. Specific tests are also provided for Relations as they could be objects of a number of types.


Method Summary
static DBObjectProvider findProvider(java.lang.Object node)
          Attempts to locate a DBObjectProvider for the given node.
static java.lang.String getConnectionName(java.lang.Object node)
          Returns the name of the connection if it is retrievable from the given object (node).
static
<T extends Element>
T
getElementOfType(Element elem, java.lang.Class<T> clz)
          Tests the given element to see if it is of the given element class and returns it.
static java.lang.Object getProviderIdentifier(java.lang.Object node)
          If the given node is recognizable as representing a DBObjectProvider (or object therein) this will return the type of that provider.
static java.lang.String getProviderType(java.lang.Object node)
          If the given node is recognizable as representing a DBObjectProvider (or object therein) this will return the type of that provider.
static Schema getSchema(DBObjectTypeNode node, boolean defaultIfNone)
          Gets the schema for the given node.
static java.lang.String getSchemaName(DBObjectTypeNode node)
          Gets the schema name for the given type node, working around any irregularities in the navigator.
static
<T extends Element>
T
getSelectedElement(Context context, java.lang.Class<T> clz)
          Inspects the selection of the given context.
static java.lang.String getStoreName(java.lang.Object node)
          Returns the name of the store if it is retrievable from the given object (node).
static boolean isConnectionNode(java.lang.Object node)
          Tests whether the the given element represents an online database connection.
static boolean isNodeOfType(java.lang.String type, java.lang.Object node)
          Returns true if the given object is a valid DBObjectNode that contains an object with the given type.
static boolean isOnlineNode(java.lang.Object node)
          Returns true if the given object is a valid DBObjectNode that has come from a live (online) database connection.
static boolean isOnlineNodeOfType(java.lang.String type, java.lang.Object node)
          Returns true if the given object is a valid DBObjectNode that contains an object with the given type AND that object has come from a live (online) database connection.
static boolean isOnlineRelationNode(java.lang.Object node)
          Returns true if the given object is a valid DBObjectNode that contains a Relation object (i.e.
static boolean isOnlineRelationNode(java.lang.Object node, boolean unwrapSynonym)
          Returns true if the given object is a valid DBObjectNode that contains a Relation object (i.e.
static boolean isRelationNode(java.lang.Object node)
          Returns true if the given object is a valid DBObjectNode that contains a Relation object (i.e.
static boolean isRelationNode(java.lang.Object node, boolean unwrapSynonym)
          Returns true if the given object is a valid DBObjectNode that contains a Relation object (i.e.
static boolean isSynonymNode(java.lang.Object node)
           
static java.lang.String normalizeType(DBObjectTypeNode node)
          Normalizes the object type for the given type node to workaround problems with the Database Navigator and PUBLIC synonyms and db links.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findProvider

public static DBObjectProvider findProvider(java.lang.Object node)
Attempts to locate a DBObjectProvider for the given node. For database connections, if the connection to the database has not yet been made, this method will not connect and therefore return null.

Parameters:
node - the navigator node to inspect
Returns:
a DBObjectProvider if the given node implements any of the recongnized interfaces in this package that can identify a DBObjectProvider (or Database).
See Also:
DBObjectProviderNode, DatabaseNode

getProviderType

public static java.lang.String getProviderType(java.lang.Object node)
If the given node is recognizable as representing a DBObjectProvider (or object therein) this will return the type of that provider.


getProviderIdentifier

public static java.lang.Object getProviderIdentifier(java.lang.Object node)
If the given node is recognizable as representing a DBObjectProvider (or object therein) this will return the type of that provider.


isConnectionNode

public static boolean isConnectionNode(java.lang.Object node)
Tests whether the the given element represents an online database connection. THe connection may or may not be connected - use findProvider(java.lang.Object) to test whether it is connected.


isNodeOfType

public static boolean isNodeOfType(java.lang.String type,
                                   java.lang.Object node)
Returns true if the given object is a valid DBObjectNode that contains an object with the given type.

Parameters:
type - the type of object we're looking for
node - the node to test for the object
Returns:
true if there's a match.

isOnlineNodeOfType

public static boolean isOnlineNodeOfType(java.lang.String type,
                                         java.lang.Object node)
Returns true if the given object is a valid DBObjectNode that contains an object with the given type AND that object has come from a live (online) database connection.

Parameters:
type - the type of object we're looking for
node - the node to test for the object
Returns:
true if there's a match.

isOnlineNode

public static boolean isOnlineNode(java.lang.Object node)
Returns true if the given object is a valid DBObjectNode that has come from a live (online) database connection.

Parameters:
node - the node to test for the object
Returns:
true if there's a match.

isRelationNode

public static boolean isRelationNode(java.lang.Object node)
Returns true if the given object is a valid DBObjectNode that contains a Relation object (i.e. Table, View or Materialized View).

Parameters:
node - the node to test for a Relation
Returns:
true if there's a match.
See Also:
isNodeOfType(java.lang.String, java.lang.Object)

isRelationNode

public static boolean isRelationNode(java.lang.Object node,
                                     boolean unwrapSynonym)
Returns true if the given object is a valid DBObjectNode that contains a Relation object (i.e. Table, View or Materialized View).

Parameters:
node - the node to test for a Relation
unwrapSynonym - resolve referenced object for Synonyms
Returns:
true if there's a match.
See Also:
isNodeOfType(java.lang.String, java.lang.Object)

isSynonymNode

public static boolean isSynonymNode(java.lang.Object node)

isOnlineRelationNode

public static boolean isOnlineRelationNode(java.lang.Object node)
Returns true if the given object is a valid DBObjectNode that contains a Relation object (i.e. Table, View or Materialized View) AND that Relation has come from a live (online) database connection.

Parameters:
node - the node to test for a Relation
Returns:
true if there's a match.
See Also:
isOnlineNodeOfType(java.lang.String, java.lang.Object)

isOnlineRelationNode

public static boolean isOnlineRelationNode(java.lang.Object node,
                                           boolean unwrapSynonym)
Returns true if the given object is a valid DBObjectNode that contains a Relation object (i.e. Table, View or Materialized View) AND that Relation has come from a live (online) database connection.

Parameters:
node - the node to test for a Relation
unwrapSynonym - resolve referenced object for Synonyms
Returns:
true if there's a match.
See Also:
isOnlineNodeOfType(java.lang.String, java.lang.Object)

getStoreName

public static java.lang.String getStoreName(java.lang.Object node)
Returns the name of the store if it is retrievable from the given object (node). This is not a full proof way of getting a store because some Views have an implicit store.

Parameters:
node - the node to to check
Returns:
the name of the store if implied by the node
See Also:
DatabaseConnectionStores.getCurrentStore()

getConnectionName

public static java.lang.String getConnectionName(java.lang.Object node)
Returns the name of the connection if it is retrievable from the given object (node).

Parameters:
node - the node to to check
Returns:
the name of the store if implied by the node
See Also:
DatabaseConnectionStores.getCurrentConnection(oracle.ide.Context)

getSelectedElement

public static <T extends Element> T getSelectedElement(Context context,
                                                       java.lang.Class<T> clz)
Inspects the selection of the given context. If the selection is a single Element that is an implementation of the given class then that Element is returned, else null is returned.

Parameters:
context - the context to look at the selection of
clz - the class of Element to look for
Returns:
an Element of the given clz if the context's selection contains only one element of that class.
See Also:
getElementOfType(oracle.ide.model.Element, java.lang.Class)

getElementOfType

public static <T extends Element> T getElementOfType(Element elem,
                                                     java.lang.Class<T> clz)
Tests the given element to see if it is of the given element class and returns it. This works with composite elements as well, so if the element is composite, its composite elements will also be tested.

Parameters:
elem - the element to test
clz - the class of Element to look for
Returns:
an Element (either elem or a composite of elem) that matches the given clz, or null if none is found.

getSchema

public static Schema getSchema(DBObjectTypeNode node,
                               boolean defaultIfNone)
Gets the schema for the given node. Optionally returns the default schema for the provider the node is in if the schema for the node cannot be determined.

Parameters:
node - the node to get the Schema for
defaultIfNone - whether to default to the default schema if the node's schema cannot be determined
Returns:
the nodes (or the default) Schema, or null if the provider or its schemas cannot be found.

getSchemaName

public static java.lang.String getSchemaName(DBObjectTypeNode node)
Gets the schema name for the given type node, working around any irregularities in the navigator.


normalizeType

public static java.lang.String normalizeType(DBObjectTypeNode node)
Normalizes the object type for the given type node to workaround problems with the Database Navigator and PUBLIC synonyms and db links.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.