Module org.eclipse.persistence.core
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 classObjectChangeSet.ObjectChangeSetComparatorAllow change sets to be compared by changes for batching.
-
Field Summary
Fields Modifier and Type Field Description protected CacheKeyactiveCacheKeyPERF: Cache the session cacheKey during the merge to avoid duplicate lookups.protected Map<String,ChangeRecord>attributesToChangesprotected intcacheSynchronizationTypeUsed 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>changesThis is the collection of changesprotected StringclassNameprotected Class<?>classTypeprotected ObjectcloneObjectprotected Set<String>deferredSetThis 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 ClassDescriptordescriptorCache the descriptor as it is useful and required in some places.protected booleanhasChangesFromCascadeLockingprotected booleanhasCmpPolicyForcedUpdateFor CMP only: indicates that the object should be force updated (whether it has OptimisticLocking or not): getCmpPolicy().getForcedUpdate()==trueprotected booleanhasVersionChangeprotected Objectidprotected ObjectinitialWriteLockValueprotected booleanisAggregateprotected booleanisInvalidInvalid change set shouldn't be merged into object in cache, rather the object should be invalidatedprotected booleanisNewstatic intMAX_TRIESprotected ObjectnewKeyprotected ObjectoldKeyprotected OptimisticLockingPolicyoptimisticLockingPolicyUsed in mergeObjectChanges method for writeLock and initialWriteLock comparison of the merged change setsprotected AbstractRecordprotectedForeignKeysprotected booleanshouldBeDeletedprotected BooleanshouldModifyVersionFieldContains optimisticReadLockObject corresponding to the clone, non-null indicates forced changesprotected booleanshouldRecalculateAfterUpdateEventreturn whether this change set should be recalculated after an event changes the objectprotected UnitOfWorkChangeSetunitOfWorkChangeSetThis member variable holds the reference to the parent UnitOfWork Change Setprotected ObjectwriteLockValue
-
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 voidaddChange(ChangeRecord changeRecord)Add the attribute change record.voidclear(boolean clearKeys)INTERNAL: This method will clear the changerecords from a changeSetintcompareTo(ObjectChangeSet changeSet)Determine if the receiver is greater or less than the change set.booleancontainsChangesFromSynchronization()INTERNAL: Convenience method used to query this change set after it has been sent by cache synchronization.voiddeferredDetectionRequiredOn(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 voiddirtyUOWChangeSet()booleanequals(Object object)Ensure change sets with the same primary key are equal.booleanequals(ObjectChangeSet objectChange)Ensure change sets with the same primary key are equal.CacheKeygetActiveCacheKey()INTERNAL: PERF: Return the session cache-key, cached during the merge.MapgetAttributesToChanges()INTERNAL: stores the change records indexed by the attribute namesintgetCacheSynchronizationType()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.ChangeRecordgetChangesForAttributeNamed(String attributeName)INTERNAL: returns the change record for the specified attribute nameStringgetClassName()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.ClassDescriptorgetDescriptor()ObjectgetId()ADVANCED: This method returns the primary key for the object that this change set represents.ObjectgetInitialWriteLockValue()INTERNAL: This method is used to return the initial lock value of the object this changeSet represents.ObjectgetNewKey()This method returns the key value that this object will be stored under in it's Respective hashmap.protected ObjectgetObjectForMerge(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.ObjectgetOldKey()This method returns the key value that this object was stored under in it's Respective hashmap.ObjectgetOldValue()ObjectgetOldValue(AbstractSession session)AbstractRecordgetProtectedForeignKeys()intgetSynchronizationType()ObjectgetTargetVersionOfSourceObject(MergeManager mergeManager, AbstractSession session)INTERNAL: This method is used to return the complex object specified within the change record.ObjectgetTargetVersionOfSourceObject(MergeManager mergeManager, AbstractSession targetSession, boolean shouldRead)INTERNAL: This method is used to return the complex object specified within the change record.ObjectgetUnitOfWorkClone()INTERNAL: Returns the UnitOfWork Clone that this ChangeSet was built for.UnitOfWorkChangeSetgetUOWChangeSet()ADVANCED: This method is used to return the parent UnitOfWorkChangeSet.ObjectgetWriteLockValue()INTERNAL: This method is used to return the lock value of the object this changeSet represents.booleanhasChangeFor(String attributeName)ADVANCED: This method will return true if the specified attribute has been changed.booleanhasChanges()ADVANCED: Returns true if this particular changeSet has changes.booleanhasCmpPolicyForcedUpdate()INTERNAL:booleanhasDeferredAttributes()Check to see if there are any attributes that must be calculated at commit time.booleanhasForcedChanges()INTERNAL: Returns true if this particular changeSet has forced SQL changes.booleanhasForcedChangesFromCascadeLocking()INTERNAL: Returns true if this particular changeSet has forced SQL changes because of a cascade optimistic locking policy.inthashCode()This method overrides the hashcode method.booleanhasKeys()INTERNAL: Returns true if this particular changeSet has a Key.booleanhasProtectedForeignKeys()booleanhasVersionChange()booleanisAggregate()INTERNAL: Used to determine if the object change set represents an aggregate object.booleanisInvalid()INTERNAL: Indicates whether the change set is invalid.booleanisNew()ADVANCED: Returns true if this ObjectChangeSet represents a new object.voidmergeObjectChanges(ObjectChangeSet changeSetToMergeFrom, UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)INTERNAL: This method will be used to merge changes from a supplied ObjectChangeSet into this changeSet.voidpostSerialize(Object clone, UnitOfWorkChangeSet uowChangeSet, AbstractSession session)INTERNAL: Reset the change set's transient variables after serialization.voidreadCompleteChangeSet(ObjectInputStream stream)INTERNAL: Helper method used by readObject to read a completely serialized change set from the stream.voidreadIdentityInformation(ObjectInputStream stream)INTERNAL: Helper method used by readObject to read just the information about object identity from a serialized stream.protected voidrebuildWriteLockValueFromUserFormat(ClassDescriptor descriptor, AbstractSession session)Rebuild writeLockValue to the expected type from user format i.e XML change set has all values as String.voidremoveChange(String attributeName)INTERNAL: Remove the change.protected voidremoveFromIdentityMap(AbstractSession session)Remove object represent this change set from identity map.voidsetActiveCacheKey(CacheKey activeCacheKey)INTERNAL: PERF: Set the session cache-key, cached during the merge.voidsetCacheSynchronizationType(int cacheSynchronizationType)voidsetChanges(List changesList)Set the changes.voidsetClassName(String newValue)INTERNAL: Set the class name.voidsetClassType(Class<?> newValue)Set the class type.voidsetDescriptor(ClassDescriptor descriptor)voidsetHasCmpPolicyForcedUpdate(boolean hasCmpPolicyForcedUpdate)INTERNAL:voidsetHasForcedChangesFromCascadeLocking(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.voidsetHasVersionChange(boolean hasVersionChange)voidsetId(Object id)Set the id of the object for this change set.voidsetInitialWriteLockValue(Object initialWriteLockValue)ADVANCED: This method is used to set the initial writeLock value for an ObjectChangeSet.voidsetIsAggregate(boolean isAggregate)INTERNAL: Set if this object change Set represents an aggregatevoidsetIsInvalid(boolean isInvalid)voidsetIsNew(boolean newIsNew)INTERNAL: Set whether this ObjectChanges represents a new ObjectvoidsetNewKey(Object key)This method is used to set the value that this object will be stored under in its respected map collectionvoidsetOldKey(Object key)This method is used to set the value that this object was stored under in its respected map collectionvoidsetOptimisticLockingPolicyAndInitialWriteLockValue(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.voidsetProtectedForeignKeys(AbstractRecord protectedForeignKeys)voidsetShouldBeDeleted(boolean newValue)This method was created in VisualAge.voidsetShouldModifyVersionField(Boolean shouldModifyVersionField)INTERNAL: Holds a Boolean indicating whether version field should be modified.voidsetShouldRecalculateAfterUpdateEvent(boolean shouldRecalculateAfterUpdateEvent)ADVANCED Set whether this ObjectChangeSet should be recalculated after changes in eventvoidsetSynchronizationType(int type)voidsetUnitOfWorkClone(Object cloneObject)INTERNAL: Sets the UnitOfWork Clone that this ChangeSet was built for.voidsetUOWChangeSet(UnitOfWorkChangeSet newUnitOfWorkChangeSet)INTERNAL: Used to set the parent change Set.voidsetWriteLockValue(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.booleanshouldBeDeleted()Mark change set for a deleted object.booleanshouldInvalidateObject(Object original, AbstractSession session)INTERNAL: Indicates whether the object in session cache should be invalidated.BooleanshouldModifyVersionField()INTERNAL: Holds a Boolean indicating whether version field should be modified.booleanshouldRecalculateAfterUpdateEvent()ADVANCED Returns true if this ObjectChangeSet should be recalculated after changes in eventStringtoString()voidupdateChangeRecordForAttribute(String attributeName, Object value)INTERNAL: Used to update a changeRecord that is stored in the CHangeSet with a new value.voidupdateChangeRecordForAttribute(DatabaseMapping mapping, Object value, AbstractSession session, Object oldValue)INTERNAL: Used to update a changeRecord that is stored in the CHangeSet with a new value.voidupdateChangeRecordForAttributeWithMappedObject(String attributeName, Object value, AbstractSession session)ADVANCED: Used to update a changeRecord that is stored in the CHangeSet with a new value.voidupdateReferences(UnitOfWorkChangeSet localChangeSet, UnitOfWorkChangeSet mergingChangeSet)INTERNAL: This method will be used when merging changesets into other changesets.protected voidupdateUOWChangeSet()voidwriteCompleteChangeSet(ObjectOutputStream stream)INTERNAL: Helper method to readObject.voidwriteIdentityInformation(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:
equalsin interfaceObjectChangeSet- Overrides:
equalsin 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:
compareToin 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:
getChangesForAttributeNamedin interfaceObjectChangeSet
-
getChangedAttributeNames
public List<String> getChangedAttributeNames()
ADVANCED: This method will return a collection of the attributes changed in the object.- Specified by:
getChangedAttributeNamesin interfaceObjectChangeSet
-
getChanges
public List<ChangeRecord> getChanges()
INTERNAL: This method returns a reference to the collection of changes within this changeSet.- Specified by:
getChangesin 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:
getClassTypein 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:
getClassNamein 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:
getOldKeyin 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:
getNewKeyin interfaceObjectChangeSet
-
getId
public Object getId()
ADVANCED: This method returns the primary key for the object that this change set represents.- Specified by:
getIdin 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:
getUOWChangeSetin interfaceObjectChangeSet
-
getWriteLockValue
public Object getWriteLockValue()
INTERNAL: This method is used to return the lock value of the object this changeSet represents.- Specified by:
getWriteLockValuein interfaceObjectChangeSet
-
hasChangeFor
public boolean hasChangeFor(String attributeName)
ADVANCED: This method will return true if the specified attribute has been changed.- Specified by:
hasChangeForin 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:
hasChangesin 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:
isNewin 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:
IOExceptionClassNotFoundException
-
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:
IOExceptionClassNotFoundException
-
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:
shouldRecalculateAfterUpdateEventin interfaceObjectChangeSet
-
setShouldRecalculateAfterUpdateEvent
public void setShouldRecalculateAfterUpdateEvent(boolean shouldRecalculateAfterUpdateEvent)
ADVANCED Set whether this ObjectChangeSet should be recalculated after changes in event- Specified by:
setShouldRecalculateAfterUpdateEventin 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()
-
-