Top Description Inners Fields Constructors Methods
org.eclipse.persistence.internal.sessions

public Class DirectCollectionChangeRecord

extends DeferrableChangeRecord
implements DirectCollectionChangeRecord
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.sessions.changesets.DirectCollectionChangeRecord, org.eclipse.persistence.sessions.changesets.ChangeRecord
Imports
java.util.*, org.eclipse.persistence.internal.queries.ContainerPolicy

Purpose: This class holds the record of the changes made to a collection attribute of an object.

Description: Collections must be compared to each other and added and removed objects must be recorded separately.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
protected HashMap<K, V>
protected Map<K, V>
changedIndexes

Used only in case listOrderField != null in the mapping.

protected HashMap<K, V>
commitAddMap

Contains the number of objects that must be inserted to once the value is removed in the database as a delete where value = "value" will remove all instances of that value in the database not just one.

protected boolean
protected boolean
protected boolean
protected boolean
protected int
protected int
protected boolean
orderHasBeenRepaired

Indicates whether IndirectList's order has been repaired.

protected HashMap<K, V>
Inherited from org.eclipse.persistence.internal.sessions.DeferrableChangeRecord:
isDeferredlatestCollectionoriginalCollection

Constructor Summary

AccessConstructor and Description
public
DirectCollectionChangeRecord()

This default constructor.

public
DirectCollectionChangeRecord(ObjectChangeSet owner)

This constructor returns a changeRecord representing the DirectCollection mapping.

Method Summary

Modifier and TypeMethod and Description
public void
addAdditionChange(HashMap<K, V> additions, HashMap<K, V> databaseCount)

This method takes a map of primitive objects and adds them to the add list.

public void
addAdditionChange(Object key, Integer count)

This method takes a single addition value and records it.

public void
addRemoveChange(HashMap<K, V> additions, HashMap<K, V> databaseCount)

This method takes a hashtable of primitive objects and adds them to the remove list.

public void
addRemoveChange(Object key, Integer count)

This method takes a single remove change and integrates it with this changeset.

public void
clearChanges()

Implements abstract org.eclipse.persistence.internal.sessions.DeferrableChangeRecord.clearChanges.

Clears info about added / removed objects set by change tracker.
public void
decrementDatabaseCount(Object object)

Decrement the count for object

public Vector<E>
getAddObjectList()

Implements org.eclipse.persistence.sessions.changesets.DirectCollectionChangeRecord.getAddObjectList.

ADVANCED: This method returns the list of added objects.
public HashMap<K, V>
getAddObjectMap()

This method returns the collection of objects that were added to the collection.

public Map<K, V>
public HashMap<K, V>
getCommitAddMap()

This method returns the collection of objects that were added to the collection.

public int
public int
public Vector<E>
getRemoveObjectList()

Implements org.eclipse.persistence.sessions.changesets.DirectCollectionChangeRecord.getRemoveObjectList.

ADVANCED: This method returns the list of removed objects.
public HashMap<K, V>
getRemoveObjectMap()

This method returns the collection of objects that were removed from the collection.

public boolean
hasChanges()

Returns true if the change set has changes.

public void
incrementDatabaseCount(Object object)

Increment the count for object

public void
public boolean
public boolean
public void
mergeRecord(ChangeRecord mergeFromRecord, UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)

Implements abstract org.eclipse.persistence.internal.sessions.ChangeRecord.mergeRecord.

This method will be used to merge one record into another.
public boolean
public void
setChangedIndexes(Map<K, V> changedIndexes)

public void
setCommitAddition(Hashtable<K, V> additions)

This method takes a hashtable of primitives and adds them to the commit list.

public void
public void
public void
setNewSize(int size)

public void
setOldSize(int size)

public void
setOrderHasBeenRepaired(boolean hasBeenRepaired)

public void
storeDatabaseCounts(Object collection, ContainerPolicy containerPolicy, AbstractSession session)

This method will iterate over the collection and store the database counts for the objects within the collection, this is used for minimal updates.

public void
updateReferences(UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)

Implements abstract org.eclipse.persistence.internal.sessions.ChangeRecord.updateReferences.

This method will be used to update the objectsChangeSets references
Inherited from org.eclipse.persistence.internal.sessions.DeferrableChangeRecord:
getLatestCollectiongetOldValuegetOldValuegetOriginalCollectionisDeferredrecreateOriginalCollectionsetIsDeferredsetLatestCollectionsetOriginalCollection

Field Detail

addObjectMapback to summary
protected HashMap<K, V> addObjectMap
changedIndexesback to summary
protected Map<K, V> changedIndexes

Used only in case listOrderField != null in the mapping. Maps each object which has been added or removed or which order in the list has changed to an array of two (non-intersecting) sets of indexes - old and new.

commitAddMapback to summary
protected HashMap<K, V> commitAddMap

Contains the number of objects that must be inserted to once the value is removed in the database as a delete where value = "value" will remove all instances of that value in the database not just one.

isFirstToAddback to summary
protected boolean isFirstToAdd
isFirstToAddAlreadyInCollectionback to summary
protected boolean isFirstToAddAlreadyInCollection
isFirstToRemoveback to summary
protected boolean isFirstToRemove
isFirstToRemoveAlreadyOutCollectionback to summary
protected boolean isFirstToRemoveAlreadyOutCollection
newSizeback to summary
protected int newSize
oldSizeback to summary
protected int oldSize
orderHasBeenRepairedback to summary
protected boolean orderHasBeenRepaired

Indicates whether IndirectList's order has been repaired.

removeObjectMapback to summary
protected HashMap<K, V> removeObjectMap

Constructor Detail

