public class ObjectChangeSet extends java.lang.Object implements java.io.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 java.util.Hashtable |
attributesToChanges |
protected CacheKey |
cacheKey |
protected java.util.Vector |
changes
This is the collection of changes
|
protected java.lang.String |
className |
protected java.lang.Class |
classType |
protected java.lang.Object |
cloneObject |
protected java.util.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 java.lang.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 java.lang.Object |
newKey |
protected java.lang.Object |
oldKey |
protected OptimisticLockingPolicy |
optimisticLockingPolicy
Used in mergeObjectChanges method for writeLock and initialWriteLock comparison of the merged change sets
|
protected boolean |
shouldBeDeleted |
protected java.lang.Boolean |
shouldModifyVersionField |
protected UnitOfWorkChangeSet |
unitOfWorkChangeSet
This member variable holds the reference to the parent UnitOfWork Change Set
|
protected java.lang.Object |
writeLockValue |
Constructor and Description |
---|
ObjectChangeSet()
The default constructor is used only by SDK XML project for mapping ObjectChangeSet
|
ObjectChangeSet(java.lang.Object cloneObject,
UnitOfWorkChangeSet parent,
boolean isNew)
This constructor is used to create an ObjectChangeSet that represents an aggregate object.
|
ObjectChangeSet(java.util.Vector primaryKey,
java.lang.Class classType,
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) |
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(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).
|
boolean |
equals(java.lang.Object object) |
boolean |
equals(ObjectChangeSet objectChange) |
java.util.Hashtable |
getAttributesToChanges()
INTERNAL:
stores the change records indexed by the attribute names
|
CacheKey |
getCacheKey() |
java.util.Vector |
getChangedAttributeNames()
ADVANCED:
This method will return a collection of the fieldnames of attributes changed in an object
|
java.util.Vector |
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.HashSet |
getDeferredSet()
This set contains the list of attributes that must be calculated at commit time.
|
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.util.Vector |
getPrimaryKeys()
ADVANCED:
This method returns the primary keys for the object that this change set represents
|
java.lang.Object |
getTargetVersionOfSourceObject(AbstractSession session)
INTERNAL:
This method is used to return the complex object specified within the change record.
|
java.lang.Object |
getTargetVersionOfSourceObject(AbstractSession session,
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 ChangeSet
|
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 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(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 change.
|
protected void |
removeFromIdentityMap(AbstractSession session)
Remove object represent this change set from identity map.
|
void |
setCacheKey(CacheKey cacheKey) |
void |
setChanges(java.util.Vector changesList) |
void |
setClassName(java.lang.String newValue)
INTERNAL:
|
void |
setClassType(java.lang.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(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
|
protected 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 |
setPrimaryKeys(java.util.Vector key)
INTERNAL:
|
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 |
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 th change set is
marked as being dirty.
|
boolean |
shouldBeDeleted()
This method was created in VisualAge.
|
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.
|
java.lang.String |
toString() |
void |
updateChangeRecordForAttribute(DatabaseMapping mapping,
java.lang.Object value)
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.
|
protected void |
updateUOWChangeSet() |
void |
writeCompleteChangeSet(java.io.ObjectOutputStream stream)
INTERNAL:
Helper method to readObject.
|
void |
writeIdentityInformation(java.io.ObjectOutputStream stream)
INTERNAL:
Helper method to writeObject.
|
protected java.util.Vector changes
protected java.util.Hashtable attributesToChanges
protected boolean shouldBeDeleted
protected CacheKey cacheKey
protected transient java.lang.Class classType
protected java.lang.String className
protected boolean isNew
protected boolean isAggregate
protected java.lang.Object oldKey
protected java.lang.Object newKey
protected UnitOfWorkChangeSet unitOfWorkChangeSet
protected transient OptimisticLockingPolicy optimisticLockingPolicy
protected java.lang.Object initialWriteLockValue
protected java.lang.Object writeLockValue
protected boolean isInvalid
protected transient java.lang.Object cloneObject
protected boolean hasVersionChange
protected java.lang.Boolean shouldModifyVersionField
protected boolean hasCmpPolicyForcedUpdate
protected boolean hasChangesFromCascadeLocking
protected transient java.util.HashSet deferredSet
public ObjectChangeSet()
public ObjectChangeSet(java.lang.Object cloneObject, UnitOfWorkChangeSet parent, boolean isNew)
public ObjectChangeSet(java.util.Vector primaryKey, java.lang.Class classType, java.lang.Object cloneObject, UnitOfWorkChangeSet parent, boolean isNew)
public void clear()
public void addChange(ChangeRecord changeRecord)
changeRecord
- prototype.changeset.ChangeRecordpublic void deferredDetectionRequiredOn(java.lang.String attributeName)
public boolean containsChangesFromSynchronization()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
objectChange
- prototype.changeset.ObjectChangeSetpublic boolean equals(ObjectChangeSet objectChange)
equals
in interface ObjectChangeSet
objectChange
- prototype.changeset.ObjectChangeSetpublic java.util.Hashtable getAttributesToChanges()
public ChangeRecord getChangesForAttributeNamed(java.lang.String attributeName)
getChangesForAttributeNamed
in interface ObjectChangeSet
public CacheKey getCacheKey()
public java.util.Vector getChangedAttributeNames()
getChangedAttributeNames
in interface ObjectChangeSet
public java.util.Vector getChanges()
getChanges
in interface ObjectChangeSet
public java.lang.Class getClassType()
public java.lang.Class getClassType(Session session)
getClassType
in interface ObjectChangeSet
public java.lang.String getClassName()
getClassName
in interface ObjectChangeSet
public java.lang.Object getInitialWriteLockValue()
public java.lang.Object getOldKey()
getOldKey
in interface ObjectChangeSet
public java.lang.Object getNewKey()
getNewKey
in interface ObjectChangeSet
public java.util.Vector getPrimaryKeys()
getPrimaryKeys
in interface ObjectChangeSet
public java.lang.Object getTargetVersionOfSourceObject(AbstractSession session)
session
- oracle.toplink.essentials.publicinterface.Sessionpublic java.lang.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 java.lang.Object getUnitOfWorkClone()
public UnitOfWorkChangeSet getUOWChangeSet()
getUOWChangeSet
in interface ObjectChangeSet
public java.lang.Object getWriteLockValue()
getWriteLockValue
in interface ObjectChangeSet
public boolean hasChangeFor(java.lang.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(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.Object
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(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void readIdentityInformation(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void setCacheKey(CacheKey cacheKey)
public void setChanges(java.util.Vector changesList)
newValue
- java.util.Vectorpublic void setClassType(java.lang.Class newValue)
newValue
- java.lang.Classpublic void setClassName(java.lang.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(java.lang.Object key)
public void setNewKey(java.lang.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(java.lang.Object newWriteLockValue)
newWriteLockValue
- java.lang.Objectpublic void setInitialWriteLockValue(java.lang.Object initialWriteLockValue)
initialWriteLockValue
- java.lang.Objectpublic boolean shouldBeDeleted()
public java.lang.String toString()
toString
in class java.lang.Object
public 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)
public void updateReferences(UnitOfWorkChangeSet localChangeSet, UnitOfWorkChangeSet mergingChangeSet)
public void writeIdentityInformation(java.io.ObjectOutputStream stream) throws java.io.IOException
java.io.IOException
public void writeCompleteChangeSet(java.io.ObjectOutputStream stream) throws java.io.IOException
java.io.IOException
public void setPrimaryKeys(java.util.Vector key)
public java.util.HashSet getDeferredSet()
public boolean hasDeferredAttributes()
protected void updateUOWChangeSet()
public void removeChange(java.lang.String attributeName)
protected void removeFromIdentityMap(AbstractSession session)
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;