Interface ObjectChangePolicy
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
AttributeChangeTrackingPolicy
,DeferredChangeDetectionPolicy
,ObjectChangeTrackingPolicy
public interface ObjectChangePolicy extends java.io.Serializable
INTERNAL: Implementers of ObjectChangePolicy implement the code which computes changes sets for the UnitOfWork commit process. An ObjectChangePolicy is stored on an Object's descriptor.- See Also:
DeferredChangeDetectionPolicy
,ObjectChangeTrackingPolicy
,AttributeChangeTrackingPolicy
- Author:
- Tom Ware
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.org.eclipse.persistence.internal.sessions.ObjectChangeSet
calculateChanges(java.lang.Object clone, java.lang.Object backupClone, boolean isNew, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changes, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)
INTERNAL: CalculateChanges creates a change set for an existing object.org.eclipse.persistence.internal.sessions.ObjectChangeSet
calculateChangesForExistingObject(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changes, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)
INTERNAL: CalculateChanges creates a change set for an existing object.org.eclipse.persistence.internal.sessions.ObjectChangeSet
calculateChangesForNewObject(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changes, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)
INTERNAL: CalculateChanges creates a change set for a new object.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 subclassesorg.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 through comparison.void
dissableEventProcessing(java.lang.Object changeTracker)
INTERNAL: This method is used to disable changetracking temporarilyvoid
enableEventProcessing(java.lang.Object changeTracker)
INTERNAL: This method is used to enable changetracking temporarilyvoid
initialize(org.eclipse.persistence.internal.sessions.AbstractSession session, ClassDescriptor descriptor)
INTERNAL: initialize the Policyboolean
isAttributeChangeTrackingPolicy()
Used to track instances of the change policies without doing an instance of checkboolean
isDeferredChangeDetectionPolicy()
Used to track instances of the change policies without doing an instance of checkboolean
isObjectChangeTrackingPolicy()
Used to track instances of the change policies without doing an instance of checkvoid
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.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 workvoid
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 objectjava.beans.PropertyChangeListener
setChangeListener(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor)
INTERNAL: Assign appropriate ChangeListener to PropertyChangeListener based on the policy.void
setChangeSetOnListener(org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, java.lang.Object clone)
INTERNAL: Set the ObjectChangeSet on the Listener, initially used for aggregate supportboolean
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.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.void
updateWithChanges(java.lang.Object clone, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor)
INTERNAL: This method is used internally to rest the policies back to original state This is used when the clones are to be reused.
-
-
-
Method Detail
-
calculateChangesForNewObject
org.eclipse.persistence.internal.sessions.ObjectChangeSet calculateChangesForNewObject(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changes, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)
INTERNAL: CalculateChanges creates a change set for a new object.- Parameters:
clone
- the Object to compute a change set forchanges
- 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
org.eclipse.persistence.internal.sessions.ObjectChangeSet calculateChangesForExistingObject(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changes, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)
INTERNAL: CalculateChanges creates a change set for an existing object.- Parameters:
clone
- the Object to compute a change set forchanges
- 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
org.eclipse.persistence.internal.sessions.ObjectChangeSet calculateChanges(java.lang.Object clone, java.lang.Object backupClone, boolean isNew, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet changes, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, ClassDescriptor descriptor, boolean shouldRaiseEvent)
INTERNAL: CalculateChanges creates a change set for an existing object.- Parameters:
clone
- the object to compute a change set forbackupClone
- the object used to compute changes fromisNew
- determines if the object is newchanges
- 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
-
createObjectChangeSetThroughComparison
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 through comparison. Used in cases where we need to force change calculation (ie aggregates)
-
updateListenerForSelfMerge
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.
-
dissableEventProcessing
void dissableEventProcessing(java.lang.Object changeTracker)
INTERNAL: This method is used to disable changetracking temporarily
-
enableEventProcessing
void enableEventProcessing(java.lang.Object changeTracker)
INTERNAL: This method is used to enable changetracking temporarily
-
raiseInternalPropertyChangeEvent
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
-
revertChanges
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
-
clearChanges
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
-
updateWithChanges
void updateWithChanges(java.lang.Object clone, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor)
INTERNAL: This method is used internally to rest the policies back to original state This is used when the clones are to be reused.
-
shouldCompareExistingObjectForChange
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. This method is implemented to allow run time determination of whether a change set should be computed for an object. In general, calculateChanges() will only be executed in a UnitOfWork if this method returns true.- Parameters:
object
- the object that will be comparedunitOfWork
- the active unitOfWorkdescriptor
- the descriptor for the current object
-
setAggregateChangeListener
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
-
setChangeListener
java.beans.PropertyChangeListener setChangeListener(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, ClassDescriptor descriptor)
INTERNAL: Assign appropriate ChangeListener to PropertyChangeListener based on the policy.
-
setChangeSetOnListener
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
-
buildBackupClone
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.
-
initialize
void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session, ClassDescriptor descriptor)
INTERNAL: initialize the Policy
-
isDeferredChangeDetectionPolicy
boolean isDeferredChangeDetectionPolicy()
Used to track instances of the change policies without doing an instance of check
-
isObjectChangeTrackingPolicy
boolean isObjectChangeTrackingPolicy()
Used to track instances of the change policies without doing an instance of check
-
isAttributeChangeTrackingPolicy
boolean isAttributeChangeTrackingPolicy()
Used to track instances of the change policies without doing an instance of check
-
-