public class ObjectChangeSet extends Object implements Serializable, 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 | Field and Description |
---|---|
protected Hashtable |
attributesToChanges |
protected CacheKey |
cacheKey |
protected Vector |
changes
This is the collection of changes
|
protected String |
className |
protected Class |
classType |
protected Object |
cloneObject |
protected HashSet |
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 boolean |
hasChangesFromCascadeLocking |
protected boolean |
hasCmpPolicyForcedUpdate |
protected boolean |
hasVersionChange |
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 invalidated
|
protected boolean |
isNew |
protected Object |
newKey |
protected Object |
oldKey |
protected OptimisticLockingPolicy |
optimisticLockingPolicy
Used in mergeObjectChanges method for writeLock and initialWriteLock comparison of the merged change sets
|
protected boolean |
shouldBeDeleted |
protected Boolean |
shouldModifyVersionField |
protected UnitOfWorkChangeSet |
unitOfWorkChangeSet
This member variable holds the reference to the parent UnitOfWork Change Set
|
protected Object |
writeLockValue |
Constructor and Description |
---|
ObjectChangeSet()
The default constructor is used only by SDK XML project for mapping ObjectChangeSet
|
ObjectChangeSet(Object cloneObject,
UnitOfWorkChangeSet parent,
boolean isNew)
This constructor is used to create an ObjectChangeSet that represents an aggregate object.
|
ObjectChangeSet(Vector primaryKey,
Class classType,
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) |
void |
clear()
INTERNAL:
This method will clear the changerecords from a changeSet
|
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).
|
boolean |
equals(Object object) |
boolean |
equals(ObjectChangeSet objectChange) |
Hashtable |
getAttributesToChanges()
INTERNAL:
stores the change records indexed by the attribute names
|
CacheKey |
getCacheKey() |
Vector |
getChangedAttributeNames()
ADVANCED:
This method will return a collection of the fieldnames of attributes changed in an object
|
Vector |
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 name
|
String |
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.
|
HashSet |
getDeferredSet()
This set contains the list of attributes that must be calculated at commit time.
|
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.
|
Object |
getOldKey()
This method returns the key value that this object was stored under in it's
Respective hashmap.
|
Vector |
getPrimaryKeys()
ADVANCED:
This method returns the primary keys for the object that this change set represents
|
Object |
getTargetVersionOfSourceObject(AbstractSession session)
INTERNAL:
This method is used to return the complex object specified within the change record.
|
Object |
getTargetVersionOfSourceObject(AbstractSession session,
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 ChangeSet
|
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 attributue 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 |
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 |
prepareChangeRecordsForSynchronization(AbstractSession session)
INTERNAL:
Iterate through the change records and ensure the cache synchronization types
are set on the change sets associated with those records.
|
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.
|
void |
removeChange(String attributeName)
INTERNAL:
Remove change.
|
protected void |
removeFromIdentityMap(AbstractSession session)
Remove object represent this change set from identity map.
|
void |
setCacheKey(CacheKey cacheKey) |
void |
setChanges(Vector changesList) |
void |
setClassName(String newValue)
INTERNAL:
|
void |
setClassType(Class newValue) |
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 steming from a cascade optimistic locking policy.
|
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 aggregate
|
protected void |
setIsNew(boolean newIsNew)
INTERNAL:
Set whether this ObjectChanges represents a new Object
|
void |
setNewKey(Object key)
This method is used to set the value that this object will be stored under in its respected
map collection
|
void |
setOldKey(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 |
setPrimaryKeys(Vector key)
INTERNAL:
|
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 |
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 th change set is
marked as being dirty.
|
boolean |
shouldBeDeleted()
This method was created in VisualAge.
|
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.
|
String |
toString() |
void |
updateChangeRecordForAttribute(DatabaseMapping mapping,
Object value)
INTERNAL:
Used to update a changeRecord that is stored in the CHangeSet with a new value.
|
void |
updateChangeRecordForAttribute(String attributeName,
Object value)
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.
|
protected Vector changes
protected Hashtable attributesToChanges
protected boolean shouldBeDeleted
protected CacheKey cacheKey
protected transient Class classType
protected String className
protected boolean isNew
protected boolean isAggregate
protected Object oldKey
protected Object newKey
protected UnitOfWorkChangeSet unitOfWorkChangeSet
protected transient OptimisticLockingPolicy optimisticLockingPolicy
protected Object initialWriteLockValue
protected Object writeLockValue
protected boolean isInvalid
protected transient Object cloneObject
protected boolean hasVersionChange
protected Boolean shouldModifyVersionField
protected boolean hasCmpPolicyForcedUpdate
protected boolean hasChangesFromCascadeLocking
protected transient HashSet deferredSet
public ObjectChangeSet()
public ObjectChangeSet(Object cloneObject, UnitOfWorkChangeSet parent, boolean isNew)
public ObjectChangeSet(Vector primaryKey, Class classType, Object cloneObject, UnitOfWorkChangeSet parent, boolean isNew)
public void clear()
public void addChange(ChangeRecord changeRecord)
changeRecord
- prototype.changeset.ChangeRecordpublic void deferredDetectionRequiredOn(String attributeName)
public boolean containsChangesFromSynchronization()
public boolean equals(Object object)
public boolean equals(ObjectChangeSet objectChange)
equals
in interface ObjectChangeSet
objectChange
- prototype.changeset.ObjectChangeSetpublic Hashtable getAttributesToChanges()
public ChangeRecord getChangesForAttributeNamed(String attributeName)
getChangesForAttributeNamed
in interface ObjectChangeSet
public CacheKey getCacheKey()
public Vector getChangedAttributeNames()
getChangedAttributeNames
in interface ObjectChangeSet
public Vector getChanges()
getChanges
in interface ObjectChangeSet
public Class getClassType()
public Class getClassType(Session session)
getClassType
in interface ObjectChangeSet
public String getClassName()
getClassName
in interface ObjectChangeSet
public Object getInitialWriteLockValue()
public Object getOldKey()
getOldKey
in interface ObjectChangeSet
public Object getNewKey()
getNewKey
in interface ObjectChangeSet
public Vector getPrimaryKeys()
getPrimaryKeys
in interface ObjectChangeSet
public Object getTargetVersionOfSourceObject(AbstractSession session)
session
- oracle.toplink.essentials.publicinterface.Sessionpublic Object getTargetVersionOfSourceObject(AbstractSession session, boolean shouldRead)
shouldRead
- boolean if the object can not be found should it be read in from the databasesession
- oracle.toplink.essentials.publicinterface.Sessionpublic Object getUnitOfWorkClone()
public UnitOfWorkChangeSet getUOWChangeSet()
getUOWChangeSet
in interface ObjectChangeSet
public Object getWriteLockValue()
getWriteLockValue
in interface ObjectChangeSet
public boolean hasChangeFor(String attributeName)
hasChangeFor
in interface ObjectChangeSet
String
- the name of the attribute to search forpublic boolean hasChanges()
hasChanges
in interface ObjectChangeSet
public boolean hasForcedChanges()
public void setShouldModifyVersionField(Boolean shouldModifyVersionField)
public Boolean shouldModifyVersionField()
public void setHasCmpPolicyForcedUpdate(boolean hasCmpPolicyForcedUpdate)
public boolean hasCmpPolicyForcedUpdate()
public boolean hasForcedChangesFromCascadeLocking()
public void setHasForcedChangesFromCascadeLocking(boolean newValue)
public int hashCode()
public boolean hasKeys()
public boolean isAggregate()
public boolean isNew()
isNew
in interface ObjectChangeSet
public boolean isInvalid()
public void mergeObjectChanges(ObjectChangeSet changeSetToMergeFrom, UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)
public void prepareChangeRecordsForSynchronization(AbstractSession session)
public void readCompleteChangeSet(ObjectInputStream stream) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public void readIdentityInformation(ObjectInputStream stream) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public void setCacheKey(CacheKey cacheKey)
public void setChanges(Vector changesList)
newValue
- java.util.Vectorpublic void setClassType(Class newValue)
newValue
- java.lang.Classpublic void setClassName(String newValue)
newValue
- java.lang.Stringpublic void setIsAggregate(boolean isAggregate)
isAggregate
- boolean true if the ChangeSet represents an aggregateprotected void setIsNew(boolean newIsNew)
newIsNew
- boolean true if this ChangeSet represents a new objectpublic void setOldKey(Object key)
public void setNewKey(Object key)
public void setShouldBeDeleted(boolean newValue)
newValue
- booleanpublic void setUOWChangeSet(UnitOfWorkChangeSet newUnitOfWorkChangeSet)
newUnitOfWorkChangeSet
- prototype.changeset.UnitOfWorkChangeSetpublic void setOptimisticLockingPolicyAndInitialWriteLockValue(OptimisticLockingPolicy optimisticLockingPolicy, AbstractSession session)
newWriteLockValue
- java.lang.Objectpublic void setWriteLockValue(Object newWriteLockValue)
newWriteLockValue
- java.lang.Objectpublic void setInitialWriteLockValue(Object initialWriteLockValue)
initialWriteLockValue
- java.lang.Objectpublic boolean shouldBeDeleted()
public void updateChangeRecordForAttribute(String attributeName, Object value)
public void updateChangeRecordForAttributeWithMappedObject(String attributeName, Object value, AbstractSession session)
public void updateChangeRecordForAttribute(DatabaseMapping mapping, Object value)
public void updateReferences(UnitOfWorkChangeSet localChangeSet, UnitOfWorkChangeSet mergingChangeSet)
public void writeIdentityInformation(ObjectOutputStream stream) throws IOException
IOException
public void writeCompleteChangeSet(ObjectOutputStream stream) throws IOException
IOException
public void setPrimaryKeys(Vector key)
public HashSet getDeferredSet()
public boolean hasDeferredAttributes()
protected void updateUOWChangeSet()
public void removeChange(String attributeName)
protected void removeFromIdentityMap(AbstractSession session)
public boolean shouldInvalidateObject(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;Copyright © 2021. All rights reserved.