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

E17493-02

oracle.javatools.db
Interface DBObject

All Superinterfaces:
Copyable, DynamicPropertySet
All Known Subinterfaces:
AliasFragment, BinaryObject, ChildDBObject, DataType, DBObjectUsage, DeclarativePlSql, DeclarativeSQLQuery, FromObjectUsage, JoinCondition, SchemaObject, SourceObject, SQLFragment, SQLQuery, SQLQueryOwner, SystemObject
All Known Implementing Classes:
AbstractAliasFragment, AbstractBuildableObject, AbstractChildDBObject, AbstractDBObject, AbstractDBObjectUsage, AbstractFromObjectUsage, AbstractSchemaObject, AbstractSchemaObjectUsage, AbstractSQLFragment, AbstractSQLQuery, AbstractSystemObject, ArithmeticOperation, AsteriskUsage, AutoExtendProperties, BaseDateTimeDataType, BinaryDataType, CaseStatement, CaseStatement.WhenThen, CharacterDataType, CheckConstraint, Column, ColumnConstraint, ColumnKeywordUsage, ColumnUsage, Comparison, ComplexType, Constraint, DatabaseLink, DataMiningFunction, DataMiningFunction.DataMiningArguments, DataMiningFunction.DataMiningCostValues, DataTypeAttribute, DataTypeSynonym, DataTypeUsage, DateDataType, DBObjectPlSqlFragment, Directory, ExpressionList, FileSpecification, FKConstraint, FKUsage, FromObject, Function, Function, Function, FunctionUsage, GroupByExpression, GroupByObject, HierarchicalQueryObject, Index, IndexObject, IndexPartition, Indextype, Java, JavaClass, JavaResource, JavaSource, JoinObject, LOBDescriptor, MaterializedView, MaterializedViewLog, ModelObject, ModelObject.CellAssignment, ModelObject.CellReferenceOptions, ModelObject.ModelColumnClauses, ModelObject.ModelRulesCellAssignmentExpr, ModelObject.ModelRulesClause, ModelObject.MultiColumnForLoop, ModelObject.ReferenceModel, ModelObject.SingleColumnForLoop, NonDeclarativeSQLQuery, NumericDataType, ObjectType, ObjectTypeUsage, OnJoinCondition, Operation, OracleColumnProperties, OracleExternalTableProperties, OracleExternalTableProperties.LocationSpecifier, OracleIndexOrganizedTableProperties, OracleIndexPartitions, OracleNumberDataType, OracleSQLQuery, OracleStorageProperties, OracleTablePartitions, OracleTablespaceProperties, OrderByObject, Package, Package, PackageBody, PKConstraint, PlSql, PlSqlAttribute, PlSqlAttribute, PlSqlBlock, PlSqlDatatype, PlSqlMethod, PlSqlMethod, PlSqlParameter, PlSqlParameter, PlSqlReference, PlSqlSchemaObject, PlSqlSchemaObjectBody, PlSqlSchemaObjectSpec, PlSqlSubprogram, PlSqlSubProgram, PlSqlUsage, PlSqlVariable, PredefinedDataType, PredefinedDataTypeUsage, Procedure, Procedure, RecycledObject, Relation, RelationUsage, Schema, SelectObject, SelectObjectUsage, Sequence, SetOperation, SetOperator, SimpleSQLFragment, SpecPlSql, Synonym, SynonymUsage, Table, TablePartition, Tablespace, TimeStampTZDataType, Trigger, Trigger, Type, TypeBody, UniqueConstraint, UserDataType, UsingJoinCondition, View, ViewColumn, WhereObject, WindowFunction, WindowFunction.WindowFunctionBound, XMLSchema, XMLSchemaElement, XMLTypeColumnProperties

public interface DBObject
extends Copyable, DynamicPropertySet

Base interface for Database Objects. A database object is not assumed to exist in a database; rather, it is just something that could exist in a database.

Since:
9.0.2

Field Summary
static java.lang.String COMMENT
          The comment property.
 
