public abstract class CascadeManager
extends java.lang.Object
The cascade manager interface supports the concept of "unresolved references" which are references in the model that don't resolve to a real object.
Since 12.1.3 any potentially long running methods in this class were
changed to specifically throw a CancelledException
to cope with
the user cancelling long running processes.
DBObjectProvider.getCascadeManager()
Modifier and Type | Class and Description |
---|---|
static class |
CascadeManager.LookupCriteria
Used to customise the lookup of references or referers through the
CascadeManager.
|
static class |
CascadeManager.NoCascadeRequiredException
Deprecated.
|
Modifier | Constructor and Description |
---|---|
protected |
CascadeManager(DBObjectProvider pro) |
Modifier and Type | Method and Description |
---|---|
SystemObject |
cascadeDelete(DBObject deleted,
SystemObject referer)
Deprecated.
- cascade is automatic in providers that support it
|
SystemObject |
cascadeDelete(DBObject deleted,
SystemObject referer,
boolean copyIfCascadeRequired)
Deprecated.
- cascade is automatic in providers that support it
|
protected <T> java.util.Map<DBObjectID,T> |
createIDMap() |
protected java.util.Set<DBObjectID> |
createIDSet() |
void |
doCascadeDelete(SystemObject deleted,
SystemObject referer)
Deprecated.
- cascade is automatic in providers that support it
|
java.util.Map<PropertyInfo,java.lang.Object> |
findPropertyReferences(DBObject obj,
DBObjectID reference)
Finds the property/properties that reference the given ID on the given
object.
|
java.util.Collection<DBObjectID> |
findReferers(DBObject obj,
DBObjectID to,
java.util.Collection<DBObjectID> refdBy,
boolean topLevel)
Recursively builds up referers to the given object.
|
protected java.util.logging.Logger |
getLogger() |
protected DBObjectProvider |
getProvider() |
boolean |
isUnresolvedReference(DBObjectID id)
Returns true if the given id is an "unresolved reference".
|
java.util.Collection<SystemObject> |
listReferencedObjects(SystemObject obj,
boolean recurse)
Returns the SystemObjects that this SystemObject, or any of its children,
are dependent on (reference).
|
java.util.Collection<SystemObject> |
listReferencedObjects(SystemObject obj,
CascadeManager.LookupCriteria criteria)
Returns the SystemObjects that this SystemObject, or any of its children,
are dependent on (reference).
|
abstract java.util.Collection<DBObjectID> |
listReferers(DBObject obj)
Gets the ids of the DBObjects who directly reference the given object.
|
java.util.Collection<DBObjectID> |
listTopLevelReferers(SystemObject obj,
boolean deep)
Gets the ids for the SystemObjects who reference (either directly or
via their children) the given SystemObject (or one of its children).
|
abstract java.util.Collection<DBObjectID> |
listTopLevelReferers(SystemObject obj,
CascadeManager.LookupCriteria criteria)
Gets the ids for the SystemObjects who reference (either directly or
via their children) the given SystemObject (or one of its children).
|
java.util.Collection<Difference> |
resolveUnresolvedReferences(SystemObject obj)
If this manager supports unresolved references and the given object could
potentially fix those references then this method finds any objects that
have an unresolved reference and looks to resolve it.
|
protected CascadeManager(DBObjectProvider pro)
protected DBObjectProvider getProvider()
public abstract java.util.Collection<DBObjectID> listReferers(DBObject obj) throws CancelledException
obj
- the object being referenced (e.g. a PK)CancelledException
- if the lookup is cancelled while executing.public final java.util.Collection<DBObjectID> listTopLevelReferers(SystemObject obj, boolean deep) throws CancelledException
For example for a Table this would return any Tables, Views or Synonyms (etc) that reference it via FKs, ColumnUsages or Object references).
The referers will not contain the given object, even if it has internal references (e.g. a PK referencing its own Columns). The references are all external.
obj
- the object to search for references todeep
- whether to traverse references to the referers etc.CancelledException
- if the lookup is cancelled while executing.public abstract java.util.Collection<DBObjectID> listTopLevelReferers(SystemObject obj, CascadeManager.LookupCriteria criteria) throws CancelledException
For example for a Table this would return any Tables, Views or Synonyms (etc) that reference it via FKs, ColumnUsages or Object references).
The referers will not contain the given object, even if it has internal references (e.g. a PK referencing its own Columns). The references are all external.
obj
- the object to lookup references tocriteria
- restrictions on the lookupCancelledException
- if the lookup is cancelled while executing.@Deprecated public SystemObject cascadeDelete(DBObject deleted, SystemObject referer) throws CascadeManager.NoCascadeRequiredException
@Deprecated public SystemObject cascadeDelete(DBObject deleted, SystemObject referer, boolean copyIfCascadeRequired) throws CascadeManager.NoCascadeRequiredException
@Deprecated public void doCascadeDelete(SystemObject deleted, SystemObject referer) throws DBException
DBException
public java.util.Collection<SystemObject> listReferencedObjects(SystemObject obj, boolean recurse) throws CancelledException
obj
- the object to look for references fromrecurse
- whether to look for references from the references etcCancelledException
- if the lookup is cancelled while executing.public java.util.Collection<SystemObject> listReferencedObjects(SystemObject obj, CascadeManager.LookupCriteria criteria) throws CancelledException
obj
- the object to look for references fromcriteria
- restrictions on the lookupCancelledException
- if the lookup is cancelled while executing.public boolean isUnresolvedReference(DBObjectID id)
public java.util.Collection<Difference> resolveUnresolvedReferences(SystemObject obj) throws CancelledException
obj
- the object that is being created and could potentially resolve
unresolved references.CancelledException
- if the lookup is cancelled while executing.protected final java.util.logging.Logger getLogger()
protected java.util.Set<DBObjectID> createIDSet()
protected <T> java.util.Map<DBObjectID,T> createIDMap()
public final java.util.Map<PropertyInfo,java.lang.Object> findPropertyReferences(DBObject obj, DBObjectID reference)
public final java.util.Collection<DBObjectID> findReferers(DBObject obj, DBObjectID to, java.util.Collection<DBObjectID> refdBy, boolean topLevel) throws CancelledException
obj
- the object to look for references fromto
- the object we're finding references torefdBy
- the references we've already found (to include in the
returned list)topLevel
- whether to only record top level referencesCancelledException
- if the lookup is cancelled while executing.