Class DeferredChangeDetectionPolicy
- java.lang.Object
-
- org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy
-
- All Implemented Interfaces:
java.io.Serializable,ObjectChangePolicy
- Direct Known Subclasses:
ObjectChangeTrackingPolicy
public class DeferredChangeDetectionPolicy extends java.lang.Object implements ObjectChangePolicy, java.io.Serializable
PUBLIC: A DeferredChangeDetectionPolicy defers all change detection to the UnitOfWork's change detection process. Essentially, the calculateChanges() method will run for all objects in a UnitOfWork. This is the default ObjectChangePolicy unless weaving is used.- See Also:
- Serialized Form
- Author:
- Tom Ware
-
-
Constructor Summary
Constructors Constructor Description DeferredChangeDetectionPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectbuildBackupClone(java.lang.Object clone, org.eclipse.persistence.internal.descriptors.ObjectBuilder builder, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)INTERNAL: Build back up clone.org.eclipse.persistence.internal.sessions.ObjectChangeSetcalculateChanges(java.lang.Object clone, java.lang.Object backUp, boolean isNew, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)INTERNAL: calculateChanges creates a change set for a particular object.org.eclipse.persistence.internal.sessions.ObjectChangeSetcalculateChangesForExistingObject(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)INTERNAL: PERF: Calculate change for the new object, avoids check for new since already know.org.eclipse.persistence.internal.sessions.ObjectChangeSetcalculateChangesForNewObject(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)INTERNAL: PERF: Calculate change for the new object, avoids check for new since already know.voidclearChanges(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor, boolean forRefresh)INTERNAL: This is a place holder for reseting the listener on one of the subclassesorg.eclipse.persistence.internal.sessions.ObjectChangeSetcreateObjectChangeSet(java.lang.Object clone, java.lang.Object backUp, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, boolean isNew, org.eclipse.persistence.internal.sessions.AbstractSession session, ClassDescriptor descriptor)INTERNAL: Create ObjectChangeSetorg.eclipse.persistence.internal.sessions.ObjectChangeSetcreateObjectChangeSetThroughComparison(java.lang.Object clone, java.lang.Object backUp, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, boolean isNew, org.eclipse.persistence.internal.sessions.AbstractSession session, ClassDescriptor descriptor)INTERNAL: Create ObjectChangeSetvoiddissableEventProcessing(java.lang.Object changeTracker)INTERNAL: This method is used to disable changetracking temporarilyvoidenableEventProcessing(java.lang.Object changeTracker)INTERNAL: This method is used to enable changetracking temporarilyvoidinitialize(org.eclipse.persistence.internal.sessions.AbstractSession session, ClassDescriptor descriptor)INTERNAL: initialize the PolicybooleanisAttributeChangeTrackingPolicy()Used to track instances of the change policies without doing an instance of checkbooleanisDeferredChangeDetectionPolicy()Used to track instances of the change policies without doing an instance of checkbooleanisObjectChangeTrackingPolicy()Used to track instances of the change policies without doing an instance of checkvoidraiseInternalPropertyChangeEvent(java.lang.Object source, java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)INTERNAL: This may cause a property change event to be raised to a listener in the case that a listener exists.voidrevertChanges(java.lang.Object clone, ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map cloneMapping, boolean forRefresh)INTERNAL: This method is used to revert an object within the unit of workvoidsetAggregateChangeListener(java.lang.Object parent, java.lang.Object aggregate, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor, java.lang.String mappingAttribute)INTERNAL: Assign ChangeListener to an aggregate objectjava.beans.PropertyChangeListenersetChangeListener(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor)INTERNAL: Set ChangeListener for the clonevoidsetChangeSetOnListener(org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, java.lang.Object clone)INTERNAL: Set the ObjectChangeSet on the Listener, initially used for aggregate supportbooleanshouldCompareExistingObjectForChange(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor)INTERNAL: Return true if the Object should be compared, false otherwise.voidupdateListenerForSelfMerge(org.eclipse.persistence.internal.descriptors.changetracking.ObjectChangeListener listener, ForeignReferenceMapping mapping, java.lang.Object source, java.lang.Object target, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)INTERNAL: In cases where a relationship with detached or new entities is merged into itself previous changes may have been recorded for the detached/new entity that need to be updated.voidupdateWithChanges(java.lang.Object clone, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor)INTERNAL: Clear changes in the ChangeListener of the clone
-
-
-
Method Detail
-
calculateChangesForNewObject
public org.eclipse.persistence.internal.sessions.ObjectChangeSet calculateChangesForNewObject(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)INTERNAL: PERF: Calculate change for the new object, avoids check for new since already know.- Specified by:
calculateChangesForNewObjectin interfaceObjectChangePolicy- Parameters:
clone- the Object to compute a change set forchangeSet- the change set to add changes tounitOfWork- the current sessiondescriptor- the descriptor for this objectshouldRaiseEvent- indicates whether PreUpdate event should be risen (usually true)- Returns:
- ObjectChangeSet an object change set describing the changes to this object
-
calculateChangesForExistingObject
public org.eclipse.persistence.internal.sessions.ObjectChangeSet calculateChangesForExistingObject(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)INTERNAL: PERF: Calculate change for the new object, avoids check for new since already know.- Specified by:
calculateChangesForExistingObjectin interfaceObjectChangePolicy- Parameters:
clone- the Object to compute a change set forchangeSet- the change set to add changes tounitOfWork- the current sessiondescriptor- the descriptor for this objectshouldRaiseEvent- indicates whether PreUpdate event should be risen (usually true)- Returns:
- ObjectChangeSet an object change set describing the changes to this object
-
calculateChanges
public org.eclipse.persistence.internal.sessions.ObjectChangeSet calculateChanges(java.lang.Object clone, java.lang.Object backUp, boolean isNew, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)INTERNAL: calculateChanges creates a change set for a particular object. In DeferredChangeDetectionPolicy all mappings will be compared against a backup copy of the object.- Specified by:
calculateChangesin interfaceObjectChangePolicy- Parameters:
clone- the Object to compute a change set forbackUp- the old version of the object to use for comparisonchangeSet- the change set to add changes tounitOfWork- the current sessiondescriptor- the descriptor for this objectshouldRaiseEvent- indicates whether PreUpdate event should be risen (usually true)isNew- determines if the object is new- Returns:
- an object change set describing the changes to this object
-
clearChanges
public void clearChanges(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor, boolean forRefresh)INTERNAL: This is a place holder for reseting the listener on one of the subclasses- Specified by:
clearChangesin interfaceObjectChangePolicy
-
createObjectChangeSet
public org.eclipse.persistence.internal.sessions.ObjectChangeSet createObjectChangeSet(java.lang.Object clone, java.lang.Object backUp, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, boolean isNew, org.eclipse.persistence.internal.sessions.AbstractSession session, ClassDescriptor descriptor)INTERNAL: Create ObjectChangeSet
-
createObjectChangeSetThroughComparison
public org.eclipse.persistence.internal.sessions.ObjectChangeSet createObjectChangeSetThroughComparison(java.lang.Object clone, java.lang.Object backUp, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changeSet, boolean isNew, org.eclipse.persistence.internal.sessions.AbstractSession session, ClassDescriptor descriptor)INTERNAL: Create ObjectChangeSet- Specified by:
createObjectChangeSetThroughComparisonin interfaceObjectChangePolicy
-
dissableEventProcessing
public void dissableEventProcessing(java.lang.Object changeTracker)
INTERNAL: This method is used to disable changetracking temporarily- Specified by:
dissableEventProcessingin interfaceObjectChangePolicy
-
enableEventProcessing
public void enableEventProcessing(java.lang.Object changeTracker)
INTERNAL: This method is used to enable changetracking temporarily- Specified by:
enableEventProcessingin interfaceObjectChangePolicy
-
shouldCompareExistingObjectForChange
public boolean shouldCompareExistingObjectForChange(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor)INTERNAL: Return true if the Object should be compared, false otherwise. In DeferredChangeDetectionPolicy, true is always returned since always allow the UnitOfWork to calculate changes.- Specified by:
shouldCompareExistingObjectForChangein interfaceObjectChangePolicy- Parameters:
object- the object that will be comparedunitOfWork- the active unitOfWorkdescriptor- the descriptor for the current object
-
buildBackupClone
public java.lang.Object buildBackupClone(java.lang.Object clone, org.eclipse.persistence.internal.descriptors.ObjectBuilder builder, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)INTERNAL: Build back up clone. Used if clone is new because listener should not be set.- Specified by:
buildBackupClonein interfaceObjectChangePolicy
-
setAggregateChangeListener
public void setAggregateChangeListener(java.lang.Object parent, java.lang.Object aggregate, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor, java.lang.String mappingAttribute)INTERNAL: Assign ChangeListener to an aggregate object- Specified by:
setAggregateChangeListenerin interfaceObjectChangePolicy
-
setChangeListener
public java.beans.PropertyChangeListener setChangeListener(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor)INTERNAL: Set ChangeListener for the clone- Specified by:
setChangeListenerin interfaceObjectChangePolicy
-
setChangeSetOnListener
public void setChangeSetOnListener(org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, java.lang.Object clone)INTERNAL: Set the ObjectChangeSet on the Listener, initially used for aggregate support- Specified by:
setChangeSetOnListenerin interfaceObjectChangePolicy
-
updateWithChanges
public void updateWithChanges(java.lang.Object clone, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor)INTERNAL: Clear changes in the ChangeListener of the clone- Specified by:
updateWithChangesin interfaceObjectChangePolicy
-
raiseInternalPropertyChangeEvent
public void raiseInternalPropertyChangeEvent(java.lang.Object source, java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)INTERNAL: This may cause a property change event to be raised to a listener in the case that a listener exists. If there is no listener then this call is a no-op- Specified by:
raiseInternalPropertyChangeEventin interfaceObjectChangePolicy
-
revertChanges
public void revertChanges(java.lang.Object clone, ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map cloneMapping, boolean forRefresh)INTERNAL: This method is used to revert an object within the unit of work- Specified by:
revertChangesin interfaceObjectChangePolicy- Parameters:
cloneMapping- may not be the same as what is in the uow
-
initialize
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session, ClassDescriptor descriptor)INTERNAL: initialize the Policy- Specified by:
initializein interfaceObjectChangePolicy
-
isDeferredChangeDetectionPolicy
public boolean isDeferredChangeDetectionPolicy()
Used to track instances of the change policies without doing an instance of check- Specified by:
isDeferredChangeDetectionPolicyin interfaceObjectChangePolicy
-
isObjectChangeTrackingPolicy
public boolean isObjectChangeTrackingPolicy()
Used to track instances of the change policies without doing an instance of check- Specified by:
isObjectChangeTrackingPolicyin interfaceObjectChangePolicy
-
isAttributeChangeTrackingPolicy
public boolean isAttributeChangeTrackingPolicy()
Used to track instances of the change policies without doing an instance of check- Specified by:
isAttributeChangeTrackingPolicyin interfaceObjectChangePolicy
-
updateListenerForSelfMerge
public void updateListenerForSelfMerge(org.eclipse.persistence.internal.descriptors.changetracking.ObjectChangeListener listener, ForeignReferenceMapping mapping, java.lang.Object source, java.lang.Object target, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)INTERNAL: In cases where a relationship with detached or new entities is merged into itself previous changes may have been recorded for the detached/new entity that need to be updated.- Specified by:
updateListenerForSelfMergein interfaceObjectChangePolicy
-
-