Methods Summary |
---|
public void | addDeletedObject(java.lang.Object object, oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL:
Add the Deleted object to the changeSet
//CR 4080 - must prevent aggregate objects added to DeletedObjects list
ClassDescriptor descriptor = session.getDescriptor(object);
if (!descriptor.isAggregateCollectionDescriptor()) {
ObjectChangeSet set = descriptor.getObjectBuilder().createObjectChangeSet(object, this, false, session);
// needed for xml change set
set.setShouldBeDeleted(true);
getDeletedObjects().put(set, set);
}
|
public void | addDeletedObjects(oracle.toplink.essentials.internal.helper.IdentityHashtable deletedObjects, oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL:
Add the Deleted objects to the changeSet
Enumeration enumtr = deletedObjects.keys();
while (enumtr.hasMoreElements()) {
Object object = enumtr.nextElement();
this.addDeletedObject(object, session);
}
|
public void | addNewObjectChangeSet(oracle.toplink.essentials.internal.sessions.ObjectChangeSet objectChanges, oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL:
Add to the changes for 'object' object to this changeSet. This method will not
add to the lists that are used for identity lookups. It is called specifically
for new objects, and new object will be moved to the standard changes list by
the QueryMechanism after insert.
if ((objectChanges == null)) {
return;
}
IdentityHashtable changeSetTable = (IdentityHashtable)getNewObjectChangeSets().get(objectChanges.getClassType(session));
if (changeSetTable == null) {
// 2612538 - the default size of IdentityHashtable (32) is appropriate
changeSetTable = new IdentityHashtable();
getNewObjectChangeSets().put(objectChanges.getClassType(session), changeSetTable);
}
changeSetTable.put(objectChanges, objectChanges);
|
public void | addObjectChangeSet(oracle.toplink.essentials.internal.sessions.ObjectChangeSet objectChanges)INTERNAL:
Add to the changes for 'object' object to this changeSet. This method will not
add to the lists that are used for identity lookups.
The passed change set *must* either have changes or forced changes.
if ((objectChanges == null)) {
return;
}
// If this object change set has changes or forced changes then record this. Must
// be done for each change set added because some may not contain 'real' changes. This
// is the case for opt. read lock and forceUdpate. Keep the flags separate because
// we don't want to cache sync. a change set with no 'real' changes.
boolean objectChangeSetHasChanges = objectChanges.hasChanges();
if (objectChangeSetHasChanges) {
this.setHasChanges(true);
this.hasForcedChanges = this.hasForcedChanges || objectChanges.hasForcedChanges();
} else {
// object change set doesn't have changes so it has to have forced changes.
this.hasForcedChanges = true;
}
if (!objectChanges.isAggregate()) {
if (objectChangeSetHasChanges) {
// Each time I create a changeSet it is added to this list and when I compute a changeSet for this
// object I again add it to these lists so that before this UOWChangeSet is
// Serialised there is a copy of every changeSet which has changes affecting cache
// in allChangeSets
getAllChangeSets().put(objectChanges, objectChanges);
}
if (objectChanges.getCacheKey() != null) {
Hashtable table = (Hashtable)getObjectChanges().get(objectChanges.getClassName());
if (table == null) {
table = new Hashtable(2);
getObjectChanges().put(objectChanges.getClassName(), table);
table.put(objectChanges, objectChanges);
} else {
table.put(objectChanges, objectChanges);
}
}
}
|
public void | addObjectChangeSetForIdentity(oracle.toplink.essentials.internal.sessions.ObjectChangeSet objectChanges, java.lang.Object object)INTERNAL:
Add change records to the lists used to maintain identity. This will not actually
add the changes to 'object' to the change set.
if ((objectChanges == null) || (object == null)) {
return;
}
if (objectChanges.isAggregate()) {
getAggregateList().put(objectChanges, objectChanges);
}
getObjectChangeSetToUOWClone().put(objectChanges, object);
getCloneToObjectChangeSet().put(object, objectChanges);
|
public oracle.toplink.essentials.internal.sessions.ObjectChangeSet | findObjectChangeSet(oracle.toplink.essentials.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet mergeFromChangeSet)INTERNAL:
This method can be used find the equivalent changeset within this UnitOfWorkChangeSet
Aggregates, and new objects without primaryKeys from serialized ChangeSets will not be found
Which may result in duplicates, in the UnitOfWorkChangeSet.
Hashtable changes = (Hashtable)getObjectChanges().get(changeSet.getClassName());
ObjectChangeSet potential = null;
if (changes != null) {
potential = (ObjectChangeSet)changes.get(changeSet);
}
if (potential == null) {
potential = (ObjectChangeSet)this.getObjectChangeSetForClone(changeSet.getUnitOfWorkClone());
}
return potential;
|
public oracle.toplink.essentials.internal.sessions.ObjectChangeSet | findOrIntegrateObjectChangeSet(oracle.toplink.essentials.internal.sessions.ObjectChangeSet tofind, oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet mergeFromChangeSet)INTERNAL:
This method will be used during the merge process to either find an equivalent change set
within this UnitOfWorkChangeSet or integrate that changeset into this UOW ChangeSet
if (tofind == null) {
return tofind;
}
ObjectChangeSet localChangeSet = this.findObjectChangeSet(tofind, mergeFromChangeSet);
if (localChangeSet == null) {//not found locally then replace it with the one from the merging changeset
localChangeSet = new ObjectChangeSet(tofind.getPrimaryKeys(), tofind.getClassType(), tofind.getUnitOfWorkClone(), this, tofind.isNew());
this.addObjectChangeSetForIdentity(localChangeSet, localChangeSet.getUnitOfWorkClone());
}
return localChangeSet;
|
protected oracle.toplink.essentials.internal.helper.IdentityHashtable | getAggregateList()INTERNAL:
Get the Aggregate list. Lazy initialises the hashtable if required
if (aggregateList == null) {
aggregateList = new IdentityHashtable();
}
return aggregateList;
|
public oracle.toplink.essentials.internal.helper.IdentityHashtable | getAllChangeSets()INTERNAL:
This method returns a reference to the collection
if (this.allChangeSets == null) {
// 2612538 - the default size of IdentityHashtable (32) is appropriate
this.allChangeSets = new IdentityHashtable();
}
return allChangeSets;
|
public oracle.toplink.essentials.internal.helper.IdentityHashtable | getCloneToObjectChangeSet()INTERNAL:
Get the clone to object change hash table. Lazy initialises the hashtable if required
if (cloneToObjectChangeSet == null) {
cloneToObjectChangeSet = new IdentityHashtable();
}
return cloneToObjectChangeSet;
|
public oracle.toplink.essentials.internal.helper.IdentityHashtable | getDeletedObjects()INTERNAL:
This method returns the reference to the deleted objects from the changeSet
if (this.deletedObjects == null) {
// 2612538 - the default size of IdentityHashtable (32) is appropriate
this.deletedObjects = new IdentityHashtable();
}
return deletedObjects;
|
public java.util.Hashtable | getNewObjectChangeSets()INTERNAL:
This method will return a reference to the new object change set collections
if (this.newObjectChangeSets == null) {
this.newObjectChangeSets = new java.util.Hashtable();
}
return this.newObjectChangeSets;
|
public oracle.toplink.essentials.changesets.ObjectChangeSet | getObjectChangeSetForClone(java.lang.Object clone)ADVANCED:
Get ChangeSet for a particular clone
if ((clone == null) || (getCloneToObjectChangeSet() == null)) {
return null;
}
return (oracle.toplink.essentials.changesets.ObjectChangeSet)getCloneToObjectChangeSet().get(clone);
|
protected oracle.toplink.essentials.internal.helper.IdentityHashtable | getObjectChangeSetToUOWClone()INTERNAL:
This method returns a reference to the collection
if (this.objectChangeSetToUOWClone == null) {
// 2612538 - the default size of IdentityHashtable (32) is appropriate
this.objectChangeSetToUOWClone = new IdentityHashtable();
}
return objectChangeSetToUOWClone;
|
public java.util.Hashtable | getObjectChanges()INTERNAL:
Returns the ObjectChanges held by this ChangeSet.
if (objectChanges == null) {
objectChanges = new Hashtable(2);
}
return objectChanges;
|
public java.lang.Object | getUOWCloneForObjectChangeSet(oracle.toplink.essentials.changesets.ObjectChangeSet changeSet)ADVANCED:
This method returns the Clone for a particular changeSet
if ((changeSet == null) || (getObjectChangeSetToUOWClone() == null)) {
return null;
}
return getObjectChangeSetToUOWClone().get(changeSet);
|
public boolean | hasChanges()INTERNAL:
Returns true if the Unit Of Work change Set has changes
// All of the object change sets were empty (none contained changes)
// The this.hasChanges variable is set in addObjectChangeSet
return (this.hasChanges || (!getDeletedObjects().isEmpty()));
|
public boolean | hasForcedChanges()INTERNAL:
Returns true if this uowChangeSet contains an objectChangeSet that has forced
SQL changes. This is true whenever CMPPolicy.getForceUpdate() == true.
return this.hasForcedChanges;
|
public oracle.toplink.essentials.internal.sessions.ObjectChangeSet | mergeObjectChanges(oracle.toplink.essentials.internal.sessions.ObjectChangeSet objectChangeSet, oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet mergeFromChangeSet)INTERNAL:
This method will be used to merge a change set into an UnitOfWorkChangeSet
This method returns the local instance of the changeset
ObjectChangeSet localChangeSet = this.findOrIntegrateObjectChangeSet(objectChangeSet, mergeFromChangeSet);
if (localChangeSet != null) {
localChangeSet.mergeObjectChanges(objectChangeSet, this, mergeFromChangeSet);
}
return localChangeSet;
|
public void | mergeUnitOfWorkChangeSet(oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet mergeFromChangeSet, oracle.toplink.essentials.internal.sessions.AbstractSession session, boolean postCommit)INTERNAL:
THis method will be used to merge another changeset into this changeset. The
Main use of this method is for non-deferred writes and checkpointing so that
the acumulated changes are collected and merged at the end of the transaction
Iterator iterator = mergeFromChangeSet.getObjectChanges().values().iterator();
while (iterator.hasNext()) {
//iterate over the classes
Hashtable table = (Hashtable)iterator.next();
Iterator changes = table.values().iterator();
while (changes.hasNext()) {
ObjectChangeSet objectChangeSet = (ObjectChangeSet)changes.next();
objectChangeSet = mergeObjectChanges(objectChangeSet, mergeFromChangeSet);
if (objectChangeSet.isNew() && !postCommit) {// if it is post commit then we can trust the cache key
this.addNewObjectChangeSet(objectChangeSet, session);
} else {
this.addObjectChangeSet(objectChangeSet);
}
}
}
//merging a serialized UnitOfWorkChangeSet can result in duplicate deletes
//if a delete for the same object already exists in this UOWChangeSet.
Enumeration deletedEnum = mergeFromChangeSet.getDeletedObjects().elements();
while (deletedEnum.hasMoreElements()) {
ObjectChangeSet objectChangeSet = (ObjectChangeSet)deletedEnum.nextElement();
ObjectChangeSet localObjectChangeSet = findObjectChangeSet(objectChangeSet, mergeFromChangeSet);
if (localObjectChangeSet == null) {
localObjectChangeSet = objectChangeSet;
}
this.getDeletedObjects().put(localObjectChangeSet, localObjectChangeSet);
}
|
public void | putNewObjectInChangesList(oracle.toplink.essentials.internal.sessions.ObjectChangeSet objectChangeSet, oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL:
Used to rehash the new objects back into the objectChanges list for serialization
this.addObjectChangeSet(objectChangeSet);
removeObjectChangeSetFromNewList(objectChangeSet, session);
|
public void | removeObjectChangeSet(oracle.toplink.essentials.internal.sessions.ObjectChangeSet objectChanges)INTERNAL:
Add the changed Object's records to the ChangeSet
if (objectChanges == null) {
return;
}
Object object = getObjectChangeSetToUOWClone().get(objectChanges);
if (objectChanges.isAggregate()) {
getAggregateList().remove(objectChanges);
} else {
// Bug 3294426 - index object changes by classname instead of class for remote classloader issues
Hashtable table = (Hashtable)getObjectChanges().get(object.getClass().getName());
if (table != null) {
table.remove(objectChanges);
}
}
getObjectChangeSetToUOWClone().remove(objectChanges);
if (object != null) {
getCloneToObjectChangeSet().remove(object);
}
getAllChangeSets().remove(objectChanges);
|
public void | removeObjectChangeSetFromNewList(oracle.toplink.essentials.internal.sessions.ObjectChangeSet objectChangeSet, oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL:
Used to remove a new object from the new objects list once it has been
inserted and added to the objectChangesList
IdentityHashtable table = (IdentityHashtable)getNewObjectChangeSets().get(objectChangeSet.getClassType(session));
if (table != null) {
table.remove(objectChangeSet);
}
|
protected void | setCloneToObjectChangeSet(oracle.toplink.essentials.internal.helper.IdentityHashtable newCloneToObjectChangeSet)INTERNAL:
This method is used to set the hashtable for cloneToObject reference
cloneToObjectChangeSet = newCloneToObjectChangeSet;
|
public void | setHasChanges(boolean flag)INTERNAL:
Set whether the Unit Of Work change Set has changes
this.hasChanges = flag;
|
public void | setInternalAllChangeSets(java.util.Vector objectChangeSets)INTERNAL:
This method take a collection of ObjectChangeSet rebuilds this UOW change set to a ready to merge stage
if (objectChangeSets == null) {
return;
}
sdkAllChangeSets = objectChangeSets;
for (int i = 0; i < objectChangeSets.size(); i++) {
ObjectChangeSet objChangeSet = (ObjectChangeSet)objectChangeSets.elementAt(i);
objChangeSet.setUOWChangeSet(this);
if (objChangeSet.isAggregate()) {
getAggregateList().put(objChangeSet, objChangeSet);
} else if (objChangeSet.shouldBeDeleted()) {
getDeletedObjects().put(objChangeSet, objChangeSet);
} else {
getAllChangeSets().put(objChangeSet, objChangeSet);
}
if (objChangeSet.getCacheKey() != null) {
Hashtable table = (Hashtable)getObjectChanges().get(objChangeSet.getClassName());
if (table == null) {
table = new Hashtable(2);
getObjectChanges().put(objChangeSet.getClassName(), table);
}
table.put(objChangeSet, objChangeSet);
}
}
|
protected void | setObjectChangeSetToUOWClone(oracle.toplink.essentials.internal.helper.IdentityHashtable newObjectChangeSetToUOWClone)INTERNAL:
This method is used to insert a new collection into the UOWChangeSet.
objectChangeSetToUOWClone = newObjectChangeSetToUOWClone;
|
protected void | setObjectChanges(java.util.Hashtable objectChanges)INTERNAL:
Sets the collection of ObjectChanges in the change Set
this.objectChanges = objectChanges;
|