Methods Summary |
---|
public int | getCascadeDepth()
return cascadeDepth;
|
public oracle.toplink.essentials.descriptors.ClassDescriptor | getCurrentDescriptor()
return currentDescriptor;
|
public oracle.toplink.essentials.mappings.DatabaseMapping | getCurrentMapping()
return currentMapping;
|
protected oracle.toplink.essentials.descriptors.ClassDescriptor | getDescriptorFor(java.lang.Object object)Fetch and return the descriptor for the specified object.
ClassDescriptor result = getSession().getDescriptor(object);
if (result == null) {
throw DescriptorException.missingDescriptor(object.getClass().getName());
}
return result;
|
public java.lang.Object | getResult()
return result;
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getSession()
return session;
|
public java.lang.Object | getVisitedGrandparent()Return the second-to-last object visited.
Object parent = getVisitedStack().pop();
Object result = getVisitedStack().peek();
getVisitedStack().push(parent);
return result;
|
public oracle.toplink.essentials.internal.helper.IdentityHashtable | getVisitedObjects()
return visitedObjects;
|
public java.lang.Object | getVisitedParent()Return the last object visited.
return getVisitedStack().peek();
|
public java.util.Stack | getVisitedStack()
return visitedStack;
|
protected void | internalIterateAggregateObject(java.lang.Object aggregateObject)Iterate an aggregate object
(i.e. an object that is the target of an AggregateMapping).
Override this method if appropriate.
iterate(aggregateObject);
|
protected void | internalIterateIndirectContainer(oracle.toplink.essentials.indirection.IndirectContainer container)Iterate an indirect container (IndirectList or IndirectMap).
Override this method if appropriate.
iterate(container);
|
protected void | internalIteratePrimitive(java.lang.Object primitiveValue)Iterate a primitive object (String, Date, Integer, etc.).
Override this method if appropriate.
iterate(primitiveValue);
|
protected void | internalIterateReferenceObject(java.lang.Object referenceObject)Iterate a (a non-Aggregate) reference object.
Override this method if appropriate.
iterate(referenceObject);
|
protected void | internalIterateValueHolder(oracle.toplink.essentials.indirection.ValueHolderInterface valueHolder)Iterate a value holder.
Override this method if appropriate.
iterate(valueHolder);
|
protected abstract void | iterate(java.lang.Object object)To define a new iterator create a subclass and define at least this method.
Given an object or set of the objects, this method will be called on those
objects and any object connected to them by using the descriptors to
traverse the object graph.
Override the assorted #internalIterate*() methods if appropriate.
|
public void | iterateForAggregateMapping(java.lang.Object aggregateObject, oracle.toplink.essentials.mappings.DatabaseMapping mapping, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)Iterate on the mapping's reference object and
recursively iterate on the reference object's
reference objects.
This is used for aggregate and aggregate collection mappings, which are not iterated on by default.
if (aggregateObject == null) {
return;
}
setCurrentMapping(mapping);
// aggregate descriptors are passed in because they could be part of an inheritance tree
setCurrentDescriptor(descriptor);
if (shouldIterateOnAggregates()) {// false by default
internalIterateAggregateObject(aggregateObject);
if (shouldBreak()) {
setShouldBreak(false);
return;
}
}
iterateReferenceObjects(aggregateObject);
|
public void | iterateIndirectContainerForMapping(oracle.toplink.essentials.indirection.IndirectContainer container, oracle.toplink.essentials.mappings.DatabaseMapping mapping)Iterate on the indirection object for its mapping.
setCurrentMapping(mapping);
setCurrentDescriptor(null);
if (shouldIterateOnIndirectionObjects()) {// false by default
internalIterateIndirectContainer(container);
}
if (shouldIterateOverUninstantiatedIndirectionObjects() || (shouldIterateOverIndirectionObjects() && container.isInstantiated())) {
// force instantiation only if specified
mapping.iterateOnRealAttributeValue(this, container);
}
|
public void | iteratePrimitiveForMapping(java.lang.Object primitiveValue, oracle.toplink.essentials.mappings.DatabaseMapping mapping)Iterate on the primitive value for its mapping.
if (primitiveValue == null) {
return;
}
setCurrentMapping(mapping);
setCurrentDescriptor(null);
if (shouldIterateOnPrimitives()) {// false by default
internalIteratePrimitive(primitiveValue);
}
|
public void | iterateReferenceObjectForMapping(java.lang.Object referenceObject, oracle.toplink.essentials.mappings.DatabaseMapping mapping)Iterate on the mapping's reference object and
recursively iterate on the reference object's
reference objects.
if (!(shouldCascadeAllParts() || (shouldCascadePrivateParts() && mapping.isPrivateOwned()))) {
return;
}
// When using wrapper policy in EJB the iteration can stop in certain cases,
// this is because EJB forces beans to be registered anyway and clone identity can be violated
// and the violated clones references to session objects should not be traversed.
ClassDescriptor rd = mapping.getReferenceDescriptor();
if ((!shouldIterateOverWrappedObjects()) && (rd != null) && (rd.hasWrapperPolicy())) {
return;
}
if (referenceObject == null) {
return;
}
// Check if already processed.
if (getVisitedObjects().containsKey(referenceObject)) {
return;
}
getVisitedObjects().put(referenceObject, referenceObject);
setCurrentMapping(mapping);
setCurrentDescriptor(getDescriptorFor(referenceObject));
internalIterateReferenceObject(referenceObject);
if (shouldBreak()) {
setShouldBreak(false);
return;
}
iterateReferenceObjects(referenceObject);
|
protected void | iterateReferenceObjects(java.lang.Object sourceObject)Iterate over the sourceObject's reference objects,
updating the visited stack appropriately.
getVisitedStack().push(sourceObject);
getCurrentDescriptor().getObjectBuilder().iterate(this);
getVisitedStack().pop();
|
public void | iterateValueHolderForMapping(oracle.toplink.essentials.indirection.ValueHolderInterface valueHolder, oracle.toplink.essentials.mappings.DatabaseMapping mapping)Iterate on the value holder for its mapping.
setCurrentMapping(mapping);
setCurrentDescriptor(null);
if (shouldIterateOnIndirectionObjects()) {// false by default
internalIterateValueHolder(valueHolder);
}
if (shouldIterateOverUninstantiatedIndirectionObjects() || (shouldIterateOverIndirectionObjects() && valueHolder.isInstantiated())) {
// force instantiation only if specified
mapping.iterateOnRealAttributeValue(this, valueHolder.getValue());
}
|
public void | setCascadeDepth(int cascadeDepth)
this.cascadeDepth = cascadeDepth;
|
public void | setCurrentDescriptor(oracle.toplink.essentials.descriptors.ClassDescriptor currentDescriptor)
this.currentDescriptor = currentDescriptor;
|
public void | setCurrentMapping(oracle.toplink.essentials.mappings.DatabaseMapping currentMapping)
this.currentMapping = currentMapping;
|
public void | setResult(java.lang.Object result)
this.result = result;
|
public void | setSession(oracle.toplink.essentials.internal.sessions.AbstractSession session)
this.session = session;
|
public void | setShouldBreak(boolean shouldBreak)
this.shouldBreak = shouldBreak;
|
public void | setShouldIterateOnAggregates(boolean shouldIterateOnAggregates)Set whether the aggregate reference objects themselves
should be processed. (The objects referenced by the aggregate
objects will be processed either way.)
this.shouldIterateOnAggregates = shouldIterateOnAggregates;
|
public void | setShouldIterateOnIndirectionObjects(boolean shouldIterateOnIndirectionObjects)Set whether the indirection objects themselves (e.g. the ValueHolders)
should be processed.
this.shouldIterateOnIndirectionObjects = shouldIterateOnIndirectionObjects;
|
public void | setShouldIterateOnPrimitives(boolean shouldIterateOnPrimitives)Set whether to process primitive reference objects
(e.g. Strings, Dates, ints).
this.shouldIterateOnPrimitives = shouldIterateOnPrimitives;
|
public void | setShouldIterateOverIndirectionObjects(boolean shouldIterateOverIndirectionObjects)Set whether to process the objects contained by indirection objects
(e.g. a ValueHolder's value) - but *without* instantiating them.
this.shouldIterateOverIndirectionObjects = shouldIterateOverIndirectionObjects;
|
public void | setShouldIterateOverUninstantiatedIndirectionObjects(boolean shouldIterateOverUninstantiatedIndirectionObjects)Set whether to *instantiate* and process the objects
contained by indirection objects (e.g. a ValueHolder's value).
this.shouldIterateOverUninstantiatedIndirectionObjects = shouldIterateOverUninstantiatedIndirectionObjects;
|
public void | setShouldIterateOverWrappedObjects(boolean shouldIterateOverWrappedObjects)
this.shouldIterateOverWrappedObjects = shouldIterateOverWrappedObjects;
|
public void | setVisitedObjects(oracle.toplink.essentials.internal.helper.IdentityHashtable visitedObjects)
this.visitedObjects = visitedObjects;
|
protected void | setVisitedStack(java.util.Stack visitedStack)
this.visitedStack = visitedStack;
|
public boolean | shouldBreak()
return shouldBreak;
|
public boolean | shouldCascadeAllParts()
return getCascadeDepth() == CascadeAllParts;
|
public boolean | shouldCascadeNoParts()
return (getCascadeDepth() == NoCascading);
|
public boolean | shouldCascadePrivateParts()
return (getCascadeDepth() == CascadeAllParts) || (getCascadeDepth() == CascadePrivateParts);
|
public boolean | shouldIterateOnAggregates()Return whether the aggregate reference objects themselves
should be processed. (The objects referenced by the aggregate
objects will be processed either way.)
return shouldIterateOnAggregates;
|
public boolean | shouldIterateOnIndirectionObjects()Return whether the indirection objects themselves (e.g. the ValueHolders)
should be processed.
return shouldIterateOnIndirectionObjects;
|
public boolean | shouldIterateOnPrimitives()Return whether to process primitive reference objects
(e.g. Strings, Dates, ints).
return shouldIterateOnPrimitives;
|
public boolean | shouldIterateOverIndirectionObjects()Return whether to process the objects contained by indirection objects
(e.g. a ValueHolder's value) - but *without* instantiating them.
return shouldIterateOverIndirectionObjects;
|
public boolean | shouldIterateOverUninstantiatedIndirectionObjects()Return whether to *instantiate* and process the objects
contained by indirection objects (e.g. a ValueHolder's value).
return shouldIterateOverUninstantiatedIndirectionObjects;
|
public boolean | shouldIterateOverWrappedObjects()
return shouldIterateOverWrappedObjects;
|
public void | startIterationOn(java.lang.Object sourceObject)This is the root method called to start the iteration.
getVisitedObjects().put(sourceObject, sourceObject);
setCurrentMapping(null);
setCurrentDescriptor(getSession().getDescriptor(sourceObject));
iterate(sourceObject);
// start the recursion
if ((getCurrentDescriptor() != null) && (!shouldCascadeNoParts()) && !this.shouldBreak()) {
iterateReferenceObjects(sourceObject);
}
|