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

public Class CollectionChangeRecord

extends DeferrableChangeRecord
implements CollectionChangeRecord
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.sessions.changesets.CollectionChangeRecord, org.eclipse.persistence.sessions.changesets.ChangeRecord
Known Direct Subclasses
org.eclipse.persistence.eis.EISCollectionChangeRecord, org.eclipse.persistence.eis.EISOrderedCollectionChangeRecord, org.eclipse.persistence.internal.sessions.AggregateCollectionChangeRecord
Imports
java.util.ArrayList, .HashMap, .IdentityHashMap, .Iterator, .List, .Map, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.descriptors.changetracking.CollectionChangeEvent, org.eclipse.persistence.exceptions.ValidationException, 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.

Field Summary

Modifier and TypeField and Description
protected Map<ObjectChangeSet, ObjectChangeSet>
addObjectList

Contains the added values to the collection and their corresponding ChangeSets.

protected transient List<ObjectChangeSet>
addOverFlow

Contains a list of extra adds.

protected Map<ObjectChangeSet, Integer>
orderedAddObjectIndices

Contains the added values index to the collection.

protected List<ObjectChangeSet>
orderedAddObjects

Contains the added values to the collection and their corresponding ChangeSets in order.

protected List<OrderedChangeObject>
orderedChangeObjectList

Contains OrderedChangeObjects representing each change made to the collection.

protected transient List<Integer>
orderedRemoveObjectIndices

Contains the removed values index to the collection.

protected Map<Integer, ObjectChangeSet>
orderedRemoveObjects

Contains the removed values to the collection and their corresponding ChangeSets.

protected boolean
orderHasBeenRepaired

Indicates whether IndirectList's order has been repaired.

protected Map<ObjectChangeSet, ObjectChangeSet>
removeObjectList

Contains the removed values from the collection and their corresponding ChangeSets.

Inherited from org.eclipse.persistence.internal.sessions.DeferrableChangeRecord:
isDeferredlatestCollectionoriginalCollection

Constructor Summary

AccessConstructor and Description
public
CollectionChangeRecord()

This default constructor.

public
CollectionChangeRecord(ObjectChangeSet
the changeSet that uses this record
owner
)

Constructor for the ChangeRecord representing a collection mapping

Method Summary

Modifier and TypeMethod and Description
public void
addAdditionChange(Map<K, V> objectChanges, ContainerPolicy cp, UnitOfWorkChangeSet changeSet, AbstractSession session)

This method takes a Map of objects, converts these into ObjectChangeSets.

public void
addOrderedAdditionChange(List<Object> orderedObjectsToAdd, Map<Object, Integer> objectChangesIndices, UnitOfWorkChangeSet changeSet, AbstractSession session)

This method takes a list of objects and converts them into ObjectChangeSets.

public void
addOrderedRemoveChange(List<Integer> indicesToRemove, Map<K, V> objectChanges, UnitOfWorkChangeSet changeSet, AbstractSession session)

This method takes a map of objects and converts them into ObjectChangeSets.

public void
addRemoveChange(Map<K, V> objectChanges, ContainerPolicy cp, UnitOfWorkChangeSet changeSet, AbstractSession session)

This method takes a Map of objects, converts these into ObjectChangeSets.

public void
clearChanges()

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

Clears info about added / removed objects set by change tracker.
public Map<ObjectChangeSet, ObjectChangeSet>
getAddObjectList()

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

ADVANCED: This method returns the collection of ChangeSets that were added to the collection.
public List<ObjectChangeSet>
getAddOverFlow()

Returns a list of extra adds.

public List<Integer>
getCurrentIndexesOfOriginalObjects(List<E> newList)

The same size as original list, at the i-th position holds the index of the i-th original object in the current list (-1 if the object was removed): for example: {0, -1, 1, -1, 3} means that: previous(0) == current(0); previous(1) was removed; previous(2) == current(1); previous(3) was removed; previous(4) == current(3);

public Integer
getOrderedAddObjectIndex(ObjectChangeSet changes)

This method returns the index of an object added to the collection.

public Map<ObjectChangeSet, Integer>
getOrderedAddObjectIndices()

This method returns the collection of ChangeSets that they were added to the collection.

public List<ObjectChangeSet>
getOrderedAddObjects()

This method returns the collection of ChangeSets in the order they were added to the collection.

public List<OrderedChangeObject>
getOrderedChangeObjectList()

This method returns the Vector of OrderedChangeObjects.

public Object
getOrderedRemoveObject(Integer index)

This method returns the index of an object removed from the collection.

public List<Integer>
getOrderedRemoveObjectIndices()

This method returns the ordered list of indices to remove from the collection.