DirectCollectionChangeRecordback to summary
public DirectCollectionChangeRecord()

This default constructor.

DirectCollectionChangeRecordback to summary
public DirectCollectionChangeRecord(ObjectChangeSet owner)

This constructor returns a changeRecord representing the DirectCollection mapping.

Method Detail

addAdditionChangeback to summary
public void addAdditionChange(HashMap<K, V> additions, HashMap<K, V> databaseCount)

This method takes a map of primitive objects and adds them to the add list. The map stores the number of times the object is in the list.

addAdditionChangeback to summary
public void addAdditionChange(Object key, Integer count)

This method takes a single addition value and records it.

addRemoveChangeback to summary
public void addRemoveChange(HashMap<K, V> additions, HashMap<K, V> databaseCount)

This method takes a hashtable of primitive objects and adds them to the remove list. Each reference in the hashtable lists the number of this object that needs to be removed from the collection.

addRemoveChangeback to summary
public void addRemoveChange(Object key, Integer count)

This method takes a single remove change and integrates it with this changeset.

clearChangesback to summary
public void clearChanges()

Implements abstract org.eclipse.persistence.internal.sessions.DeferrableChangeRecord.clearChanges.

Clears info about added / removed objects set by change tracker.

Annotations
@Override
decrementDatabaseCountback to summary
public void decrementDatabaseCount(Object object)

Decrement the count for object

getAddObjectListback to summary
public Vector<E> getAddObjectList()

Implements org.eclipse.persistence.sessions.changesets.DirectCollectionChangeRecord.getAddObjectList.

ADVANCED: This method returns the list of added objects.

Returns:Vector<E>

Doc from org.eclipse.persistence.sessions.changesets.DirectCollectionChangeRecord.getAddObjectList.

java.util.Vector

Annotations
@Override
getAddObjectMapback to summary
public HashMap<K, V> getAddObjectMap()

This method returns the collection of objects that were added to the collection.

getChangedIndexesback to summary
public Map<K, V> getChangedIndexes()
getCommitAddMapback to summary
public HashMap<K, V> getCommitAddMap()

This method returns the collection of objects that were added to the collection.

getNewSizeback to summary
public int getNewSize()
getOldSizeback to summary
public int getOldSize()
getRemoveObjectListback to summary
public Vector<E> getRemoveObjectList()

Implements org.eclipse.persistence.sessions.changesets.DirectCollectionChangeRecord.getRemoveObjectList.

ADVANCED: This method returns the list of removed objects.

Returns:Vector<E>

Doc from org.eclipse.persistence.sessions.changesets.DirectCollectionChangeRecord.getRemoveObjectList.

java.util.Vector

Annotations
@Override
getRemoveObjectMapback to summary
public HashMap<K, V> getRemoveObjectMap()

This method returns the collection of objects that were removed from the collection.

hasChangesback to summary
public boolean hasChanges()

Returns true if the change set has changes.

incrementDatabaseCountback to summary
public void incrementDatabaseCount(Object object)

Increment the count for object

internalRecreateOriginalCollectionback to summary
public void internalRecreateOriginalCollection(Object currentCollection, AbstractSession session)

Implements abstract org.eclipse.persistence.internal.sessions.DeferrableChangeRecord.internalRecreateOriginalCollection.

Recreates the original state of the collection.

Annotations
@Override
isFirstToAddAlreadyInCollectionback to summary
public boolean isFirstToAddAlreadyInCollection()
isFirstToRemoveAlreadyOutCollectionback to summary
public boolean isFirstToRemoveAlreadyOutCollection()
mergeRecordback to summary
public void mergeRecord(ChangeRecord mergeFromRecord, UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)

Implements abstract org.eclipse.persistence.internal.sessions.ChangeRecord.mergeRecord.

This method will be used to merge one record into another.

Annotations
@Override
orderHasBeenRepairedback to summary
public boolean orderHasBeenRepaired()
setChangedIndexesback to summary
public void setChangedIndexes(Map<K, V> changedIndexes)
setCommitAdditionback to summary
public void setCommitAddition(Hashtable<K, V> additions)

This method takes a hashtable of primitives and adds them to the commit list. This count value provided is the number of instances that will need to be inserted into the database once a remove has occurred. This is only set once for each object type.

setFirstToAddAlreadyInCollectionback to summary
public void setFirstToAddAlreadyInCollection(boolean flag)
setFirstToRemoveAlreadyOutCollectionback to summary
public void setFirstToRemoveAlreadyOutCollection(boolean flag)
setNewSizeback to summary
public void setNewSize(int size)
setOldSizeback to summary
public void setOldSize(int size)
setOrderHasBeenRepairedback to summary
public void setOrderHasBeenRepaired(boolean hasBeenRepaired)
storeDatabaseCountsback to summary
public void storeDatabaseCounts(Object collection, ContainerPolicy containerPolicy, AbstractSession session)

This method will iterate over the collection and store the database counts for the objects within the collection, this is used for minimal updates.

updateReferencesback to summary
public void updateReferences(UnitOfWorkChangeSet mergeToChangeSet, UnitOfWorkChangeSet mergeFromChangeSet)

Implements abstract org.eclipse.persistence.internal.sessions.ChangeRecord.updateReferences.

This method will be used to update the objectsChangeSets references

Annotations
@Override
org.eclipse.persistence.internal.sessions back to summary

public Class DirectCollectionChangeRecord.NULL

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.persistence.internal.sessions.DirectCollectionChangeRecord.NULL

Constructor Summary

AccessConstructor and Description
public
NULL()

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
object
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
Inherited from java.lang.Object:
clonefinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NULLback to summary
public NULL()

Method Detail

equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
object:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override