Class ObjectChangeSet
- java.lang.Object
-
- org.eclipse.persistence.internal.sessions.ObjectChangeSet
-
- All Implemented Interfaces:
Serializable
,Comparable<ObjectChangeSet>
,ObjectChangeSet
- Direct Known Subclasses:
AggregateObjectChangeSet
public class ObjectChangeSet extends Object implements Serializable, 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.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ObjectChangeSet.ObjectChangeSetComparator
Allow change sets to be compared by changes for batching.
-
Field Summary
Fields Modifier and Type Field Description protected CacheKey
activeCacheKey
PERF: Cache the session cacheKey during the merge to avoid duplicate lookups.protected Map<String,ChangeRecord>
attributesToChanges
protected int
cacheSynchronizationType
Used to store the type of cache synchronization used for this object This variable is set just before the change set is serialized.protected List<ChangeRecord>
changes
This is the collection of changesprotected String
className
protected Class
classType
protected Object
cloneObject
protected Set<String>
deferredSet
This 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).protected ClassDescriptor
descriptor
Cache the descriptor as it is useful and required in some places.protected boolean
hasChangesFromCascadeLocking
protected boolean
hasCmpPolicyForcedUpdate
For CMP only: indicates that the object should be force updated (whether it has OptimisticLocking or not): getCmpPolicy().getForcedUpdate()==trueprotected boolean
hasVersionChange
protected Object
id
protected Object
initialWriteLockValue
protected boolean
isAggregate
protected boolean
isInvalid
Invalid change set shouldn't be merged into object in cache, rather the object should be invalidatedprotected boolean
isNew
static int
MAX_TRIES
protected Object
newKey
protected Object
oldKey
protected OptimisticLockingPolicy
optimisticLockingPolicy
Used in mergeObjectChanges method for writeLock and initialWriteLock comparison of the merged change setsprotected AbstractRecord
protectedForeignKeys
protected boolean
shouldBeDeleted
protected Boolean
shouldModifyVersionField
Contains optimisticReadLockObject corresponding to the clone, non-null indicates forced changesprotected boolean
shouldRecalculateAfterUpdateEvent
return whether this change set should be recalculated after an event changes the objectprotected UnitOfWorkChangeSet
unitOfWorkChangeSet
This member variable holds the reference to the parent UnitOfWork Change Setprotected Object
writeLockValue
-
Constructor Summary
Constructors Constructor Description ObjectChangeSet()
The default constructor.ObjectChangeSet(Object primaryKey, ClassDescriptor descriptor, Object cloneObject, UnitOfWorkChangeSet parent, boolean isNew)
This constructor is used to create an ObjectChangeSet that represents a regular object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChange(ChangeRecord changeRecord)
Add the attribute change record.void
clear(boolean clearKeys)
INTERNAL: This method will clear the changerecords from a changeSetint
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(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).protected void
dirtyUOWChangeSet()
boolean
equals(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.Map
getAttributesToChanges()
INTERNAL: stores the change records indexed by the attribute namesint
getCacheSynchronizationType()
List<String>
getChangedAttributeNames()
ADVANCED: This method will return a collection of the attributes changed in the object.List<ChangeRecord>
getChanges()
INTERNAL: This method returns a reference to the collection of changes within this changeSet.ChangeRecord
getChangesForAttributeNamed(String attributeName)
INTERNAL: returns the change record for the specified attribute nameString
getClassName()
ADVANCE: This method returns the class type that this changeSet Represents.Class
getClassType()
INTERNAL: This method returns the class type that this changeSet represents.Class
getClassType(Session session)
ADVANCE: This method returns the class type that this changeSet Represents.Set<String>
getDeferredSet()
This set contains the list of attributes that must be calculated at commit time.ClassDescriptor
getDescriptor()
Object
getId()
ADVANCED: This method returns the primary key for the object that this change set represents.Object
getInitialWriteLockValue()
INTERNAL: This method is used to return the initial lock value of the object this changeSet represents.Object
getNewKey()
This method returns the key value that this object will be stored under in it's Respective hashmap.protected Object
getObjectForMerge(MergeManager mergeManager, AbstractSession session, Object primaryKey, ClassDescriptor descriptor)
INTERNAL: For use within the distributed merge process, this method will get an object from the shared cache using a readlock.Object
getOldKey()
This method returns the key value that this object was stored under in it's Respective hashmap.Object
getOldValue()
Object
getOldValue(AbstractSession session)
AbstractRecord
getProtectedForeignKeys()
int
getSynchronizationType()
Object
getTargetVersionOfSourceObject(MergeManager mergeManager, AbstractSession session)
INTERNAL: This method is used to return the complex object specified within the change record.Object
getTargetVersionOfSourceObject(MergeManager mergeManager, AbstractSession targetSession, boolean shouldRead)
INTERNAL: This method is used to return the complex object specified within the change record.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.Object
getWriteLockValue()
INTERNAL: This method is used to return the lock value of the object this changeSet represents.boolean
hasChangeFor(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(Object clone, UnitOfWorkChangeSet uowChangeSet, AbstractSession session)
INTERNAL: Reset the change set's transient variables after serialization.void
readCompleteChangeSet(ObjectInputStream stream)
INTERNAL: Helper method used by readObject to read a completely serialized change set from the stream.void
readIdentityInformation(ObjectInputStream stream)
INTERNAL: Helper method used by readObject to read just the information about object identity from a serialized stream.protected void
rebuildWriteLockValueFromUserFormat(ClassDescriptor descriptor, AbstractSession session)
Rebuild writeLockValue to the expected type from user format i.e XML change set has all values as String.void
removeChange(String attributeName)
INTERNAL: Remove the change.protected void
removeFromIdentityMap(AbstractSession session)
Remove object represent this change set from identity map.void
setActiveCacheKey(CacheKey activeCacheKey)
INTERNAL: PERF: Set the session cache-key, cached during the merge.void
setCacheSynchronizationType(int cacheSynchronizationType)
void
setChanges(List changesList)
Set the changes.void
setClassName(String newValue)
INTERNAL: Set the class name.void
setClassType(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(Object id)
Set the id of the object for this change set.void
setInitialWriteLockValue(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 aggregatevoid
setIsInvalid(boolean isInvalid)
void
setIsNew(boolean newIsNew)
INTERNAL: Set whether this ObjectChanges represents a new Objectvoid
setNewKey(Object key)
This method is used to set the value that this object will be stored under in its respected map collectionvoid
setOldKey(Object key)
This method is used to set the value that this object was stored under in its respected map collectionvoid
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(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 eventvoid
setSynchronizationType(int type)
void
setUnitOfWorkClone(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(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(Object original, AbstractSession session)
INTERNAL: Indicates whether the object in session cache should be invalidated.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 eventString
toString()
void
updateChangeRecordForAttribute(String attributeName, Object value)
INTERNAL: Used to update a changeRecord that is stored in the CHangeSet with a new value.void
updateChangeRecordForAttribute(DatabaseMapping mapping, Object value, AbstractSession session, Object oldValue)
INTERNAL: Used to update a changeRecord that is stored in the CHangeSet with a new value.void
updateChangeRecordForAttributeWithMappedObject(String attributeName, 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.protected void
updateUOWChangeSet()
void
writeCompleteChangeSet(ObjectOutputStream stream)
INTERNAL: Helper method to readObject.void
writeIdentityInformation(ObjectOutputStream stream)
INTERNAL: Helper method to writeObject.
-
-
-
Field Detail
-
changes
protected List<ChangeRecord> changes
This is the collection of changes
-
attributesToChanges
protected transient Map<String,ChangeRecord> attributesToChanges
-
shouldBeDeleted
protected boolean shouldBeDeleted
-
id
protected Object id
-
classType
protected transient Class classType
-
className
protected String className
-
isNew
protected boolean isNew
-
isAggregate
protected boolean isAggregate
-
oldKey
protected Object oldKey
-
newKey
protected Object newKey
-
protectedForeignKeys
protected AbstractRecord protectedForeignKeys
-
unitOfWorkChangeSet
protected transient UnitOfWorkChangeSet unitOfWorkChangeSet
This member variable holds the reference to the parent UnitOfWork Change Set
-
optimisticLockingPolicy
protected transient OptimisticLockingPolicy optimisticLockingPolicy
Used in mergeObjectChanges method for writeLock and initialWriteLock comparison of the merged change sets
-
initialWriteLockValue
protected Object initialWriteLockValue
-
writeLockValue
protected Object writeLockValue
-
isInvalid
protected boolean isInvalid
Invalid change set shouldn't be merged into object in cache, rather the object should be invalidated
-
cloneObject
protected transient Object cloneObject
-
hasVersionChange
protected boolean hasVersionChange
-
shouldModifyVersionField
protected Boolean shouldModifyVersionField
Contains optimisticReadLockObject corresponding to the clone, non-null indicates forced changes
-
hasCmpPolicyForcedUpdate
protected transient boolean hasCmpPolicyForcedUpdate
For CMP only: indicates that the object should be force updated (whether it has OptimisticLocking or not): getCmpPolicy().getForcedUpdate()==true
-
hasChangesFromCascadeLocking
protected transient boolean hasChangesFromCascadeLocking
-
deferredSet
protected transient Set<String> deferredSet
This 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).
-
cacheSynchronizationType
protected int cacheSynchronizationType
Used to store the type of cache synchronization used for this object This variable is set just before the change set is serialized.
-
activeCacheKey
protected transient CacheKey activeCacheKey
PERF: Cache the session cacheKey during the merge to avoid duplicate lookups.
-
descriptor
protected transient ClassDescriptor descriptor
Cache the descriptor as it is useful and required in some places.
-
shouldRecalculateAfterUpdateEvent
protected transient boolean shouldRecalculateAfterUpdateEvent
return whether this change set should be recalculated after an event changes the object
-
MAX_TRIES
public static final int MAX_TRIES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ObjectChangeSet
public ObjectChangeSet()
The default constructor.
-
ObjectChangeSet
public ObjectChangeSet(Object primaryKey, ClassDescriptor descriptor, Object cloneObject, UnitOfWorkChangeSet parent, boolean isNew)
This constructor is used to create an ObjectChangeSet that represents a regular object.
-
-
Method Detail
-
getDescriptor
public ClassDescriptor getDescriptor()
-
setDescriptor
public void setDescriptor(ClassDescriptor descriptor)
-
clear
public void clear(boolean clearKeys)
INTERNAL: This method will clear the changerecords from a changeSet
-
addChange
public void addChange(ChangeRecord changeRecord)
Add the attribute change record.
-
deferredDetectionRequiredOn
public void deferredDetectionRequiredOn(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). In this case flag this attribute for deferred change detection at commit time.
-
containsChangesFromSynchronization
public boolean containsChangesFromSynchronization()
INTERNAL: Convenience method used to query this change set after it has been sent by cache synchronization.- Returns:
- true if this change set should contain all change information, false if only the identity information should be available.
-
equals
public boolean equals(Object object)
Ensure change sets with the same primary key are equal.- Specified by:
equals
in interfaceObjectChangeSet
- Overrides:
equals
in classObject
-
equals
public boolean equals(ObjectChangeSet objectChange)
Ensure change sets with the same primary key are equal.
-
compareTo
public int compareTo(ObjectChangeSet changeSet)
Determine if the receiver is greater or less than the change set.- Specified by:
compareTo
in interfaceComparable<ObjectChangeSet>
-
getAttributesToChanges
public Map getAttributesToChanges()
INTERNAL: stores the change records indexed by the attribute names
-
getChangesForAttributeNamed
public ChangeRecord getChangesForAttributeNamed(String attributeName)
INTERNAL: returns the change record for the specified attribute name- Specified by:
getChangesForAttributeNamed
in interfaceObjectChangeSet
-
getChangedAttributeNames
public List<String> getChangedAttributeNames()
ADVANCED: This method will return a collection of the attributes changed in the object.- Specified by:
getChangedAttributeNames
in interfaceObjectChangeSet
-
getChanges
public List<ChangeRecord> getChanges()
INTERNAL: This method returns a reference to the collection of changes within this changeSet.- Specified by:
getChanges
in interfaceObjectChangeSet
-
getClassType
public Class getClassType()
INTERNAL: This method returns the class type that this changeSet represents. The class type must be initialized, before this method is called.- Returns:
- java.lang.Class or null if the class type isn't initialized.
-
getClassType
public Class getClassType(Session session)
ADVANCE: This method returns the class type that this changeSet Represents. This requires the session to reload the class on serialization.- Specified by:
getClassType
in interfaceObjectChangeSet
-
getClassName
public String getClassName()
ADVANCE: This method returns the class type that this changeSet Represents. The class type should be used if the class is desired.- Specified by:
getClassName
in interfaceObjectChangeSet
-
getInitialWriteLockValue
public Object getInitialWriteLockValue()
INTERNAL: This method is used to return the initial lock value of the object this changeSet represents.
-
getOldKey
public Object getOldKey()
This method returns the key value that this object was stored under in it's Respective hashmap.- Specified by:
getOldKey
in interfaceObjectChangeSet
-
getNewKey
public Object getNewKey()
This method returns the key value that this object will be stored under in it's Respective hashmap.- Specified by:
getNewKey
in interfaceObjectChangeSet
-
getId
public Object getId()
ADVANCED: This method returns the primary key for the object that this change set represents.- Specified by:
getId
in interfaceObjectChangeSet
-
getOldValue
public Object getOldValue()
-
getOldValue
public Object getOldValue(AbstractSession session)
-
getSynchronizationType
public int getSynchronizationType()
-
getTargetVersionOfSourceObject
public Object getTargetVersionOfSourceObject(MergeManager mergeManager, AbstractSession session)
INTERNAL: This method is used to return the complex object specified within the change record. The object is collected from the session which, in this case, is the unit of work. The object's changed attributes will be merged and added to the identity map.
-
getTargetVersionOfSourceObject
public Object getTargetVersionOfSourceObject(MergeManager mergeManager, AbstractSession targetSession, boolean shouldRead)
INTERNAL: This method is used to return the complex object specified within the change record. The object is collected from the session which, in this case, is the unit of work. The object's changed attributes will be merged and added to the identity map- Parameters:
shouldRead
- boolean if the object can not be found should it be read in from the database.
-
getObjectForMerge
protected Object getObjectForMerge(MergeManager mergeManager, AbstractSession session, Object primaryKey, ClassDescriptor descriptor)
INTERNAL: For use within the distributed merge process, this method will get an object from the shared cache using a readlock. If a readlock is unavailable then the merge manager will be transitioned to deferred locks and a deferred lock will be used.
-
getUnitOfWorkClone
public Object getUnitOfWorkClone()
INTERNAL: Returns the UnitOfWork Clone that this ChangeSet was built for.
-
setUnitOfWorkClone
public void setUnitOfWorkClone(Object cloneObject)
INTERNAL: Sets the UnitOfWork Clone that this ChangeSet was built for.
-
getUOWChangeSet
public UnitOfWorkChangeSet getUOWChangeSet()
ADVANCED: This method is used to return the parent UnitOfWorkChangeSet.- Specified by:
getUOWChangeSet
in interfaceObjectChangeSet
-
getWriteLockValue
public Object getWriteLockValue()
INTERNAL: This method is used to return the lock value of the object this changeSet represents.- Specified by:
getWriteLockValue
in interfaceObjectChangeSet
-
hasChangeFor
public boolean hasChangeFor(String attributeName)
ADVANCED: This method will return true if the specified attribute has been changed.- Specified by:
hasChangeFor
in interfaceObjectChangeSet
- Parameters:
attributeName
- the name of the attribute to search for.
-
hasChanges
public boolean hasChanges()
ADVANCED: Returns true if this particular changeSet has changes.- Specified by:
hasChanges
in interfaceObjectChangeSet
-
hasForcedChanges
public boolean hasForcedChanges()
INTERNAL: Returns true if this particular changeSet has forced SQL changes. This is true whenever CMPPolicy.getForceUpdate() == true or if the object has been marked for opt. read lock (uow.forceUpdateToVersionField). Kept separate from 'hasChanges' because we don't want to merge or cache sync. a change set that has no 'real' changes.
-
setShouldModifyVersionField
public void setShouldModifyVersionField(Boolean shouldModifyVersionField)
INTERNAL: Holds a Boolean indicating whether version field should be modified. This Boolean is set by forcedUpdate into uow.getOptimisticReadLockObjects() for the clone object and copied here (so don't need to search for it again in uow.getOptimisticReadLockObjects()).
-
shouldModifyVersionField
public Boolean shouldModifyVersionField()
INTERNAL: Holds a Boolean indicating whether version field should be modified.
-
setHasCmpPolicyForcedUpdate
public void setHasCmpPolicyForcedUpdate(boolean hasCmpPolicyForcedUpdate)
INTERNAL:
-
hasCmpPolicyForcedUpdate
public boolean hasCmpPolicyForcedUpdate()
INTERNAL:
-
hasForcedChangesFromCascadeLocking
public boolean hasForcedChangesFromCascadeLocking()
INTERNAL: Returns true if this particular changeSet has forced SQL changes because of a cascade optimistic locking policy.
-
setHasForcedChangesFromCascadeLocking
public 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.
-
hashCode
public int hashCode()
This method overrides the hashcode method. If this set has a cacheKey then return the hashcode of the cache key, otherwise return the identity hashcode of this object.
-
hasKeys
public boolean hasKeys()
INTERNAL: Returns true if this particular changeSet has a Key.
-
isAggregate
public boolean isAggregate()
INTERNAL: Used to determine if the object change set represents an aggregate object.
-
isNew
public boolean isNew()
ADVANCED: Returns true if this ObjectChangeSet represents a new object.- Specified by:
isNew
in interfaceObjectChangeSet
-
isInvalid
public boolean isInvalid()
INTERNAL: Indicates whether the change set is invalid.
-
mergeObjectChanges
public void mergeObjectChanges(ObjectChangeSet changeSetToMergeFrom, UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)
INTERNAL: This method will be used to merge changes from a supplied ObjectChangeSet into this changeSet.
-
readCompleteChangeSet
public void readCompleteChangeSet(ObjectInputStream stream) throws IOException, ClassNotFoundException
INTERNAL: Helper method used by readObject to read a completely serialized change set from the stream.- Throws:
IOException
ClassNotFoundException
-
readIdentityInformation
public void readIdentityInformation(ObjectInputStream stream) throws IOException, ClassNotFoundException
INTERNAL: Helper method used by readObject to read just the information about object identity from a serialized stream.- Throws:
IOException
ClassNotFoundException
-
setId
public void setId(Object id)
Set the id of the object for this change set.
-
setChanges
public void setChanges(List changesList)
Set the changes.
-
setClassType
public void setClassType(Class newValue)
Set the class type.
-
setClassName
public void setClassName(String newValue)
INTERNAL: Set the class name. The name is used for serialization with cache coordination.
-
setIsAggregate
public void setIsAggregate(boolean isAggregate)
INTERNAL: Set if this object change Set represents an aggregate- Parameters:
isAggregate
- boolean true if the ChangeSet represents an aggregate
-
setIsNew
public void setIsNew(boolean newIsNew)
INTERNAL: Set whether this ObjectChanges represents a new Object- Parameters:
newIsNew
- boolean true if this ChangeSet represents a new object
-
setOldKey
public void setOldKey(Object key)
This method is used to set the value that this object was stored under in its respected map collection
-
setNewKey
public void setNewKey(Object key)
This method is used to set the value that this object will be stored under in its respected map collection
-
setShouldBeDeleted
public void setShouldBeDeleted(boolean newValue)
This method was created in VisualAge.- Parameters:
newValue
- boolean
-
setSynchronizationType
public void setSynchronizationType(int type)
-
setUOWChangeSet
public void setUOWChangeSet(UnitOfWorkChangeSet newUnitOfWorkChangeSet)
INTERNAL: Used to set the parent change Set.
-
setOptimisticLockingPolicyAndInitialWriteLockValue
public 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.
-
setWriteLockValue
public void setWriteLockValue(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.
-
setInitialWriteLockValue
public void setInitialWriteLockValue(Object initialWriteLockValue)
ADVANCED: This method is used to set the initial writeLock value for an ObjectChangeSet. The initial value will only be set once, and can not be overwritten.
-
shouldBeDeleted
public boolean shouldBeDeleted()
Mark change set for a deleted object.
-
updateChangeRecordForAttribute
public void updateChangeRecordForAttribute(String attributeName, Object value)
INTERNAL: Used to update a changeRecord that is stored in the CHangeSet with a new value.
-
updateChangeRecordForAttributeWithMappedObject
public void updateChangeRecordForAttributeWithMappedObject(String attributeName, Object value, AbstractSession session)
ADVANCED: Used to update a changeRecord that is stored in the CHangeSet with a new value. Used when the new value is a mapped object.
-
updateChangeRecordForAttribute
public void updateChangeRecordForAttribute(DatabaseMapping mapping, Object value, AbstractSession session, Object oldValue)
INTERNAL: Used to update a changeRecord that is stored in the CHangeSet with a new value.
-
updateReferences
public void updateReferences(UnitOfWorkChangeSet localChangeSet, UnitOfWorkChangeSet mergingChangeSet)
INTERNAL: This method will be used when merging changesets into other changesets. It will fix references within a changeSet so that it's records point to changesets within this UOWChangeSet.
-
writeIdentityInformation
public void writeIdentityInformation(ObjectOutputStream stream) throws IOException
INTERNAL: Helper method to writeObject. Write only the information necessary to identify this ObjectChangeSet to the stream- Throws:
IOException
-
writeCompleteChangeSet
public void writeCompleteChangeSet(ObjectOutputStream stream) throws IOException
INTERNAL: Helper method to readObject. Completely write this ObjectChangeSet to the stream- Throws:
IOException
-
postSerialize
public void postSerialize(Object clone, UnitOfWorkChangeSet uowChangeSet, AbstractSession session)
INTERNAL: Reset the change set's transient variables after serialization.
-
getDeferredSet
public Set<String> getDeferredSet()
This set contains the list of attributes that must be calculated at commit time.
-
hasDeferredAttributes
public boolean hasDeferredAttributes()
Check to see if there are any attributes that must be calculated at commit time.
-
dirtyUOWChangeSet
protected void dirtyUOWChangeSet()
-
updateUOWChangeSet
protected void updateUOWChangeSet()
-
rebuildWriteLockValueFromUserFormat
protected void rebuildWriteLockValueFromUserFormat(ClassDescriptor descriptor, AbstractSession session)
Rebuild writeLockValue to the expected type from user format i.e XML change set has all values as String.
-
removeChange
public void removeChange(String attributeName)
INTERNAL: Remove the change. Used by the event mechanism to reset changes after client has updated the object within an event.
-
removeFromIdentityMap
protected void removeFromIdentityMap(AbstractSession session)
Remove object represent this change set from identity map. If change set is in XML format, rebuild pk to the correct class type from String
-
shouldInvalidateObject
public boolean shouldInvalidateObject(Object original, AbstractSession session)
INTERNAL: Indicates whether the object in session cache should be invalidated.- Parameters:
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;
-
getActiveCacheKey
public CacheKey getActiveCacheKey()
INTERNAL: PERF: Return the session cache-key, cached during the merge.
-
setActiveCacheKey
public void setActiveCacheKey(CacheKey activeCacheKey)
INTERNAL: PERF: Set the session cache-key, cached during the merge.
-
shouldRecalculateAfterUpdateEvent
public boolean shouldRecalculateAfterUpdateEvent()
ADVANCED Returns true if this ObjectChangeSet should be recalculated after changes in event- Specified by:
shouldRecalculateAfterUpdateEvent
in interfaceObjectChangeSet
- Returns:
-
setShouldRecalculateAfterUpdateEvent
public void setShouldRecalculateAfterUpdateEvent(boolean shouldRecalculateAfterUpdateEvent)
ADVANCED Set whether this ObjectChangeSet should be recalculated after changes in event- Specified by:
setShouldRecalculateAfterUpdateEvent
in interfaceObjectChangeSet
-
hasVersionChange
public boolean hasVersionChange()
-
setHasVersionChange
public void setHasVersionChange(boolean hasVersionChange)
-
getCacheSynchronizationType
public int getCacheSynchronizationType()
-
setCacheSynchronizationType
public void setCacheSynchronizationType(int cacheSynchronizationType)
-
setIsInvalid
public void setIsInvalid(boolean isInvalid)
-
getProtectedForeignKeys
public AbstractRecord getProtectedForeignKeys()
-
setProtectedForeignKeys
public void setProtectedForeignKeys(AbstractRecord protectedForeignKeys)
-
hasProtectedForeignKeys
public boolean hasProtectedForeignKeys()
-
-