public Map<Integer, ObjectChangeSet>
getOrderedRemoveObjects()

This method returns the collection of ChangeSets of objects removed from the collection.

pack-priv ClassDescriptor
getReferenceDescriptor(Object object, AbstractSession session)

Returns descriptor corresponding to the object.

public Map<ObjectChangeSet, ObjectChangeSet>
getRemoveObjectList()

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

PUBLIC: This method returns the Map that contains the removed values from the collection and their corresponding ChangeSets.
public boolean
hasChanges()

Implements org.eclipse.persistence.sessions.changesets.CollectionChangeRecord.hasChanges.

PUBLIC: Returns true if the change set has changes.
public void
internalRecreateOriginalCollection(Object currentCollection, AbstractSession session)

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

Recreates the original state of currentCollection.
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
setAddObjectList(Map<ObjectChangeSet, ObjectChangeSet> objectChangesList)

Sets the Added objects list.

public void
setOrderedAddObjectIndices(Map<ObjectChangeSet, Integer> orderedAddObjectIndices)

Sets collection of ChangeSets (and their respective index) that they were added to the collection.

public void
setOrderedAddObjects(List<ObjectChangeSet> orderedAddObjects)

Sets collection of ChangeSets that they were added to the collection.

public void
public void
setOrderedRemoveObjects(Map<Integer, ObjectChangeSet> orderedRemoveObjects)

Sets collection of ChangeSets that they were removed from the collection.

public void
setOrderHasBeenRepaired(boolean hasBeenRepaired)

public void
setRemoveObjectList(Map<ObjectChangeSet, ObjectChangeSet> objectChangesList)

Sets the removed objects list.

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

addObjectListback to summary
protected Map<ObjectChangeSet, ObjectChangeSet> addObjectList

Contains the added values to the collection and their corresponding ChangeSets.

addOverFlowback to summary
protected transient List<ObjectChangeSet> addOverFlow

Contains a list of extra adds. These extra adds are used by attribute change tracking to replicate behavior when someone adds the same object to a list and removes it once. In this case the object should still appear once in the change set.

orderedAddObjectIndicesback to summary
protected Map<ObjectChangeSet, Integer> orderedAddObjectIndices

Contains the added values index to the collection.

orderedAddObjectsback to summary
protected List<ObjectChangeSet> orderedAddObjects

Contains the added values to the collection and their corresponding ChangeSets in order.

orderedChangeObjectListback to summary
protected List<OrderedChangeObject> orderedChangeObjectList

Contains OrderedChangeObjects representing each change made to the collection.

orderedRemoveObjectIndicesback to summary
protected transient List<Integer> orderedRemoveObjectIndices

Contains the removed values index to the collection.

orderedRemoveObjectsback to summary
protected Map<Integer, ObjectChangeSet> orderedRemoveObjects

Contains the removed values to the collection and their corresponding ChangeSets.

orderHasBeenRepairedback to summary
protected boolean orderHasBeenRepaired

Indicates whether IndirectList's order has been repaired.

removeObjectListback to summary
protected Map<ObjectChangeSet, ObjectChangeSet> removeObjectList

Contains the removed values from the collection and their corresponding ChangeSets.

Constructor Detail

CollectionChangeRecordback to summary
public CollectionChangeRecord()

This default constructor.

CollectionChangeRecordback to summary
public CollectionChangeRecord(ObjectChangeSet owner)

Constructor for the ChangeRecord representing a collection mapping

Parameters
owner:ObjectChangeSet

the changeSet that uses this record

Method Detail

addAdditionChangeback to summary
public void addAdditionChange(Map<K, V> objectChanges, ContainerPolicy cp, UnitOfWorkChangeSet changeSet, AbstractSession session)

This method takes a Map of objects, converts these into ObjectChangeSets.

addOrderedAdditionChangeback to summary
public void addOrderedAdditionChange(List<Object> orderedObjectsToAdd, Map<Object, Integer> objectChangesIndices, UnitOfWorkChangeSet changeSet, AbstractSession session)

This method takes a list of objects and converts them into ObjectChangeSets. This method should only be called from a ListContainerPolicy. Additions to the list are made by index, hence, the second Map of objectChangesIndices.

addOrderedRemoveChangeback to summary
public void addOrderedRemoveChange(List<Integer> indicesToRemove, Map<K, V> objectChanges, UnitOfWorkChangeSet changeSet, AbstractSession session)

This method takes a map of objects and converts them into ObjectChangeSets. This method should only be called from a ListContainerPolicy. Deletions from the list is made by index, hence, the second Vector of indicesToRemove.

