Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

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 java.lang.String decode(java.lang.String name, boolean store)
          Decodes the given String to get out the connection name (or alternatively store name).
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 Schema getSchema(DBObjectTypeNode node, boolean defaultIfNone)
          Gets the schema for the given node.
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 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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)

decode

public static java.lang.String decode(java.lang.String name,
                                      boolean store)
Decodes the given String to get out the connection name (or alternatively store name). If the decoded string contains a '#' it is assumed that the store name preceeds it, and the connection name follows it.

Parameters:
name - the string to decode
store - if true, on decoding the string the store name is returned.
Returns:

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.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

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