Module org.eclipse.persistence.core
Class UnitOfWorkChangeSet
java.lang.Object
org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet
- All Implemented Interfaces:
Serializable
,UnitOfWorkChangeSet
Purpose: This is the overall collection of changes.
Description: It holds all of the object changes and all ObjectChanges, with the same classType and primary keys, referenced in a changeSet should be the same object.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map
<ObjectChangeSet, ObjectChangeSet> protected Map
<ObjectChangeSet, ObjectChangeSet> protected Map
<Object, ObjectChangeSet> protected Map
<ObjectChangeSet, ObjectChangeSet> protected boolean
This attribute is set to true if a changeSet with changes has been addedprotected boolean
protected boolean
Flag set when calling commitToDatabaseWithPreBuiltChangeSet so we are aware the UOW does not contain the changes from this change set.protected Map
<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>> protected Map
<Class<?>, Map<ObjectChangeSet, ObjectChangeSet>> This is the collection of ObjectChanges held by this ChangeSetprotected Map
<ObjectChangeSet, Object> protected AbstractSession
Stores unit of work before it is serialized. -
Constructor Summary
ConstructorDescriptionINTERNAL: Create a ChangeSetUnitOfWorkChangeSet
(AbstractSession session) INTERNAL: Create a ChangeSet -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDeletedObject
(Object object, AbstractSession session) INTERNAL: Add the Deleted object to the changeSet.void
addDeletedObjects
(Map deletedObjects, AbstractSession session) INTERNAL: Add the Deleted objects to the changeSet.protected void
addNewObjectChangeSet
(ObjectChangeSet objectChanges, AbstractSession session) INTERNAL: Add to the changes for 'object' object to this changeSet.void
addObjectChangeSet
(ObjectChangeSet objectChanges, AbstractSession session, boolean forceToNewObjectList) INTERNAL: Add to the changes for 'object' object to this changeSet.void
addObjectChangeSetForIdentity
(ObjectChangeSet objectChanges, Object object) INTERNAL: Add change records to the lists used to maintain identity.INTERNAL: Return a new UnitOfWorkChangeSet that only includes data require for the remote merge, for cache coordination.findObjectChangeSet
(ObjectChangeSet changeSet, 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.findOrCreateLocalObjectChangeSet
(Object entityClone, ClassDescriptor descriptor, boolean isNew) INTERNAL" This method is used during the merge process to either find the existing ChangeSet or create a new one.findOrIntegrateObjectChangeSet
(ObjectChangeSet tofind, 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 ChangeSetINTERNAL: Returns the set of classes corresponding to updated objects in objectChanges.INTERNAL: Get the Aggregate list.INTERNAL: This method returns a reference to the collection.INTERNAL: Get the clone to object change hash table.INTERNAL: This method returns the reference to the deleted objects from the changeSet.INTERNAL: This method will return a reference to the new object change set collections.INTERNAL: Returns the ObjectChanges held by this ChangeSet.getObjectChangeSetForClone
(Object clone) ADVANCED: Get ChangeSet for a particular cloneprotected Map
<ObjectChangeSet, Object> INTERNAL: This method returns a reference to the collectionReturn the session.getUOWCloneForObjectChangeSet
(ObjectChangeSet changeSet) ADVANCED: This method returns the Clone for a particular changeSetboolean
INTERNAL: Returns true if the Unit Of Work change Set has changesboolean
INTERNAL: Returns true if any deleted objects.boolean
INTERNAL: Returns true if this uowChangeSet contains an objectChangeSet that has forced SQL changes.boolean
INTERNAL: Get the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOWmergeObjectChanges
(ObjectChangeSet objectChangeSet, UnitOfWorkChangeSet mergeFromChangeSet) INTERNAL: This method will be used to merge a change set into an UnitOfWorkChangeSet This method returns the local instance of the changesetvoid
mergeUnitOfWorkChangeSet
(UnitOfWorkChangeSet mergeFromChangeSet, AbstractSession session, boolean postCommit) INTERNAL: THis method will be used to merge another changeset into this changeset.void
putNewObjectInChangesList
(ObjectChangeSet objectChangeSet, AbstractSession session) INTERNAL: Used to rehash the new objects back into the objectChanges list for serialization Assumes the transaction in in post commit stage.void
removeObjectChangeSet
(ObjectChangeSet changeSet) INTERNAL: Add the changed Object's records to the ChangeSet.void
removeObjectChangeSetFromNewList
(ObjectChangeSet objectChangeSet, AbstractSession session) INTERNAL: Used to remove a new object from the new objects list once it has been inserted and added to the objectChangesListvoid
setAllChangeSets
(Map allChangeSets) INTERNAL: Sets the collection of ObjectChanges in the change Set.void
setCloneToObjectChangeSet
(Map<Object, ObjectChangeSet> cloneToObjectChangeSet) INTERNAL: This method is used to set the map for cloneToObject reference.void
setDeletedObjects
(Map deletedObjects) INTERNAL: Sets the collection of deleted objects.void
setHasChanges
(boolean flag) INTERNAL: Set whether the Unit Of Work change Set has changesvoid
setIsChangeSetFromOutsideUOW
(boolean isChangeSetFromOutsideUOW) INTERNAL: Set the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOWprotected void
setObjectChanges
(Map objectChanges) INTERNAL: Sets the collection of ObjectChanges in the change Set.void
setObjectChangeSetToUOWClone
(Map<ObjectChangeSet, Object> objectChangeSetToUOWClone) INTERNAL: This method is used to insert a new collection into the UOWChangeSet.void
setSession
(AbstractSession session) INTERNAL: Set the session.
-
Field Details
-
objectChanges
This is the collection of ObjectChanges held by this ChangeSet -
newObjectChangeSets
-
cloneToObjectChangeSet
-
objectChangeSetToUOWClone
-
aggregateChangeSets
-
allChangeSets
-
deletedObjects
-
hasChanges
protected boolean hasChangesThis attribute is set to true if a changeSet with changes has been added -
hasForcedChanges
protected boolean hasForcedChanges -
isChangeSetFromOutsideUOW
protected boolean isChangeSetFromOutsideUOWFlag set when calling commitToDatabaseWithPreBuiltChangeSet so we are aware the UOW does not contain the changes from this change set. -
session
Stores unit of work before it is serialized.
-
-
Constructor Details
-
UnitOfWorkChangeSet
public UnitOfWorkChangeSet()INTERNAL: Create a ChangeSet -
UnitOfWorkChangeSet
INTERNAL: Create a ChangeSet
-
-
Method Details
-
getSession
Return the session. This only exists before serialization. -
setSession
INTERNAL: Set the session. This only exists before serialization. -
addDeletedObjects
INTERNAL: Add the Deleted objects to the changeSet. -
addDeletedObject
INTERNAL: Add the Deleted object to the changeSet. -
addObjectChangeSet
public void addObjectChangeSet(ObjectChangeSet objectChanges, AbstractSession session, boolean forceToNewObjectList) 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.- Parameters:
forceToNewObjectList
- - Any pre commit actions should pass in true since new objects have extra-handling. Anything post commit, pass in false.- See Also:
-
addNewObjectChangeSet
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.- Parameters:
objectChanges
- the new object change set- See Also:
-
findObjectChangeSet
public ObjectChangeSet findObjectChangeSet(ObjectChangeSet changeSet, 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. -
findOrIntegrateObjectChangeSet
public ObjectChangeSet findOrIntegrateObjectChangeSet(ObjectChangeSet tofind, 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 -
findOrCreateLocalObjectChangeSet
public ObjectChangeSet findOrCreateLocalObjectChangeSet(Object entityClone, ClassDescriptor descriptor, boolean isNew) INTERNAL" This method is used during the merge process to either find the existing ChangeSet or create a new one. -
addObjectChangeSetForIdentity
INTERNAL: Add change records to the lists used to maintain identity. This will not actually add the changes to 'object' to the change set.- Parameters:
objectChanges
- prototype.changeset.ObjectChanges- See Also:
-
getAggregateChangeSets
INTERNAL: Get the Aggregate list. Lazy initializes the map if required. -
getAllChangeSets
INTERNAL: This method returns a reference to the collection.- Specified by:
getAllChangeSets
in interfaceUnitOfWorkChangeSet
- Returns:
- Map
-
buildCacheCoordinationMergeChangeSet
INTERNAL: Return a new UnitOfWorkChangeSet that only includes data require for the remote merge, for cache coordination.- Parameters:
session
- current database session
-
getCloneToObjectChangeSet
INTERNAL: Get the clone to object change hash table. Lazy initializes the map if required. -
getDeletedObjects
INTERNAL: This method returns the reference to the deleted objects from the changeSet.- Specified by:
getDeletedObjects
in interfaceUnitOfWorkChangeSet
- Returns:
- Map
-
getObjectChanges
INTERNAL: Returns the ObjectChanges held by this ChangeSet. -
findUpdatedObjectsClasses
INTERNAL: Returns the set of classes corresponding to updated objects in objectChanges. -
getObjectChangeSetForClone
ADVANCED: Get ChangeSet for a particular clone- Specified by:
getObjectChangeSetForClone
in interfaceUnitOfWorkChangeSet
- Returns:
- ObjectChangeSet the changeSet that represents a particular clone
-
getObjectChangeSetToUOWClone
INTERNAL: This method returns a reference to the collection- Returns:
- Map
-
getUOWCloneForObjectChangeSet
ADVANCED: This method returns the Clone for a particular changeSet- Specified by:
getUOWCloneForObjectChangeSet
in interfaceUnitOfWorkChangeSet
- Returns:
- Object the clone represented by the changeSet
-
hasChanges
public boolean hasChanges()INTERNAL: Returns true if the Unit Of Work change Set has changes- Specified by:
hasChanges
in interfaceUnitOfWorkChangeSet
- Returns:
- boolean
-
hasDeletedObjects
public boolean hasDeletedObjects()INTERNAL: Returns true if any deleted objects. This should be used before accessing deleted object to avoid creation of map. -
setHasChanges
public void setHasChanges(boolean flag) INTERNAL: Set whether the Unit Of Work change Set has changes -
hasForcedChanges
public boolean hasForcedChanges()INTERNAL: Returns true if this uowChangeSet contains an objectChangeSet that has forced SQL changes. This is true whenever CMPPolicy.getForceUpdate() == true.- Returns:
- boolean
-
mergeObjectChanges
public ObjectChangeSet mergeObjectChanges(ObjectChangeSet objectChangeSet, 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 -
mergeUnitOfWorkChangeSet
public void mergeUnitOfWorkChangeSet(UnitOfWorkChangeSet mergeFromChangeSet, 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 accumulated changes are collected and merged at the end of the transaction. -
putNewObjectInChangesList
INTERNAL: Used to rehash the new objects back into the objectChanges list for serialization Assumes the transaction in in post commit stage. -
removeObjectChangeSetFromNewList
public void removeObjectChangeSetFromNewList(ObjectChangeSet objectChangeSet, AbstractSession session) INTERNAL: Used to remove a new object from the new objects list once it has been inserted and added to the objectChangesList -
removeObjectChangeSet
INTERNAL: Add the changed Object's records to the ChangeSet. -
setIsChangeSetFromOutsideUOW
public void setIsChangeSetFromOutsideUOW(boolean isChangeSetFromOutsideUOW) INTERNAL: Set the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOW -
isChangeSetFromOutsideUOW
public boolean isChangeSetFromOutsideUOW()INTERNAL: Get the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOW -
setCloneToObjectChangeSet
INTERNAL: This method is used to set the map for cloneToObject reference. -
setObjectChanges
INTERNAL: Sets the collection of ObjectChanges in the change Set. -
setAllChangeSets
INTERNAL: Sets the collection of ObjectChanges in the change Set. -
setDeletedObjects
INTERNAL: Sets the collection of deleted objects. -
setObjectChangeSetToUOWClone
INTERNAL: This method is used to insert a new collection into the UOWChangeSet. -
getNewObjectChangeSets
INTERNAL: This method will return a reference to the new object change set collections.
-