addRemoveChangeback to summary
public void addRemoveChange(Map<K, V> objectChanges, ContainerPolicy cp, UnitOfWorkChangeSet changeSet, AbstractSession session)

This method takes a Map of objects, converts these into ObjectChangeSets.

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
getAddObjectListback to summary
public Map<ObjectChangeSet, ObjectChangeSet> getAddObjectList()

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

ADVANCED: This method returns the collection of ChangeSets that were added to the collection.

Returns:Map<ObjectChangeSet, ObjectChangeSet>

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

java.util.Vector

Annotations
@Override
getAddOverFlowback to summary
public List<ObjectChangeSet> getAddOverFlow()

Returns a list of extra adds. These extra adds are used by attribute change tracking to replicate behavior when someone adds the same object to a list and removes it once. In this case the object should still appear once in the change set.

getCurrentIndexesOfOriginalObjectsback to summary
public List<Integer> getCurrentIndexesOfOriginalObjects(List<E> newList)

The same size as original list, at the i-th position holds the index of the i-th original object in the current list (-1 if the object was removed): for example: {0, -1, 1, -1, 3} means that: previous(0) == current(0); previous(1) was removed; previous(2) == current(1); previous(3) was removed; previous(4) == current(3);

getOrderedAddObjectIndexback to summary
public Integer getOrderedAddObjectIndex(ObjectChangeSet changes)

This method returns the index of an object added to the collection.

getOrderedAddObjectIndicesback to summary
public Map<ObjectChangeSet, Integer> getOrderedAddObjectIndices()

This method returns the collection of ChangeSets that they were added to the collection.

getOrderedAddObjectsback to summary
public List<ObjectChangeSet> getOrderedAddObjects()

This method returns the collection of ChangeSets in the order they were added to the collection. This list includes those objects that were moved within the collection.

getOrderedChangeObjectListback to summary
public List<OrderedChangeObject> getOrderedChangeObjectList()

This method returns the Vector of OrderedChangeObjects. These objects represent all changes made to the collection, and their order in the vector represents the order they were performed.

getOrderedRemoveObjectback to summary
public Object getOrderedRemoveObject(Integer index)

This method returns the index of an object removed from the collection.

getOrderedRemoveObjectIndicesback to summary
public List<Integer> getOrderedRemoveObjectIndices()

This method returns the ordered list of indices to remove from the collection.

getOrderedRemoveObjectsback to summary
public Map<Integer, ObjectChangeSet> getOrderedRemoveObjects()

This method returns the collection of ChangeSets of objects removed from the collection.

getReferenceDescriptorback to summary
pack-priv ClassDescriptor getReferenceDescriptor(Object object, AbstractSession session)

Returns descriptor corresponding to the object.

getRemoveObjectListback to summary
public Map<ObjectChangeSet, ObjectChangeSet> getRemoveObjectList()

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

PUBLIC: This method returns the Map that contains the removed values from the collection and their corresponding ChangeSets.

Returns:Map<ObjectChangeSet, ObjectChangeSet>

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

java.util.Vector

Annotations
@Override
hasChangesback to summary
public boolean hasChanges()

Implements org.eclipse.persistence.sessions.changesets.CollectionChangeRecord.hasChanges.

PUBLIC: Returns true if the change set has changes.

Returns:boolean

Doc from org.eclipse.persistence.sessions.changesets.CollectionChangeRecord.hasChanges.

boolean

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

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

Recreates the original state of currentCollection.

Annotations
@Override
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()
setAddObjectListback to summary
public void setAddObjectList(Map<ObjectChangeSet, ObjectChangeSet> objectChangesList)

Sets the Added objects list.

setOrderedAddObjectIndicesback to summary
public void setOrderedAddObjectIndices(Map<ObjectChangeSet, Integer> orderedAddObjectIndices)

Sets collection of ChangeSets (and their respective index) that they were added to the collection.

setOrderedAddObjectsback to summary
public void setOrderedAddObjects(List<ObjectChangeSet> orderedAddObjects)

Sets collection of ChangeSets that they were added to the collection.

setOrderedChangeObjectListback to summary
public void setOrderedChangeObjectList(List<OrderedChangeObject> orderedChangeObjectList)
setOrderedRemoveObjectsback to summary
public void setOrderedRemoveObjects(Map<Integer, ObjectChangeSet> orderedRemoveObjects)

Sets collection of ChangeSets that they were removed from the collection.

setOrderHasBeenRepairedback to summary
public void setOrderHasBeenRepaired(boolean hasBeenRepaired)
setRemoveObjectListback to summary
public void setRemoveObjectList(Map<ObjectChangeSet, ObjectChangeSet> objectChangesList)

Sets the removed objects list.

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