Method Summary
 DBObject copyTo(DBObject target, boolean temporaryCopy)
          Copies the state of this object to another instance.
 DBObject copyTo(DBObject target, IDPolicy idPolicy)
          Copies the state of this object to another instance.
 java.lang.Object copyTo(java.lang.Object target)
          Implementation of the Copyable interface that copies the state of this DBObject to another instance.
 DBObject findOwnedObject(DBObjectID id)
          Returns a child of this object that has the given ID.
 DBObject findOwnedObject(java.lang.String type, java.lang.String name)
          Returns an object owned by this object with given name and type, if one exists.
 DBObjectID getID()
          Retrieves the object ID associated with this object.
 java.lang.String getName()
          Retrieves the name of this object.
 DBObject[] getOwnedObjects()
          Returns any objects owned by object.
 DBObject[] getOwnedObjects(java.lang.String... type)
          Returns the objects owned by this object of the given type.
 DBObject getParent()
          Returns the parent of this object, if one exists.
 DBObjectID[] getReferenceIDs()
          Returns all the IDs that this object has as properties that reference other DBObjects.
 java.lang.String getType()
          Returns the type of this object.
 boolean replaceReferenceIDs(java.util.Map<DBObjectID,DBObjectID> oldToNew)
          Replaces any reference ids (e.g.
 void setID(DBObjectID id)
          Sets the object ID associated with this object.
 void setName(java.lang.String name)
          Sets the name of this object.
 
Methods inherited from interface oracle.javatools.util.DynamicPropertySet
getProperties, getProperty, getProperty, setProperties, setProperty
 

Field Detail

COMMENT

static final java.lang.String COMMENT
The comment property.

See Also:
Constant Field Values
Method Detail

copyTo

java.lang.Object copyTo(java.lang.Object target)
Implementation of the Copyable interface that copies the state of this DBObject to another instance. If null is specified for the target, a new instance will be created.

The entire state of the object will be copied, with a few exceptions. In particular, any observers registered will NOT be copied. In cases where this instance contains child DBObjects, new instances of those children will be created, and the state copied to them. The copy will thus contain its own unique state; after making the copy, changing one instance will not cause any changes to occur to the copy. The properties will be copied; however, copies will not be made of the values referenced by the properties - thus, the copy will refer to the same instance as the original. Child objects that are copied will still point to the original parent; it is the responsibility of a copied parent to update the parent of copies of its children point to the copy of itself.

If the object, or any child object has an ID set, the equivalent object in the copy will be given a TemporaryObjectID that does not reference back to the original object. See copyTo(DBObject, boolean) for details.

Specified by:
copyTo in interface Copyable
Parameters:
target - The object to copy to. If target is null, a new instance will be created, and the state will be copied to that object.
Returns:
the copy.
Throws:
java.lang.ClassCastException - if the target is not null and cannot be downcast to the type represented by this object.
See Also:
copyTo(DBObject, boolean)

copyTo

DBObject copyTo(DBObject target,
                boolean temporaryCopy)
Copies the state of this object to another instance. If null is specified for the target, a new instance will be created.

The entire state of the object will be copied. In cases where this instance contains child DBObjects, new instances of those children will be created, and the state copied to them. The copy will thus contain its own unique state; after making the copy, changing one instance will not cause any changes to occur to the copy. The properties will be copied; however, copies will not be made of the values referenced by the properties - thus, the copy will refer to the same instance as the original.

The includeID parameter governs what happens to any ids (on this object, or on any children). If true a TemporaryObjectID will be assigned to the copy of any DBObject, that points back to the original object. If false a TemporaryObjectID will be assigned to the copy of any DBObject that already has an ID, but it will not point back to the original.

Parameters:
target - The object to copy to. If target is null, a new instance will be created, and the state will be copied to that object.
temporaryCopy - Whether to include a TemporaryObjectID that points back to the original for every object.
Returns:
the copy.
Throws:
java.lang.ClassCastException - if the target is not null and cannot be downcast to the type represented by this object.
Since:
11.0
See Also:
TemporaryObjectID, copyTo(java.lang.Object)

copyTo

DBObject copyTo(DBObject target,
                IDPolicy idPolicy)
Copies the state of this object to another instance. If null is specified for the target, a new instance will be created.

The entire state of the object will be copied. In cases where this instance contains child DBObjects, new instances of those children will be created, and the state copied to them. The copy will thus contain its own unique state; after making the copy, changing one instance will not cause any changes to occur to the copy. The properties will be copied; however, copies will not be made of the values referenced by the properties - thus, the copy will refer to the same instance as the original.

The idPolicy is used to control the IDs set on all objects in the copy.

Parameters:
target - The object to copy to. If target is null, a new instance will be created, and the state will be copied to that object.
idPolicy - The policy for the IDs set in the copy.
Returns:
the copy.
Throws:
java.lang.ClassCastException - if the target is not null and cannot be downcast to the type represented by this object.
Since:
11.0
See Also:
TemporaryObjectID, copyTo(java.lang.Object), copyTo(DBObject, boolean)

setName

void setName(java.lang.String name)
Sets the name of this object.

Parameters:
name - a string containing the new name for this object.

getName

java.lang.String getName()
Retrieves the name of this object.

Returns:
a string containing the name of this object.

getID

DBObjectID getID()
Retrieves the object ID associated with this object.

Returns:
the DBObjectID associated with this object

setID

void setID(DBObjectID id)
Sets the object ID associated with this object. Note that the ID should only be set at most once. Implementations should ensure that the id is not reset.

Parameters:
id - the DBObjectID to be associated with this object
Throws:
java.lang.IllegalStateException - if the ID is already set

getType

java.lang.String getType()
Returns the type of this object. Valid types include things like tables, views, synonyms, and columns.

Returns:
a string describing the type of object.

getOwnedObjects

DBObject[] getOwnedObjects()
Returns any objects owned by object.
The order of this array is not guarenteed, i.e. IT CANNOT BE RELIED UPON TO RETURN THE CHILDREN IN TYPE, ANNOTATION_NAME OR ANY OTHER ORDER.
This method should not return null - whether children are not supported on this object, or the object supports children and has none an empty array should be returned. Will not return null.

Returns:
the children of the object, null if none.
Since:
10.1.3

getOwnedObjects

DBObject[] getOwnedObjects(java.lang.String... type)
Returns the objects owned by this object of the given type.
The order of this array is not guarenteed, i.e. IT CANNOT BE RELIED UPON TO RETURN THE CHILDREN IN TYPE, NAME OR ANY OTHER ORDER.
Schema's will not return the SchemaObjects contained within them through this method. Use the DBObjectProvider to list those objects.
This method should not return null - whether children are not supported on this object, or the object supports children and has none an empty array should be returned. Will not return null.

Parameters:
types - the DBObject type(s) for the children to be returned (e.g. Column.TYPE)
Since:
10.1.3

findOwnedObject

DBObject findOwnedObject(java.lang.String type,
                         java.lang.String name)
Returns an object owned by this object with given name and type, if one exists. Otherwise returns null. Schema's will not return the SchemaObjects contained within them through this method. Use the DBObjectProvider to list those objects.

Parameters:
type - the DBObject type for the child to be returned (e.g. Column.TYPE)
name - the name of the DBObject to be returned
Returns:
the appropriate child object, if one exists.
Since:
10.1.3

findOwnedObject

DBObject findOwnedObject(DBObjectID id)
Returns a child of this object that has the given ID. The child is located by comparing IDs, not by calling resolveID() and is therefore the quickest way to locate a DBObject if you know its parent (in the API the Schema -> SchemaObject relationship is not an owner -> owned object relationship).

The method does not recurse to look for children of children.

Parameters:
id - the id to look for
Returns:
a child object found with that id or null if no child is found
Since:
11.0

getParent

DBObject getParent()
Returns the parent of this object, if one exists. This does not return the Schema for a SchemaObject. Schema's are not considered part of the ownership parent tree.

Since:
10.1.3

getReferenceIDs

DBObjectID[] getReferenceIDs()
Returns all the IDs that this object has as properties that reference other DBObjects. For example a FKConstraint references a UniqueConstraint via a DBObjectID and that would be included in what is returned by this method.

Will not return null.

Returns:
all property values that are DBObjectIDs.
Since:
10.1.3

replaceReferenceIDs

boolean replaceReferenceIDs(java.util.Map<DBObjectID,DBObjectID> oldToNew)
Replaces any reference ids (e.g. "reference id" on an FKConstraint) on the object with new versions of that id according to the entries in the Map. This can be used to hook up old and new ids between copies of the same object, or to update a referencing id after an object's id has changed.

Parameters:
oldToNew - key = old DBObjectID, value = new DBObjectID
Returns:
true if any ids were replaced.
Since:
10.1.3

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

E17493-02

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