public class ObjectChangeSet extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<ObjectChangeSet>, ObjectChangeSet
Purpose: Hold the Records of change for a particular instance of an object.
Description: This class uses the Primary Keys of the Object it represents, and the class.
| Modifier and Type | Class and Description |
|---|---|
static class |
ObjectChangeSet.ObjectChangeSetComparator
Allow change sets to be compared by changes for batching.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_TRIES |
| Constructor and Description |
|---|
ObjectChangeSet()
The default constructor.
|
ObjectChangeSet(java.lang.Object primaryKey,
ClassDescriptor descriptor,
java.lang.Object cloneObject,
UnitOfWorkChangeSet parent,
boolean isNew)
This constructor is used to create an ObjectChangeSet that represents a regular object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChange(ChangeRecord changeRecord)
Add the attribute change record.
|
void |
clear(boolean clearKeys)
INTERNAL:
This method will clear the changerecords from a changeSet
|
int |
compareTo(ObjectChangeSet changeSet)
Determine if the receiver is greater or less than the change set.
|
boolean |
containsChangesFromSynchronization()
INTERNAL:
Convenience method used to query this change set after it has been sent by
cache synchronization.
|
void |
deferredDetectionRequiredOn(java.lang.String attributeName)
INTERNAL:
This method is used during attribute level change tracking when a particular
change was detected but that change can not be tracked (ie customer set
entire collection in object).
|
void |
ensureChanges()
INTERNAL:
Ensure the change set is populated for cache coordination.
|
boolean |
equals(java.lang.Object object)
Ensure change sets with the same primary key are equal.
|
boolean |
equals(ObjectChangeSet objectChange)
Ensure change sets with the same primary key are equal.
|
CacheKey |
getActiveCacheKey()
INTERNAL:
PERF: Return the session cache-key, cached during the merge.
|
java.util.Map |
getAttributesToChanges()
INTERNAL:
stores the change records indexed by the attribute names
|
int |
getCacheSynchronizationType() |
java.util.List<java.lang.String> |
getChangedAttributeNames()
ADVANCED:
This method will return a collection of the attributes changed in the object.
|
java.util.List<ChangeRecord> |
getChanges()
INTERNAL:
This method returns a reference to the collection of changes within this changeSet.
|
ChangeRecord |
getChangesForAttributeNamed(java.lang.String attributeName)
INTERNAL:
returns the change record for the specified attribute name
|
java.lang.String |
getClassName()
ADVANCE:
This method returns the class type that this changeSet Represents.
|
java.lang.Class |
getClassType()
INTERNAL:
This method returns the class type that this changeSet represents.
|
java.lang.Class |
getClassType(Session session)
ADVANCE:
This method returns the class type that this changeSet Represents.
|
java.util.Set<java.lang.String> |
getDeferredSet()
This set contains the list of attributes that must be calculated at commit time.
|
ClassDescriptor |
getDescriptor() |
java.lang.Object |
getId()
ADVANCED:
This method returns the primary key for the object that this change set represents.
|
java.lang.Object |
getInitialWriteLockValue()
INTERNAL:
This method is used to return the initial lock value of the object this changeSet represents.
|
java.lang.Object |
getNewKey()
This method returns the key value that this object will be stored under in it's
Respective hashmap.
|
java.lang.Object |
getOldKey()
This method returns the key value that this object was stored under in it's
Respective hashmap.
|
java.lang.Object |
getOldValue() |
java.lang.Object |
getOldValue(AbstractSession session) |
java.util.Vector |
getPrimaryKeys()
Deprecated.
|
AbstractRecord |
getProtectedForeignKeys() |
int |
getSynchronizationType() |
java.lang.Object |
getTargetVersionOfSourceObject(MergeManager mergeManager,
AbstractSession session)
INTERNAL:
This method is used to return the complex object specified within the change record.
|
java.lang.Object |
getTargetVersionOfSourceObject(MergeManager mergeManager,
AbstractSession targetSession,
boolean shouldRead)
INTERNAL:
This method is used to return the complex object specified within the change record.
|
java.lang.Object |
getUnitOfWorkClone()
INTERNAL:
Returns the UnitOfWork Clone that this ChangeSet was built for.
|
UnitOfWorkChangeSet |
getUOWChangeSet()
ADVANCED:
This method is used to return the parent UnitOfWorkChangeSet.
|
java.lang.Object |
getWriteLockValue()
INTERNAL:
This method is used to return the lock value of the object this changeSet represents.
|
boolean |
hasChangeFor(java.lang.String attributeName)
ADVANCED:
This method will return true if the specified attribute has been changed.
|
boolean |
hasChanges()
ADVANCED:
Returns true if this particular changeSet has changes.
|
boolean |
hasCmpPolicyForcedUpdate()
INTERNAL:
|
boolean |
hasDeferredAttributes()
Check to see if there are any attributes that must be calculated at commit time.
|
boolean |
hasForcedChanges()
INTERNAL:
Returns true if this particular changeSet has forced SQL changes.
|
boolean |
hasForcedChangesFromCascadeLocking()
INTERNAL:
Returns true if this particular changeSet has forced SQL changes because
of a cascade optimistic locking policy.
|
int |
hashCode()
This method overrides the hashcode method.
|
boolean |
hasKeys()
INTERNAL:
Returns true if this particular changeSet has a Key.
|
boolean |
hasProtectedForeignKeys() |
boolean |
hasVersionChange() |
boolean |
isAggregate()
INTERNAL:
Used to determine if the object change set represents an aggregate object.
|
boolean |
isInvalid()
INTERNAL:
Indicates whether the change set is invalid.
|
boolean |
isNew()
ADVANCED:
Returns true if this ObjectChangeSet represents a new object.
|
void |
mergeObjectChanges(ObjectChangeSet changeSetToMergeFrom,
UnitOfWorkChangeSet mergeToChangeSet,
UnitOfWorkChangeSet mergeFromChangeSet)
INTERNAL:
This method will be used to merge changes from a supplied ObjectChangeSet
into this changeSet.
|
void |
postSerialize(java.lang.Object clone,
UnitOfWorkChangeSet uowChangeSet,
AbstractSession session)
INTERNAL:
Reset the change set's transient variables after serialization.
|
void |
readCompleteChangeSet(java.io.ObjectInputStream stream)
INTERNAL:
Helper method used by readObject to read a completely serialized change set from
the stream.
|
void |
readIdentityInformation(java.io.ObjectInputStream stream)
INTERNAL:
Helper method used by readObject to read just the information about object identity
from a serialized stream.
|
void |
removeChange(java.lang.String attributeName)
INTERNAL:
Remove the change.
|
void |
setActiveCacheKey(CacheKey activeCacheKey)
INTERNAL:
PERF: Set the session cache-key, cached during the merge.
|
void |
setCacheSynchronizationType(int cacheSynchronizationType) |
void |
setChanges(java.util.List changesList)
Set the changes.
|
void |
setClassName(java.lang.String newValue)
INTERNAL:
Set the class name.
|
void |
setClassType(java.lang.Class newValue)
Set the class type.
|
void |
setDescriptor(ClassDescriptor descriptor) |
void |
setHasCmpPolicyForcedUpdate(boolean hasCmpPolicyForcedUpdate)
INTERNAL:
|
void |
setHasForcedChangesFromCascadeLocking(boolean newValue)
INTERNAL:
Used by calculateChanges to mark this ObjectChangeSet as having to be
flushed to the db stemming from a cascade optimistic locking policy.
|
void |
setHasVersionChange(boolean hasVersionChange) |
void |
setId(java.lang.Object id)
Set the id of the object for this change set.
|
void |
setInitialWriteLockValue(java.lang.Object initialWriteLockValue)
ADVANCED:
This method is used to set the initial writeLock value for an ObjectChangeSet.
|
void |
setIsAggregate(boolean isAggregate)
INTERNAL:
Set if this object change Set represents an aggregate
|
void |
setIsInvalid(boolean isInvalid) |
void |
setIsNew(boolean newIsNew)
INTERNAL:
Set whether this ObjectChanges represents a new Object
|
void |
setNewKey(java.lang.Object key)
This method is used to set the value that this object will be stored under in its respected
map collection
|
void |
setOldKey(java.lang.Object key)
This method is used to set the value that this object was stored under in its respected
map collection
|
void |
setOptimisticLockingPolicyAndInitialWriteLockValue(OptimisticLockingPolicy optimisticLockingPolicy,
AbstractSession session)
INTERNAL:
This method should ONLY be used to set the initial writeLock value for
an ObjectChangeSet when it is first built.
|
void |
setProtectedForeignKeys(AbstractRecord protectedForeignKeys) |
void |
setShouldBeDeleted(boolean newValue)
This method was created in VisualAge.
|
void |
setShouldModifyVersionField(java.lang.Boolean shouldModifyVersionField)
INTERNAL:
Holds a Boolean indicating whether version field should be modified.
|
void |
setShouldRecalculateAfterUpdateEvent(boolean shouldRecalculateAfterUpdateEvent)
ADVANCED
Set whether this ObjectChangeSet should be recalculated after changes in event
|
void |
setSynchronizationType(int type) |
void |
setUnitOfWorkClone(java.lang.Object cloneObject)
INTERNAL:
Sets the UnitOfWork Clone that this ChangeSet was built for.
|
void |
setUOWChangeSet(UnitOfWorkChangeSet newUnitOfWorkChangeSet)
INTERNAL:
Used to set the parent change Set.
|
void |
setWriteLockValue(java.lang.Object newWriteLockValue)
ADVANCED:
This method is used to set the writeLock value for an ObjectChangeSet
Any changes to the write lock value
should to through setWriteLockValue(Object obj) so that the change set is
marked as being dirty.
|
boolean |
shouldBeDeleted()
Mark change set for a deleted object.
|
boolean |
shouldInvalidateObject(java.lang.Object original,
AbstractSession session)
INTERNAL:
Indicates whether the object in session cache should be invalidated.
|
java.lang.Boolean |
shouldModifyVersionField()
INTERNAL:
Holds a Boolean indicating whether version field should be modified.
|
boolean |
shouldRecalculateAfterUpdateEvent()
ADVANCED
Returns true if this ObjectChangeSet should be recalculated after changes in event
|
java.lang.String |
toString() |
void |
updateChangeRecordForAttribute(DatabaseMapping mapping,
java.lang.Object value,
AbstractSession session,
java.lang.Object oldValue)
INTERNAL:
Used to update a changeRecord that is stored in the CHangeSet with a new value.
|
void |
updateChangeRecordForAttribute(java.lang.String attributeName,
java.lang.Object value)
INTERNAL:
Used to update a changeRecord that is stored in the CHangeSet with a new value.
|
void |
updateChangeRecordForAttributeWithMappedObject(java.lang.String attributeName,
java.lang.Object value,
AbstractSession session)
ADVANCED:
Used to update a changeRecord that is stored in the CHangeSet with a new value.
|
void |
updateReferences(UnitOfWorkChangeSet localChangeSet,
UnitOfWorkChangeSet mergingChangeSet)
INTERNAL:
This method will be used when merging changesets into other changesets.
|
void |
writeCompleteChangeSet(java.io.ObjectOutputStream stream)
INTERNAL:
Helper method to readObject.
|
void |
writeIdentityInformation(java.io.ObjectOutputStream stream)
INTERNAL:
Helper method to writeObject.
|
public ObjectChangeSet()
public ObjectChangeSet(java.lang.Object primaryKey,
ClassDescriptor descriptor,
java.lang.Object cloneObject,
UnitOfWorkChangeSet parent,
boolean isNew)
public ClassDescriptor getDescriptor()
public void setDescriptor(ClassDescriptor descriptor)
public void clear(boolean clearKeys)
public void addChange(ChangeRecord changeRecord)
public void deferredDetectionRequiredOn(java.lang.String attributeName)
public boolean containsChangesFromSynchronization()
public boolean equals(java.lang.Object object)
equals in interface ObjectChangeSetequals in class java.lang.Objectpublic boolean equals(ObjectChangeSet objectChange)
public int compareTo(ObjectChangeSet changeSet)
compareTo in interface java.lang.Comparable<ObjectChangeSet>public java.util.Map getAttributesToChanges()
public ChangeRecord getChangesForAttributeNamed(java.lang.String attributeName)
getChangesForAttributeNamed in interface ObjectChangeSetpublic java.util.List<java.lang.String> getChangedAttributeNames()
getChangedAttributeNames in interface ObjectChangeSetpublic java.util.List<ChangeRecord> getChanges()
getChanges in interface ObjectChangeSetpublic java.lang.Class getClassType()
public java.lang.Class getClassType(Session session)
getClassType in interface ObjectChangeSetpublic java.lang.String getClassName()
getClassName in interface ObjectChangeSetpublic java.lang.Object getInitialWriteLockValue()
public java.lang.Object getOldKey()
getOldKey in interface ObjectChangeSetpublic java.lang.Object getNewKey()
getNewKey in interface ObjectChangeSet@Deprecated public java.util.Vector getPrimaryKeys()
getPrimaryKeys in interface ObjectChangeSetObjectChangeSet.getId()public java.lang.Object getId()
getId in interface ObjectChangeSetpublic java.lang.Object getOldValue()
public java.lang.Object getOldValue(AbstractSession session)
public int getSynchronizationType()
public java.lang.Object getTargetVersionOfSourceObject(MergeManager mergeManager, AbstractSession session)
public java.lang.Object getTargetVersionOfSourceObject(MergeManager mergeManager, AbstractSession targetSession, boolean shouldRead)
shouldRead - boolean if the object can not be found should it be read in from the database.public java.lang.Object getUnitOfWorkClone()
public void setUnitOfWorkClone(java.lang.Object cloneObject)
public UnitOfWorkChangeSet getUOWChangeSet()
getUOWChangeSet in interface ObjectChangeSetpublic java.lang.Object getWriteLockValue()
getWriteLockValue in interface ObjectChangeSetpublic boolean hasChangeFor(java.lang.String attributeName)
hasChangeFor in interface ObjectChangeSetattributeName - the name of the attribute to search for.public boolean hasChanges()
hasChanges in interface ObjectChangeSetpublic boolean hasForcedChanges()
public void setShouldModifyVersionField(java.lang.Boolean shouldModifyVersionField)
public java.lang.Boolean shouldModifyVersionField()
public void setHasCmpPolicyForcedUpdate(boolean hasCmpPolicyForcedUpdate)
public boolean hasCmpPolicyForcedUpdate()
public boolean hasForcedChangesFromCascadeLocking()
public void setHasForcedChangesFromCascadeLocking(boolean newValue)
public int hashCode()
hashCode in class java.lang.Objectpublic boolean hasKeys()
public boolean isAggregate()
public boolean isNew()
isNew in interface ObjectChangeSetpublic boolean isInvalid()
public void mergeObjectChanges(ObjectChangeSet changeSetToMergeFrom, UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)
public void readCompleteChangeSet(java.io.ObjectInputStream stream)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic void readIdentityInformation(java.io.ObjectInputStream stream)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic void setId(java.lang.Object id)
public void setChanges(java.util.List changesList)
public void setClassType(java.lang.Class newValue)
public void setClassName(java.lang.String newValue)
public void setIsAggregate(boolean isAggregate)
isAggregate - boolean true if the ChangeSet represents an aggregatepublic void setIsNew(boolean newIsNew)
newIsNew - boolean true if this ChangeSet represents a new objectpublic void setOldKey(java.lang.Object key)
public void setNewKey(java.lang.Object key)
public void setShouldBeDeleted(boolean newValue)
newValue - booleanpublic void setSynchronizationType(int type)
public void setUOWChangeSet(UnitOfWorkChangeSet newUnitOfWorkChangeSet)
public void setOptimisticLockingPolicyAndInitialWriteLockValue(OptimisticLockingPolicy optimisticLockingPolicy, AbstractSession session)
public void setWriteLockValue(java.lang.Object newWriteLockValue)
public void setInitialWriteLockValue(java.lang.Object initialWriteLockValue)
public boolean shouldBeDeleted()
public java.lang.String toString()
toString in class java.lang.Objectpublic void updateChangeRecordForAttribute(java.lang.String attributeName,
java.lang.Object value)
public void updateChangeRecordForAttributeWithMappedObject(java.lang.String attributeName,
java.lang.Object value,
AbstractSession session)
public void updateChangeRecordForAttribute(DatabaseMapping mapping, java.lang.Object value, AbstractSession session, java.lang.Object oldValue)
public void updateReferences(UnitOfWorkChangeSet localChangeSet, UnitOfWorkChangeSet mergingChangeSet)
public void writeIdentityInformation(java.io.ObjectOutputStream stream)
throws java.io.IOException
java.io.IOExceptionpublic void writeCompleteChangeSet(java.io.ObjectOutputStream stream)
throws java.io.IOException
java.io.IOExceptionpublic void ensureChanges()
public void postSerialize(java.lang.Object clone,
UnitOfWorkChangeSet uowChangeSet,
AbstractSession session)
public java.util.Set<java.lang.String> getDeferredSet()
public boolean hasDeferredAttributes()
public void removeChange(java.lang.String attributeName)
public boolean shouldInvalidateObject(java.lang.Object original,
AbstractSession session)
original - Object is from session's cache into which the changes are about to be merged, non null.session - AbstractSession into which the changes are about to be merged;public CacheKey getActiveCacheKey()
public void setActiveCacheKey(CacheKey activeCacheKey)
public boolean shouldRecalculateAfterUpdateEvent()
shouldRecalculateAfterUpdateEvent in interface ObjectChangeSetpublic void setShouldRecalculateAfterUpdateEvent(boolean shouldRecalculateAfterUpdateEvent)
setShouldRecalculateAfterUpdateEvent in interface ObjectChangeSetpublic boolean hasVersionChange()
public void setHasVersionChange(boolean hasVersionChange)
public int getCacheSynchronizationType()
public void setCacheSynchronizationType(int cacheSynchronizationType)
public void setIsInvalid(boolean isInvalid)
public AbstractRecord getProtectedForeignKeys()
public void setProtectedForeignKeys(AbstractRecord protectedForeignKeys)
public boolean hasProtectedForeignKeys()
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference