|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.javatools.db.DBUtil
public class DBUtil
Utility class associated with the DB package.
Nested Class Summary | |
---|---|
static class |
DBUtil.IDQuery When querying for reference IDs of an object this enum is used to define whether to query for different kinds of reference. |
Constructor Summary | |
---|---|
protected |
DBUtil() |
Method Summary | ||
---|---|---|
static boolean |
areEqualIgnoreNullValues(java.util.Map map1, java.util.Map map2) Compares the given maps following the rule that the following entries are considered equal: a missing key a key with null value a key with a value that is an empty Collection |
|
int |
compare(DBObject o1, DBObject o2) Compares the two objects, if they are both DBObjects. |
|
static void |
ensureDerivedPropertiesBuilt(SystemObject object, DBObjectProvider pro) INTERNAL ONLY - this is not a finished API yet. |
|
static void |
ensureObjectBuilt(SystemObject object) Ensures that the given object is loaded from its DBObjectProvider. |
|
boolean |
equals(java.lang.Object obj) |
|
static DBObject |
findChildInCopy(DBObject orig, DBObject copy, DBObject origChild) Given a child of an original object, finds the matching child of the copy using the TemporaryObjectIDs in the copy. |
|
static
|
findChildren(DBObject obj, java.lang.Class<T>... clz) Finds owned objects of the given class under the given object. |
|
static java.util.Collection<DBObject> |
findUsagesIn(DBObject used, DBObject searchRoot) Looks for usages of the given "used" object within the owned object heirachy of the given search object. |
|
static java.lang.String |
getDBObjectName(DBObjectID id) Gets the name of a DBObject from the DBObjectID, or the empty string if the DBObjectID can't be resolved. |
|
static java.util.Map<java.lang.String,java.lang.Object> |
getFrozenProperties(DBObject obj) Gets the properties map for a given object frozen in its current state. |
|
static java.lang.String |
getFullyQualifiedName(DBObject obj) Returns the fully qualified name of the given object by prepending the parent's name (if one exists) followed by a dot. |
|
static java.lang.String |
getFullyQualifiedName(DBObject obj, boolean incSchema) Returns the fully qualified name of the given object, optionally with the schema prepended. |
|
static java.util.Comparator<DBObject> |
getNameComparator() Returns a Comparator that will compare DBObjects by name first, and then by type. |
|
static DBObjectID |
getOriginalID(DBObject dbo) Returns the Original Id of a copied DBObject. |
|
static DBObject |
getProviderDefinition(DBObject obj, DBObjectProvider pro, java.lang.String schemaName) Gets the definition for the given object from the provider by querying name and type in the given schema on the top (schema) level parent and then recursing the heirachy to find a match by name and type of the object given. |
|
static DBObject |
getProviderDefinition(ReferenceID refID, DBObjectProvider pro) Attempts to locate the referenced object in the given provider. |
|
static
|
getProviderDefinition(T obj, DBObjectProvider pro) Gets the definition for the given object from the provider by querying name, schema and type. |
|
static
|
getProviderDefinition(T obj, DBObjectProvider pro, java.lang.String schemaName) Gets the definition for the given object from the provider by querying name and type in the given schema. |
|
static
|
getProviderDefinitions(T[] objs, DBObjectProvider pro) Gets the definitions for the given objects from the database by querying name, schema and type. |
|
static java.util.Collection<DBObjectID> |
getReferenceIDs(DBObject obj, boolean recurse, DBUtil.IDQuery query, java.lang.String... types) Collects all the reference ID properties for the given object and its children and returns them after filtering as required. |
|
static FKConstraint[] |
getReferences(Constraint ucon, DBObjectProvider prov) Get the Foreign Keys which reference a unique constraint Given a contraint and an Offline provider, this method uses the constraint manager registered with the provider to build an array of the foreign keys which reference this contraint. |
|
static Schema |
getSchema(DBObject obj) Recurses up the tree of parents for this DBObject until it finds a SchemaObject and if found returns that SchemaObject's Schema. |
|
static java.lang.String |
getSchemaName(DBObjectID dbObjectID) Returns the name of the schema from a DBObjectID, or the empty string if the DBObjectID can't be resolved. |
|
static SchemaObject |
getSchemaObject(DBObject obj) Recurses up the tree of parents for this DBObject, and if the top object in the chain is a SchemaObject, it is returned. |
|
static SystemObject |
getSystemObject(DBObject obj) Recurses up the tree of parents for this DBObject, and if the top object in the chain is a SystemObject, it is returned. |
|
static java.util.Map<DBObjectID,DBObjectID> |
getTemporaryIDMap(DBObject[] objs) |
|
static java.util.Comparator<DBObject> |
getTypeComparator() Returns a Comparator that will compare DBObjects by type first, and then by name. |
|
static java.lang.String |
getUniqueName(java.util.Collection existing, java.lang.String base) Returns a unique name given the Collection of existing names from the base name given. |
|
static java.lang.String |
getUniqueName(java.util.Collection existing, java.lang.String base, boolean increment) Returns a unique name given the Collection of existing names from the base name given. |
|
static DBObject |
getUppermostParent(DBObject obj) Gets the top most object in the parent chain for the given object. |
|
static DBObjectID |
getUppermostParent(DBObjectID id) Gets the top most object in the parent chain for the given id. |
|
int |
hashCode() |
|
static boolean |
isCompoundName(java.lang.String name, java.lang.String quote) Return true if the name contains an unquoted '.' |
|
static boolean |
isDangling(DBObjectID refID) Returns true if it is passed a dangling reference. |
|
static boolean |
isInternalRef(DBObjectID ref, DBObject obj) Returns true if the given DBObjectID is referencing an object that is under the same parent heirachy as the given DBObject. |
|
static
|
makeTemporaryCopy(D object) Makes a copy of the original object, with temporary reference ids. |
|
static boolean |
needsBuilding(AbstractBuildableObject obj, java.lang.String property) Tests whether the given object property needs building - i.e. |
|
static boolean |
needsBuilding(SystemObject obj) Tests whether the given object needs building - i.e. |
|
static boolean |
needsDerivedPropertiesBuilding(SystemObject obj) INTERNAL ONLY - this is not a finished API yet. |
|
static java.lang.String |
quoteName(java.lang.String name, java.lang.String quote) Returns name quoted with the given quote. |
|
static boolean |
replaceReferenceIDs(DBObject obj, java.util.Map<DBObjectID,DBObjectID> idMap) Replaces the referencing IDs in the given object and all child objects with the given key/value mapping. |
|
static DBObject |
resolveInOtherProvider(BaseObjectID id, DBObjectProvider pro) Attempts to resolve the given ID in a provider that is not the id's own. |
|
static void |
resumeTimestampChecking(DBObjectProvider pro, java.lang.String timestampKey) Indicates to the given provider that the timestamp suspension for the given key has finished. |
|
static java.util.Map<Schema,java.util.Collection<SystemObject>> |
sortIntoSchemas(SystemObject... objs) Sorts the given list of objects into a map of Schema to objects. |
|
static
|
stripNulls(T[] objs) Returns an array containing all the non-null elements from the given array. |
|
static void |
suspendTimestampChecking(DBObjectProvider pro, java.lang.String timestampKey) Usage must be proceeded immediatly by a try block, for which the finally contains a call to resumeTimestamps. |
|
static void |
updateObjectAndIDs(DBObject oldVersion, DBObject newVersion) Copys the newVersion to the old version and updates the oldVersion with the IDs from the newVersion. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DBUtil()
Method Detail |
---|
public int compare(DBObject o1, DBObject o2)
compare
in interface java.util.Comparator<DBObject>
getNameComparator()
, getTypeComparator()
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Comparator<DBObject>
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static java.util.Comparator<DBObject> getTypeComparator()
public static java.util.Comparator<DBObject> getNameComparator()
public static java.util.Map<DBObjectID,DBObjectID> getTemporaryIDMap(DBObject[] objs)
public static <D extends DBObject> D makeTemporaryCopy(D object)
object
- The original DBObjectDBObject#copyTo(java.lang.Object, boolean)
public static java.util.Map<java.lang.String,java.lang.Object> getFrozenProperties(DBObject obj)
public static boolean needsBuilding(SystemObject obj)
ensureObjectBuilt(oracle.javatools.db.SystemObject)
to build objects that need it and process any errors.public static boolean needsBuilding(AbstractBuildableObject obj, java.lang.String property)
ensureObjectBuilt(oracle.javatools.db.SystemObject)
to build objects that need it and process any errors.public static void ensureObjectBuilt(SystemObject object) throws DBException
object
- the object to buildDBException
- thrown if an error is encountered building the object.public static boolean needsDerivedPropertiesBuilding(SystemObject obj)
ensureDerivedPropertiesBuilt(oracle.javatools.db.SystemObject, oracle.javatools.db.DBObjectProvider)
public static void ensureDerivedPropertiesBuilt(SystemObject object, DBObjectProvider pro) throws DBException
Performs a "declarative build" which fills in any derived properties on the given object. Certain objects have a secondary build which builds derived information not directly associated with the dictionary (or persistence). For example this will attempt to build a View's SQLQuery (which will result in the building of any referenced Tables).
object
- the object to ensure that all the derived properties are built on.DBException
- if there is any error performing the build.public static java.util.Collection<DBObjectID> getReferenceIDs(DBObject obj, boolean recurse, DBUtil.IDQuery query, java.lang.String... types)
obj
- the object to queryrecurse
- whether to recurse to any child (owned) objectsquery
- the kind of reference to includetypes
- the types of object being referenced reqired (is used to filter by checking each id's type).public static boolean isInternalRef(DBObjectID ref, DBObject obj)
ref
- the reference to checkobj
- the object to inspect the parent heirachy ofgetUppermostParent(DBObject)
, getUppermostParent(DBObjectID)
public static boolean replaceReferenceIDs(DBObject obj, java.util.Map<DBObjectID,DBObjectID> idMap)
obj
- the object whose reference IDs (and children) are to be processedidMap
- the mappings of old to new IDs.public static void updateObjectAndIDs(DBObject oldVersion, DBObject newVersion)
public static <T extends DBObject> java.util.Collection<T> findChildren(DBObject obj, java.lang.Class<T>... clz)
T
- the object type we're looking forobj
- the object to look under for objects of the given type (including obj itself)clz
- the class(es) of object to findpublic static DBObject findChildInCopy(DBObject orig, DBObject copy, DBObject origChild)
orig
- The original object containing the childcopy
- The copy of the parentorigChild
- The child of the originalpublic static java.lang.String getUniqueName(java.util.Collection existing, java.lang.String base)
public static java.lang.String getUniqueName(java.util.Collection existing, java.lang.String base, boolean increment)
i.e.
if NAME1 exists and increment is true - base NAME1 -> NAME2
if NAME1 exists and increment is false - base NAME1 -> NAME1_1
public static java.lang.String getFullyQualifiedName(DBObject obj)
public static java.lang.String getFullyQualifiedName(DBObject obj, boolean incSchema)
public static Schema getSchema(DBObject obj)
public static SchemaObject getSchemaObject(DBObject obj)
public static SystemObject getSystemObject(DBObject obj)
public static DBObject getUppermostParent(DBObject obj)
obj
- the object to querypublic static DBObjectID getUppermostParent(DBObjectID id)
id
- the DBObjectID to querypublic static java.util.Map<Schema,java.util.Collection<SystemObject>> sortIntoSchemas(SystemObject... objs)
public static <T extends DBObject> T getProviderDefinition(T obj, DBObjectProvider pro) throws DBException
obj
- the object to query in the provider by type, schema and name.pro
- the provider to get the definition fromDBException
public static DBObject getProviderDefinition(DBObject obj, DBObjectProvider pro, java.lang.String schemaName) throws DBException
obj
- the object to find in the providerpro
- the provider to get the definition fromschemName
- the schema to searchDBException
public static <T extends SchemaObject> T getProviderDefinition(T obj, DBObjectProvider pro, java.lang.String schemaName) throws DBException
obj
- the object to query in the provider by type, schema and name.pro
- the provider to get the definition fromschemaName
- the name of the schema to be searchedDBException
public static <T extends SystemObject> T[] getProviderDefinitions(T[] objs, DBObjectProvider pro) throws DBException
objs
- the objects whose definitions are to be retrieved from the providerpro
- the provider to get the definitions fromDBException
public static DBObject getProviderDefinition(ReferenceID refID, DBObjectProvider pro) throws DBException
DBException
public static <T> T[] stripNulls(T[] objs)
public static java.lang.String quoteName(java.lang.String name, java.lang.String quote)
public static boolean isCompoundName(java.lang.String name, java.lang.String quote)
name
-public static boolean isDangling(DBObjectID refID)
refID
-public static DBObjectID getOriginalID(DBObject dbo)
a
- DBObjectpublic static java.util.Collection<DBObject> findUsagesIn(DBObject used, DBObject searchRoot)
used
- the object to look for usages ofsearchRoot
- the object to search withinpublic static FKConstraint[] getReferences(Constraint ucon, DBObjectProvider prov)
public static java.lang.String getDBObjectName(DBObjectID id)
id
- the ID to inspect/resolvepublic static java.lang.String getSchemaName(DBObjectID dbObjectID)
dbObjectID
- the ID to inspect/resolvepublic static DBObject resolveInOtherProvider(BaseObjectID id, DBObjectProvider pro) throws DBException
Importantly this attempts to resolve the ID. If the ID is a reference ID then you might really want to call getProviderDefinition(ReferenceID,DBObjectProvider)
to look for a provider definition matching the given reference.
id
- the id to attempt to resolvepro
- the provider (other than the id's own provider) to try and find a matching object inDBException
public static boolean areEqualIgnoreNullValues(java.util.Map map1, java.util.Map map2)
public static void suspendTimestampChecking(DBObjectProvider pro, java.lang.String timestampKey)
e.g.
final String key = "MyTimeConsumingOperation" + System.nanoTime(); try { DBUtil.suspendTimestamps( pro, key ); // perform my time consuming operation } finally { DBUtil.resumeTimestamps( pro, key ); }
pro
- the provider to suspend timestamping fortimestampKey
- the key to suspect timestamping with (MUST be unique, and preferably meaningful).public static void resumeTimestampChecking(DBObjectProvider pro, java.lang.String timestampKey)
pro
- the provider timestamping was originally suspended ontimestampKey
- the key for the suspension that is now oversuspendTimestampChecking(oracle.javatools.db.DBObjectProvider, java.lang.String)
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |