Class ContainerPolicy
- java.lang.Object
-
- org.eclipse.persistence.internal.queries.ContainerPolicy
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,CoreContainerPolicy<AbstractSession>
- Direct Known Subclasses:
CursorPolicy
,InterfaceContainerPolicy
public abstract class ContainerPolicy extends java.lang.Object implements CoreContainerPolicy<AbstractSession>, java.lang.Cloneable, java.io.Serializable
Purpose: Used to support collections in read queries.
Responsibilities: Map the results into the appropriate collection instance. Generically support special collections like cursored stream and virtual collection.
- Since:
- TOPLink/Java 1.2
- Author:
- James Sutherland
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.reflect.Constructor
constructor
protected static java.lang.Class
defaultContainerClass
Allow the default collection class to be set.protected ClassDescriptor
elementDescriptor
The descriptor is used to wrap and unwrap objects using the wrapper policy.
-
Constructor Summary
Constructors Constructor Description ContainerPolicy()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addAdditionalFieldsToQuery(ReadQuery selectionQuery, Expression baseExpression)
INTERNAL: Called when the selection query is being initialized to add any required additional fields to the query.boolean
addAll(java.util.List elements, java.lang.Object container, AbstractSession session, java.util.List<AbstractRecord> rows, DataReadQuery query, CacheKey parentCacheKey, boolean isTargetProtected)
INTERNAL: This is used for ordered List containers to add all of the elements to the collection in the order of the index field in the row.boolean
addAll(java.util.List elements, java.lang.Object container, AbstractSession session, java.util.List<AbstractRecord> dbRows, ObjectBuildingQuery query, CacheKey parentCacheKey, boolean isTargetProtected)
INTERNAL: This is used for ordered List containers to add all of the elements to the collection in the order of the index field in the row.void
addFieldsForMapKey(AbstractRecord joinRow)
INTERNAL: Called when the insert query is being initialized to ensure the fields for the key are in the insert queryboolean
addInto(java.lang.Object key, java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Add element to container.boolean
addInto(java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Add element to container.boolean
addInto(java.lang.Object element, java.lang.Object container, AbstractSession session, AbstractRecord row, DataReadQuery query, CacheKey parentCacheKey, boolean isTargetProtected)
INTERNAL: This is used for adding to a direct map or direct collection from the database.boolean
addInto(java.lang.Object element, java.lang.Object container, AbstractSession session, AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, boolean isTargetProtected)
INTERNAL: Add element to container.void
addNestedJoinsQueriesForMapKey(JoinedAttributeManager joinManager, ObjectLevelReadQuery query, AbstractSession session)
INTERNAL: Used for joining.void
addNextValueFromIteratorInto(java.lang.Object valuesIterator, java.lang.Object parent, CacheKey parentCacheKey, java.lang.Object toCollection, CollectionMapping mapping, java.lang.Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache)
INTERNAL: This method is used to add the next value from an iterator built using ContainerPolicy's iteratorFor() method into the toCollection.void
buildChangeSetForNewObjectInCollection(java.lang.Object object, ClassDescriptor referenceDescriptor, UnitOfWorkChangeSet uowChangeSet, AbstractSession session)
java.lang.Object
buildCloneForKey(java.lang.Object key, java.lang.Object parent, CacheKey parentCacheKey, java.lang.Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isCacheCheckComplete)
Build a clone for the key of a Map represented by this container policy if necessary.java.lang.Object
buildCollectionEntry(java.lang.Object objectAdded, ObjectChangeSet changeSet)
INTERNAL: Return an object representing an entry in the collection represented by this container policy This method will be overridden to allow MapContainerPolicy to return a construct that contains the key and the valuejava.lang.Object
buildContainerFromVector(java.util.Vector vector, AbstractSession session)
INTERNAL: Return a container populated with the contents of the specified Vector.static ContainerPolicy
buildDefaultPolicy()
INTERNAL: Return the appropriate container policy for the default container class.java.lang.Object
buildKey(AbstractRecord row, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)
Extract the key for the map from the provided row overridden by subclasses that deal with map keysjava.lang.Object
buildKeyFromJoinedRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)
Extract the key for the map from the provided row overridden by subclasses that deal with map keysstatic ContainerPolicy
buildPolicyFor(java.lang.Class concreteContainerClass)
INTERNAL: Return the appropriate container policy for the specified concrete container class.static ContainerPolicy
buildPolicyFor(java.lang.Class concreteContainerClass, boolean hasOrdering)
INTERNAL: Return the appropriate container policy for the specified concrete container class.java.lang.Object[]
buildReferencesPKList(java.lang.Object container, AbstractSession session)
INTERNAL: This method will access the target relationship and create a list of information to rebuild the collection.ReadQuery
buildSelectionQueryForDirectCollectionMapping()
INTERNAL: This Certain key mappings favor different types of selection query.void
cascadeDiscoverAndPersistUnregisteredNewObjects(java.lang.Object object, java.util.Map newObjects, java.util.Map unregisteredExistingObjects, java.util.Map visitedObjects, UnitOfWorkImpl uow, java.util.Set cascadeErrors)
INTERNAL: Cascade DiscoverAndPersistUnregisteredNewObjects to any mappings managed by the container policy.void
cascadePerformRemoveIfRequired(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map visitedObjects)
INTERNAL: Cascade performRemove to any mappings managed by the container policy.void
cascadeRegisterNewIfRequired(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map visitedObjects)
INTERNAL: Cascade registerNew to any mappings managed by the container policy.void
clear(java.lang.Object container)
INTERNAL: Remove all the elements from the specified container.java.lang.Object
clone()
ContainerPolicy
clone(ReadQuery query)
java.lang.Object
cloneFor(java.lang.Object container)
INTERNAL: Return a clone of the specified container.protected void
collectObjectForNewCollection(java.util.Map originalKeyValues, java.util.Map cloneKeyValues, java.lang.Object newCollection, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor)
INTERNAL: Iterate over the list of new objects and create change sets for them This method is overridden by subclasses to handle map keysvoid
compareCollectionsForChange(java.lang.Object oldCollection, java.lang.Object newCollection, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor)
INTERNAL: This method is used to calculate the differences between two collections.boolean
compareKeys(java.lang.Object sourceKey, AbstractSession session)
INTERNAL: Return true if keys are the same in the source as the backup.java.lang.Object
concatenateContainers(java.lang.Object firstContainer, java.lang.Object secondContainer, AbstractSession session)
INTERNAL: Build a new container, add the contents of each of the specified containers to it, and return it.java.lang.Object
containerInstance()
INTERNAL: Return an instance of the container class.java.lang.Object
containerInstance(int initialCapacity)
INTERNAL: Return an instance of the container class with the specified initial capacity.protected boolean
contains(java.lang.Object element, java.lang.Object container)
INTERNAL: Return whether element exists in container.boolean
contains(java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Check if the object is contained in the collection.void
convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this ContainerPolicy to actual class-based settings This method is implemented by subclasses as necessary.static void
copyMapDataToRow(java.util.Map mappingData, AbstractRecord databaseRow)
INTERNAL: convenience method to copy the keys and values from a Map into an AbstractRecordabstract CollectionChangeEvent
createChangeEvent(java.lang.Object collectionOwner, java.lang.String propertyName, java.lang.Object collectionChanged, java.lang.Object elementChanged, int changeType, java.lang.Integer index, boolean isChangeApplied)
INTERNAL: Creates a CollectionChangeEvent for the containerprotected void
createChangeSetForKeys(java.util.Map originalKeyValues, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor)
INTERNAL: Create change sets that contain map keys.java.lang.Object
createWrappedObjectFromExistingWrappedObject(java.lang.Object wrappedObject, java.lang.Object parent, ClassDescriptor referenceDescriptor, MergeManager mergeManager, AbstractSession targetSession)
INTERNAL: This method will actually potentially wrap an object in two ways.void
deleteWrappedObject(java.lang.Object objectDeleted, AbstractSession session)
INTERNAL: Delete the passed object This may be overridden by subclasses to deal with composite objectsboolean
equals(java.lang.Object object)
INTERNAL: Return if the policy is equal to the other.java.lang.Object
execute()
INTERNAL: This can be used by collection such as cursored stream to gain control over execution.java.util.List<DatabaseField>
getAdditionalFieldsForJoin(CollectionMapping baseMapping)
INTERNAL: Return any additional fields required by the policy for a fetch join.java.util.List<DatabaseTable>
getAdditionalTablesForJoinQuery()
INTERNAL: Return any tables that will be required when this mapping is used as part of a join query.java.util.Iterator
getChangeValuesFrom(java.util.Map map)
INTERNAL: Used to create an iterator on a the Map object passed to CollectionChangeRecord.addRemoveChange() to access the values to be removed.java.lang.Object
getCloneDataFromChangeSet(ObjectChangeSet changeSet)
INTERNAL: Used when objects are added or removed during an update.protected java.lang.reflect.Constructor
getConstructor()
INTERNAL: Return the size constructor if available.java.lang.Class
getContainerClass()
INTERNAL: Return the class used for the container.java.lang.String
getContainerClassName()
INTERNAL: Used by the MWstatic java.lang.Class
getDefaultContainerClass()
ADVANCED: Return the default collection class.ClassDescriptor
getDescriptorForMapKey()
INTERNAL: Return the reference descriptor for the map key if it existsClassDescriptor
getElementDescriptor()
INTERNAL: Used for wrapping and unwrapping with the wrapper policy.java.util.List<DatabaseField>
getIdentityFieldsForMapKey()
INTERNAL: Return the fields that make up the identity of the key if this mapping is a list This method will be overridden by subclasses.java.util.Map
getKeyMappingDataForWriteQuery(java.lang.Object object, AbstractSession session)
INTERNAL: Add any non-Foreign-key data from an Object describe by a MapKeyMapping to a database row This is typically used in write queries to ensure all the data stored in the collection table is included in the query.Expression
getKeySelectionCriteria()
INTERNAL: Get the selection criteria for the map key This will be overridden by container policies that allow mapsjava.lang.Object
getKeyType()
INTERNAL: Return the type of the map key, this will be overridden by container policies that allow maps.boolean
hasElementDescriptor()
INTERNAL: Used for wrapping and unwrapping with the wrapper policy.int
hashCode()
abstract boolean
hasNext(java.lang.Object iterator)
INTERNAL: Return whether the iterator has more objects.boolean
hasOrder()
INTERNAL: Returns true if the collection has ordervoid
initialize(AbstractSession session, DatabaseTable keyTable)
INTERNAL: Provide a hook to allow initialization of Container Policy partsvoid
initializeConstructor()
INTERNAL: Find the size constructor.boolean
isCollectionPolicy()
boolean
isCursoredStreamPolicy()
boolean
isCursorPolicy()
boolean
isDirectMapPolicy()
boolean
isEmpty(java.lang.Object container)
INTERNAL: Return whether the container is empty.boolean
isListPolicy()
boolean
isMapKeyObject()
INTERNAL: Return if the map key this container policy represents is a OneToOne.boolean
isMappedKeyMapPolicy()
boolean
isMapPolicy()
boolean
isOrderedListPolicy()
boolean
isScrollableCursorPolicy()
boolean
isValidContainer(java.lang.Object container)
INTERNAL: Return whether the specified object is of a valid container type.boolean
isValidContainerType(java.lang.Class containerType)
INTERNAL: Return whether the specified type is a valid container type.void
iterateOnMapKey(DescriptorIterator iterator, java.lang.Object element)
INTERNAL: Used in Descriptor Iteration to iterate on map keys.abstract java.lang.Object
iteratorFor(java.lang.Object container)
INTERNAL: Return an iterator for the given container.java.lang.Object
keyFrom(java.lang.Object element, AbstractSession session)
INTERNAL: Return the key for the specified element..java.lang.Object
keyFromEntry(java.lang.Object entry)
Get the key from the passed in Map.Entry This method will be overridden by ContainerPolicies that allows maps.java.lang.Object
keyFromIterator(java.lang.Object iterator)
java.lang.Object
mergeCascadeParts(ObjectChangeSet objectChanges, MergeManager mergeManager, AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object.protected void
mergeChanges(CollectionChangeRecord changeRecord, java.lang.Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object.void
mergeChanges(CollectionChangeRecord changeRecord, java.lang.Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession, boolean isSynchronizeOnMerge)
INTERNAL: Merge changes from the source to the target object.protected abstract java.lang.Object
next(java.lang.Object iterator)
INTERNAL: Return the next object on the queue.java.lang.Object
next(java.lang.Object iterator, AbstractSession session)
INTERNAL: Return the next object from the iterator.java.lang.Object
nextEntry(java.lang.Object iterator)
INTERNAL: Return the next object on the queue.java.lang.Object
nextEntry(java.lang.Object iterator, AbstractSession session)
INTERNAL: Return the next object on the queue.boolean
overridesRead()
This can be used by collection such as cursored stream to gain control over execution.void
postCalculateChanges(java.lang.Object key, java.lang.Object value, ClassDescriptor referenceDescriptor, DatabaseMapping mapping, UnitOfWorkImpl uow)
INTERNAL: Add the provided object to the deleted objects list on the commit manager.void
postCalculateChanges(ObjectChangeSet ocs, ClassDescriptor referenceDescriptor, DatabaseMapping mapping, UnitOfWorkImpl uow)
INTERNAL: Add the provided object to the deleted objects list on the commit manager.void
postInitialize(AbstractSession session)
INTERNAL: Some subclasses need to post initialize mappings associated with themvoid
prepare(DatabaseQuery query, AbstractSession session)
Prepare and validate.void
prepareForExecution()
Prepare and validate.void
processAdditionalWritableMapKeyFields(AbstractSession session)
INTERNAL: This method is used to check the key mapping to ensure that it does not write to a field that is written by another mapping.boolean
propagatesEventsToCollection()
INTERNAL: Returns false.void
propogatePostDelete(DeleteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeysvoid
propogatePostInsert(WriteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeysvoid
propogatePostUpdate(WriteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeysvoid
propogatePreDelete(DeleteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeysvoid
propogatePreInsert(WriteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeysvoid
propogatePreUpdate(WriteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeysvoid
recordAddToCollectionInChangeRecord(ObjectChangeSet changeSetToAdd, CollectionChangeRecord collectionChangeRecord)
This method is used to bridge the behavior between Attribute Change Tracking and deferred change tracking with respect to adding the same instance multiple times.void
recordPrivateOwnedRemovals(java.lang.Object object, ClassDescriptor referenceDescriptor, UnitOfWorkImpl uow)
INTERNAL: Add the provided object to the deleted objects list on the commit manager.void
recordRemoveFromCollectionInChangeRecord(ObjectChangeSet changeSetToRemove, CollectionChangeRecord collectionChangeRecord)
This method is used to bridge the behavior between Attribute Change Tracking and deferred change tracking with respect to adding the same instance multiple times.void
recordUpdateToCollectionInChangeRecord(CollectionChangeEvent event, ObjectChangeSet changeSet, CollectionChangeRecord collectionChangeRecord)
This method is used to bridge the behavior between Attribute Change Tracking and deferred change tracking with respect to adding the same instance multiple times.java.lang.Object
remoteExecute()
This can be used by collection such as cursored stream to gain control over execution.protected boolean
removeFrom(java.lang.Object key, java.lang.Object element, java.lang.Object container)
INTERNAL: Remove element from container.boolean
removeFrom(java.lang.Object key, java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Remove the object from the collection.boolean
removeFrom(java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Remove the object from the collection.boolean
requiresDataModificationEvents()
INTERNAL: Returns whether this ContainerPolicy should requires data modification events when objects are added or deleted during updateprotected void
setConstructor(java.lang.reflect.Constructor constructor)
INTERNAL: Set the size constructor if available.void
setContainerClass(java.lang.Class containerClass)
INTERNAL: Set the class used for the container.void
setContainerClassName(java.lang.String containerClassName)
INTERNAL: Used by the MWstatic void
setDefaultContainerClass(java.lang.Class collectionClass)
ADVANCED: Allow the default collection class to be set.void
setElementDescriptor(ClassDescriptor elementDescriptor)
INTERNAL: Used for wrapping and unwrapping with the wrapper policy.void
setKeyName(java.lang.String instanceVariableName, java.lang.Class elementClass)
INTERNAL: Sets the key name to be used to generate the key in a Map type container class.void
setKeyName(java.lang.String instanceVariableName, java.lang.String elementClassName)
INTERNAL: It is illegal to send this message to this receiver.boolean
shouldAddAll()
INTERNAL: Indicates whether addAll method should be called to add entire collection, or it's possible to call addInto multiple times instead.boolean
shouldIncludeKeyInDeleteEvent()
INTERNAL: Return whether data for a map key must be included on a Delete data modification event This will be overridden by subclasses that handle maps.boolean
shouldUpdateForeignKeysPostInsert()
INTERNAL: Certain types of container policies require an extra update statement after a relationship is inserted.int
sizeFor(java.lang.Object container)
INTERNAL: Return the size of container.java.lang.String
toString()
protected java.lang.Object
toStringInfo()
java.lang.Object
unwrapElement(java.lang.Object object)
INTERNAL: MapContainerPolicy's iterator iterates on the Entries of a Map.java.lang.Object
unwrapIteratorResult(java.lang.Object object)
INTERNAL: Depending on the container, the entries returned of iteration using the ContainerPolicy.iteratorFor() method may be wrapped.void
updateChangeRecordForSelfMerge(ChangeRecord changeRecord, java.lang.Object source, java.lang.Object target, ForeignReferenceMapping mapping, UnitOfWorkChangeSet parentUOWChangeSet, UnitOfWorkImpl unitOfWork)
INTERNAL: Update a ChangeRecord to replace the ChangeSet for the old entity with the changeSet for the new Entity.int
updateJoinedMappingIndexesForMapKey(java.util.Map<DatabaseMapping,java.lang.Object> indexList, int index)
INTERNAL: Update the joined mapping indices This method is a no-op, but will be overridden by subclassesjava.lang.Object
valueFromPKList(java.lang.Object[] pks, AbstractRecord foreignKeys, ForeignReferenceMapping mapping, AbstractSession session)
INTERNAL: This method is used to load a relationship from a list of PKs.java.util.Vector
vectorFor(java.lang.Object container, AbstractSession session)
INTERNAL: Return a Vector populated with the contents of container.
-
-
-
Field Detail
-
defaultContainerClass
protected static java.lang.Class defaultContainerClass
Allow the default collection class to be set.
-
elementDescriptor
protected transient ClassDescriptor elementDescriptor
The descriptor is used to wrap and unwrap objects using the wrapper policy.
-
constructor
protected transient java.lang.reflect.Constructor constructor
-
-
Method Detail
-
getDefaultContainerClass
public static java.lang.Class getDefaultContainerClass()
ADVANCED: Return the default collection class.
-
setDefaultContainerClass
public static void setDefaultContainerClass(java.lang.Class collectionClass)
ADVANCED: Allow the default collection class to be set.
-
addAdditionalFieldsToQuery
public void addAdditionalFieldsToQuery(ReadQuery selectionQuery, Expression baseExpression)
INTERNAL: Called when the selection query is being initialized to add any required additional fields to the query. By default, there are not additional fields required but this method is overridden by subclasses.- See Also:
MappedKeyMapContinerPolicy
-
addFieldsForMapKey
public void addFieldsForMapKey(AbstractRecord joinRow)
INTERNAL: Called when the insert query is being initialized to ensure the fields for the key are in the insert query- See Also:
MappedKeyMapContainerPolicy
-
addInto
public boolean addInto(java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Add element to container. This is used to add to a collection independent of JDK 1.1 and 1.2. The session may be required to wrap for the wrapper policy. Return whether the container changed- Specified by:
addInto
in interfaceCoreContainerPolicy<AbstractSession>
-
addInto
public boolean addInto(java.lang.Object element, java.lang.Object container, AbstractSession session, AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, boolean isTargetProtected)
INTERNAL: Add element to container. This is used to add to a collection independent of type. The session may be required to wrap for the wrapper policy. The row may be required by subclasses, such as MappedKeyMap. Return whether the container changed.
-
addAll
public boolean addAll(java.util.List elements, java.lang.Object container, AbstractSession session, java.util.List<AbstractRecord> dbRows, ObjectBuildingQuery query, CacheKey parentCacheKey, boolean isTargetProtected)
INTERNAL: This is used for ordered List containers to add all of the elements to the collection in the order of the index field in the row. This is currently only used by OrderListContainerPolicy, so this is just a stub. The passing of the query is to allow future compatibility with Maps (ordered Map).
-
addInto
public boolean addInto(java.lang.Object element, java.lang.Object container, AbstractSession session, AbstractRecord row, DataReadQuery query, CacheKey parentCacheKey, boolean isTargetProtected)
INTERNAL: This is used for adding to a direct map or direct collection from the database. The row data may also be requires, as in the case of indexed ordered lists, or direct maps.
-
addAll
public boolean addAll(java.util.List elements, java.lang.Object container, AbstractSession session, java.util.List<AbstractRecord> rows, DataReadQuery query, CacheKey parentCacheKey, boolean isTargetProtected)
INTERNAL: This is used for ordered List containers to add all of the elements to the collection in the order of the index field in the row. This is currently only used by OrderListContainerPolicy, so this is just a stub. The passing of the query is to allow future compatibility with Maps (ordered Map).
-
addInto
public boolean addInto(java.lang.Object key, java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Add element to container. This is used to add to a collection independent of type. The session may be required to wrap for the wrapper policy. Return whether the container changed.- Specified by:
addInto
in interfaceCoreContainerPolicy<AbstractSession>
-
addNestedJoinsQueriesForMapKey
public void addNestedJoinsQueriesForMapKey(JoinedAttributeManager joinManager, ObjectLevelReadQuery query, AbstractSession session)
INTERNAL: Used for joining. Add any queries necessary for joining to the join manager This method will be overridden by subclasses that handle map keys
-
addNextValueFromIteratorInto
public void addNextValueFromIteratorInto(java.lang.Object valuesIterator, java.lang.Object parent, CacheKey parentCacheKey, java.lang.Object toCollection, CollectionMapping mapping, java.lang.Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache)
INTERNAL: This method is used to add the next value from an iterator built using ContainerPolicy's iteratorFor() method into the toCollection. This method is overridden by subclasses to provide extended functionality for map keys- Parameters:
valuesIterator
-toCollection
-mapping
-unitOfWork
-isExisting
-- See Also:
MappedKeyMapContainerPolicy
-
buildCloneForKey
public java.lang.Object buildCloneForKey(java.lang.Object key, java.lang.Object parent, CacheKey parentCacheKey, java.lang.Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isCacheCheckComplete)
Build a clone for the key of a Map represented by this container policy if necessary. By default, the key is not cloned since in standard EclipseLink Mappings it will not be an Entity- Parameters:
key
-cloningSession
-isExisting
-- Returns:
-
buildCollectionEntry
public java.lang.Object buildCollectionEntry(java.lang.Object objectAdded, ObjectChangeSet changeSet)
INTERNAL: Return an object representing an entry in the collection represented by this container policy This method will be overridden to allow MapContainerPolicy to return a construct that contains the key and the value- Parameters:
objectAdded
-changeSet
-- Returns:
- See Also:
MappedKeyMapContainerPolicy
-
buildContainerFromVector
public java.lang.Object buildContainerFromVector(java.util.Vector vector, AbstractSession session)
INTERNAL: Return a container populated with the contents of the specified Vector.
-
buildKey
public java.lang.Object buildKey(AbstractRecord row, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)
Extract the key for the map from the provided row overridden by subclasses that deal with map keys- Parameters:
row
-query
-session
-- Returns:
-
buildReferencesPKList
public java.lang.Object[] buildReferencesPKList(java.lang.Object container, AbstractSession session)
INTERNAL: This method will access the target relationship and create a list of information to rebuild the collection. This method is used in combination with the CachedValueHolder to store references to PK's to be loaded from a cache instead of a query.
-
buildKeyFromJoinedRow
public java.lang.Object buildKeyFromJoinedRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)
Extract the key for the map from the provided row overridden by subclasses that deal with map keys- Parameters:
row
-query
-session
-- Returns:
-
buildDefaultPolicy
public static ContainerPolicy buildDefaultPolicy()
INTERNAL: Return the appropriate container policy for the default container class.
-
buildPolicyFor
public static ContainerPolicy buildPolicyFor(java.lang.Class concreteContainerClass)
INTERNAL: Return the appropriate container policy for the specified concrete container class.
-
buildPolicyFor
public static ContainerPolicy buildPolicyFor(java.lang.Class concreteContainerClass, boolean hasOrdering)
INTERNAL: Return the appropriate container policy for the specified concrete container class.
-
buildSelectionQueryForDirectCollectionMapping
public ReadQuery buildSelectionQueryForDirectCollectionMapping()
INTERNAL: This Certain key mappings favor different types of selection query. Return the appropriate type of selectionQuery- Returns:
-
clear
public void clear(java.lang.Object container)
INTERNAL: Remove all the elements from the specified container. Valid only for certain subclasses.- Specified by:
clear
in interfaceCoreContainerPolicy<AbstractSession>
-
createChangeEvent
public abstract CollectionChangeEvent createChangeEvent(java.lang.Object collectionOwner, java.lang.String propertyName, java.lang.Object collectionChanged, java.lang.Object elementChanged, int changeType, java.lang.Integer index, boolean isChangeApplied)
INTERNAL: Creates a CollectionChangeEvent for the container
-
equals
public boolean equals(java.lang.Object object)
INTERNAL: Return if the policy is equal to the other. By default if they are the same class, they are considered equal. This is used for query parse caching.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
cascadeDiscoverAndPersistUnregisteredNewObjects
public void cascadeDiscoverAndPersistUnregisteredNewObjects(java.lang.Object object, java.util.Map newObjects, java.util.Map unregisteredExistingObjects, java.util.Map visitedObjects, UnitOfWorkImpl uow, java.util.Set cascadeErrors)
INTERNAL: Cascade DiscoverAndPersistUnregisteredNewObjects to any mappings managed by the container policy. Be default, this is a no-op, but will be overridden by subclasses
-
cascadePerformRemoveIfRequired
public void cascadePerformRemoveIfRequired(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map visitedObjects)
INTERNAL: Cascade performRemove to any mappings managed by the container policy. Be default, this is a no-op, but will be overridden by subclasses
-
cascadeRegisterNewIfRequired
public void cascadeRegisterNewIfRequired(java.lang.Object object, UnitOfWorkImpl uow, java.util.Map visitedObjects)
INTERNAL: Cascade registerNew to any mappings managed by the container policy. Be default, this is a no-op, but will be overridden by subclasses
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
clone
public ContainerPolicy clone(ReadQuery query)
-
cloneFor
public java.lang.Object cloneFor(java.lang.Object container)
INTERNAL: Return a clone of the specified container. Can only be called for select subclasses.
-
createChangeSetForKeys
protected void createChangeSetForKeys(java.util.Map originalKeyValues, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor)
INTERNAL: Create change sets that contain map keys. This method will be overridden by subclasses that handle map keys- Parameters:
originalKeyValues
-changeRecord
-session
-referenceDescriptor
-
-
collectObjectForNewCollection
protected void collectObjectForNewCollection(java.util.Map originalKeyValues, java.util.Map cloneKeyValues, java.lang.Object newCollection, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor)
INTERNAL: Iterate over the list of new objects and create change sets for them This method is overridden by subclasses to handle map keys- Parameters:
originalKeyValues
-cloneKeyValues
-newCollection
-changeRecord
-session
-referenceDescriptor
-
-
compareCollectionsForChange
public void compareCollectionsForChange(java.lang.Object oldCollection, java.lang.Object newCollection, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor)
INTERNAL: This method is used to calculate the differences between two collections.
-
buildChangeSetForNewObjectInCollection
public void buildChangeSetForNewObjectInCollection(java.lang.Object object, ClassDescriptor referenceDescriptor, UnitOfWorkChangeSet uowChangeSet, AbstractSession session)
-
compareKeys
public boolean compareKeys(java.lang.Object sourceKey, AbstractSession session)
INTERNAL: Return true if keys are the same in the source as the backup. False otherwise in the case of readonly compare against the original For non map container policies return true always, because these policies have no concepts of Keys
-
concatenateContainers
public java.lang.Object concatenateContainers(java.lang.Object firstContainer, java.lang.Object secondContainer, AbstractSession session)
INTERNAL: Build a new container, add the contents of each of the specified containers to it, and return it. Both of the containers must use the same container policy (namely, this one).
-
containerInstance
public java.lang.Object containerInstance()
INTERNAL: Return an instance of the container class. Null should never be returned. A ValidationException is thrown on error.- Specified by:
containerInstance
in interfaceCoreContainerPolicy<AbstractSession>
-
containerInstance
public java.lang.Object containerInstance(int initialCapacity)
INTERNAL: Return an instance of the container class with the specified initial capacity. Null should never be returned. A ValidationException is thrown on error.- Specified by:
containerInstance
in interfaceCoreContainerPolicy<AbstractSession>
-
contains
protected boolean contains(java.lang.Object element, java.lang.Object container)
INTERNAL: Return whether element exists in container.
-
contains
public boolean contains(java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Check if the object is contained in the collection. This is used to check contains in a collection independent of JDK 1.1 and 1.2. The session may be required to unwrap for the wrapper policy.- Specified by:
contains
in interfaceCoreContainerPolicy<AbstractSession>
-
convertClassNamesToClasses
public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this ContainerPolicy to actual class-based settings This method is implemented by subclasses as necessary.- Parameters:
classLoader
-
-
createWrappedObjectFromExistingWrappedObject
public java.lang.Object createWrappedObjectFromExistingWrappedObject(java.lang.Object wrappedObject, java.lang.Object parent, ClassDescriptor referenceDescriptor, MergeManager mergeManager, AbstractSession targetSession)
INTERNAL: This method will actually potentially wrap an object in two ways. It will first wrap the object based on the referenceDescriptor's wrapper policy. It will also potentially do some wrapping based on what is required by the container policy.- Parameters:
wrappedObject
-parent
- if this is an aggregate, the owner of the aggregatereferenceDescriptor
-mergeManager
-- Returns:
- See Also:
MappedKeyMapContainerPolicy
-
deleteWrappedObject
public void deleteWrappedObject(java.lang.Object objectDeleted, AbstractSession session)
INTERNAL: Delete the passed object This may be overridden by subclasses to deal with composite objects- Parameters:
objectDeleted
-session
-- See Also:
MappedKeyMapContainerPolicy
-
execute
public java.lang.Object execute()
INTERNAL: This can be used by collection such as cursored stream to gain control over execution.
-
getAdditionalTablesForJoinQuery
public java.util.List<DatabaseTable> getAdditionalTablesForJoinQuery()
INTERNAL: Return any tables that will be required when this mapping is used as part of a join query.
-
getAdditionalFieldsForJoin
public java.util.List<DatabaseField> getAdditionalFieldsForJoin(CollectionMapping baseMapping)
INTERNAL: Return any additional fields required by the policy for a fetch join. This method will be overridden by ContainerPolicies that handle map keys.
-
getChangeValuesFrom
public java.util.Iterator getChangeValuesFrom(java.util.Map map)
INTERNAL: Used to create an iterator on a the Map object passed to CollectionChangeRecord.addRemoveChange() to access the values to be removed. In the case of some container policies the values will actually be the keys.
-
getCloneDataFromChangeSet
public java.lang.Object getCloneDataFromChangeSet(ObjectChangeSet changeSet)
INTERNAL: Used when objects are added or removed during an update. This method returns either the clone from the ChangeSet or a packaged version of it that contains things like map keys.
-
getConstructor
protected java.lang.reflect.Constructor getConstructor()
INTERNAL: Return the size constructor if available.
-
getContainerClass
public java.lang.Class getContainerClass()
INTERNAL: Return the class used for the container.
-
getContainerClassName
public java.lang.String getContainerClassName()
INTERNAL: Used by the MW
-
getDescriptorForMapKey
public ClassDescriptor getDescriptorForMapKey()
INTERNAL: Return the reference descriptor for the map key if it exists
-
getElementDescriptor
public ClassDescriptor getElementDescriptor()
INTERNAL: Used for wrapping and unwrapping with the wrapper policy.
-
getIdentityFieldsForMapKey
public java.util.List<DatabaseField> getIdentityFieldsForMapKey()
INTERNAL: Return the fields that make up the identity of the key if this mapping is a list This method will be overridden by subclasses.
-
getKeyMappingDataForWriteQuery
public java.util.Map getKeyMappingDataForWriteQuery(java.lang.Object object, AbstractSession session)
INTERNAL: Add any non-Foreign-key data from an Object describe by a MapKeyMapping to a database row This is typically used in write queries to ensure all the data stored in the collection table is included in the query.
-
getKeySelectionCriteria
public Expression getKeySelectionCriteria()
INTERNAL: Get the selection criteria for the map key This will be overridden by container policies that allow maps
-
getKeyType
public java.lang.Object getKeyType()
INTERNAL: Return the type of the map key, this will be overridden by container policies that allow maps.
-
hasElementDescriptor
public boolean hasElementDescriptor()
INTERNAL: Used for wrapping and unwrapping with the wrapper policy.
-
hasNext
public abstract boolean hasNext(java.lang.Object iterator)
INTERNAL: Return whether the iterator has more objects. The iterator is the one returned from #iteratorFor(). Valid for some subclasses only.- Specified by:
hasNext
in interfaceCoreContainerPolicy<AbstractSession>
- See Also:
iteratorFor(java.lang.Object)
-
hasOrder
public boolean hasOrder()
INTERNAL: Returns true if the collection has order
-
initialize
public void initialize(AbstractSession session, DatabaseTable keyTable)
INTERNAL: Provide a hook to allow initialization of Container Policy parts
-
initializeConstructor
public void initializeConstructor()
INTERNAL: Find the size constructor. Providing a size is important for performance.
-
isCollectionPolicy
public boolean isCollectionPolicy()
-
isCursoredStreamPolicy
public boolean isCursoredStreamPolicy()
-
isScrollableCursorPolicy
public boolean isScrollableCursorPolicy()
-
isCursorPolicy
public boolean isCursorPolicy()
-
isDirectMapPolicy
public boolean isDirectMapPolicy()
-
isEmpty
public boolean isEmpty(java.lang.Object container)
INTERNAL: Return whether the container is empty.- Specified by:
isEmpty
in interfaceCoreContainerPolicy<AbstractSession>
-
isListPolicy
public boolean isListPolicy()
- Specified by:
isListPolicy
in interfaceCoreContainerPolicy<AbstractSession>
-
isOrderedListPolicy
public boolean isOrderedListPolicy()
-
isMapPolicy
public boolean isMapPolicy()
-
isMappedKeyMapPolicy
public boolean isMappedKeyMapPolicy()
-
isMapKeyObject
public boolean isMapKeyObject()
INTERNAL: Return if the map key this container policy represents is a OneToOne.
-
isValidContainer
public boolean isValidContainer(java.lang.Object container)
INTERNAL: Return whether the specified object is of a valid container type.
-
isValidContainerType
public boolean isValidContainerType(java.lang.Class containerType)
INTERNAL: Return whether the specified type is a valid container type.
-
iterateOnMapKey
public void iterateOnMapKey(DescriptorIterator iterator, java.lang.Object element)
INTERNAL: Used in Descriptor Iteration to iterate on map keys. This method is a no-op here, but will be overridden by subclasses
-
iteratorFor
public abstract java.lang.Object iteratorFor(java.lang.Object container)
INTERNAL: Return an iterator for the given container. This iterator can then be used as a parameter to #hasNext() and #next().- Specified by:
iteratorFor
in interfaceCoreContainerPolicy<AbstractSession>
- See Also:
hasNext(java.lang.Object)
,next(java.lang.Object)
-
keyFrom
public java.lang.Object keyFrom(java.lang.Object element, AbstractSession session)
INTERNAL: Return the key for the specified element..
-
keyFromEntry
public java.lang.Object keyFromEntry(java.lang.Object entry)
Get the key from the passed in Map.Entry This method will be overridden by ContainerPolicies that allows maps.
-
keyFromIterator
public java.lang.Object keyFromIterator(java.lang.Object iterator)
-
mergeCascadeParts
public java.lang.Object mergeCascadeParts(ObjectChangeSet objectChanges, MergeManager mergeManager, AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object. Because this is a collection mapping, values are added to or removed from the collection based on the change set.
-
mergeChanges
public void mergeChanges(CollectionChangeRecord changeRecord, java.lang.Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession, boolean isSynchronizeOnMerge)
INTERNAL: Merge changes from the source to the target object. Because this is a collection mapping, values are added to or removed from the collection based on the change set. Synchronize if system property is specified. If not, default to clone the target collection. No need to synchronize if the collection is new.
-
mergeChanges
protected void mergeChanges(CollectionChangeRecord changeRecord, java.lang.Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object. Because this is a collection mapping, values are added to or removed from the collection based on the change set.
-
next
protected abstract java.lang.Object next(java.lang.Object iterator)
INTERNAL: Return the next object on the queue. The iterator is the one returned from #iteratorFor(). Valid for some subclasses only.- See Also:
iteratorFor(java.lang.Object)
-
next
public java.lang.Object next(java.lang.Object iterator, AbstractSession session)
INTERNAL: Return the next object from the iterator. This is used to stream over a collection independent of JDK 1.1 and 1.2. The session may be required to unwrap for the wrapper policy.- Specified by:
next
in interfaceCoreContainerPolicy<AbstractSession>
-
nextEntry
public java.lang.Object nextEntry(java.lang.Object iterator)
INTERNAL: Return the next object on the queue. The iterator is the one returned from #iteratorFor(). In the case of a Map, this will return a MapEntry to allow use of the key- Specified by:
nextEntry
in interfaceCoreContainerPolicy<AbstractSession>
- See Also:
iteratorFor(java.lang.Object)
-
nextEntry
public java.lang.Object nextEntry(java.lang.Object iterator, AbstractSession session)
INTERNAL: Return the next object on the queue. The iterator is the one returned from #iteratorFor(). In the case of a Map, this will return a MapEntry to allow use of the key- Specified by:
nextEntry
in interfaceCoreContainerPolicy<AbstractSession>
- See Also:
ContainerPolicy#iteratorFor(Object iterator, AbstractSession session)
-
overridesRead
public boolean overridesRead()
This can be used by collection such as cursored stream to gain control over execution.
-
postInitialize
public void postInitialize(AbstractSession session)
INTERNAL: Some subclasses need to post initialize mappings associated with them
-
postCalculateChanges
public void postCalculateChanges(ObjectChangeSet ocs, ClassDescriptor referenceDescriptor, DatabaseMapping mapping, UnitOfWorkImpl uow)
INTERNAL: Add the provided object to the deleted objects list on the commit manager. This may be overridden by subclasses to process a composite object- Parameters:
object
-manager
-- See Also:
MappedKeyMapContainerPolicy
-
postCalculateChanges
public void postCalculateChanges(java.lang.Object key, java.lang.Object value, ClassDescriptor referenceDescriptor, DatabaseMapping mapping, UnitOfWorkImpl uow)
INTERNAL: Add the provided object to the deleted objects list on the commit manager. This may be overridden by subclasses to process a composite object.
-
recordPrivateOwnedRemovals
public void recordPrivateOwnedRemovals(java.lang.Object object, ClassDescriptor referenceDescriptor, UnitOfWorkImpl uow)
INTERNAL: Add the provided object to the deleted objects list on the commit manager. This may be overridden by subclasses to process a composite object.
-
prepare
public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException
Prepare and validate. Allow subclasses to override.- Throws:
QueryException
-
prepareForExecution
public void prepareForExecution() throws QueryException
Prepare and validate. Allow subclasses to override.- Throws:
QueryException
-
processAdditionalWritableMapKeyFields
public void processAdditionalWritableMapKeyFields(AbstractSession session)
INTERNAL: This method is used to check the key mapping to ensure that it does not write to a field that is written by another mapping. This method will be overridden by subclasses that deal MapKeys
-
propogatePostDelete
public void propogatePostDelete(DeleteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeys
-
propogatePostInsert
public void propogatePostInsert(WriteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeys
-
propogatePostUpdate
public void propogatePostUpdate(WriteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeys
-
propogatePreDelete
public void propogatePreDelete(DeleteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeys
-
propogatePreInsert
public void propogatePreInsert(WriteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeys
-
propogatePreUpdate
public void propogatePreUpdate(WriteObjectQuery query, java.lang.Object object)
INTERNAL: Propagate the postDeleteEvent to any additional objects the query is aware of This method will be overridden by subclasses that deal MapKeys
-
propagatesEventsToCollection
public boolean propagatesEventsToCollection()
INTERNAL: Returns false. Most container policies do not need to propagate events within the collections This will be overridden by subclasses
-
recordAddToCollectionInChangeRecord
public void recordAddToCollectionInChangeRecord(ObjectChangeSet changeSetToAdd, CollectionChangeRecord collectionChangeRecord)
This method is used to bridge the behavior between Attribute Change Tracking and deferred change tracking with respect to adding the same instance multiple times. Each ContainerPolicy type will implement specific behavior for the collection type it is wrapping. These methods are only valid for collections containing object references
-
recordRemoveFromCollectionInChangeRecord
public void recordRemoveFromCollectionInChangeRecord(ObjectChangeSet changeSetToRemove, CollectionChangeRecord collectionChangeRecord)
This method is used to bridge the behavior between Attribute Change Tracking and deferred change tracking with respect to adding the same instance multiple times. Each ContainerPolicy type will implement specific behavior for the collection type it is wrapping. These methods are only valid for collections containing object references
-
recordUpdateToCollectionInChangeRecord
public void recordUpdateToCollectionInChangeRecord(CollectionChangeEvent event, ObjectChangeSet changeSet, CollectionChangeRecord collectionChangeRecord)
This method is used to bridge the behavior between Attribute Change Tracking and deferred change tracking with respect to adding the same instance multiple times. Each ContainerPolicy type will implement specific behavior for the collection type it is wrapping. These methods are only valid for collections containing object references
-
remoteExecute
public java.lang.Object remoteExecute()
This can be used by collection such as cursored stream to gain control over execution.
-
removeFrom
protected boolean removeFrom(java.lang.Object key, java.lang.Object element, java.lang.Object container)
INTERNAL: Remove element from container. Valid for some subclasses only.
-
removeFrom
public boolean removeFrom(java.lang.Object key, java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Remove the object from the collection. This is used to remove from a collection independent of JDK 1.1 and 1.2. The session may be required to unwrap for the wrapper policy.
-
removeFrom
public boolean removeFrom(java.lang.Object element, java.lang.Object container, AbstractSession session)
INTERNAL: Remove the object from the collection. This is used to remove from a collection independent of JDK 1.1 and 1.2. The session may be required to unwrap for the wrapper policy.- Specified by:
removeFrom
in interfaceCoreContainerPolicy<AbstractSession>
-
requiresDataModificationEvents
public boolean requiresDataModificationEvents()
INTERNAL: Returns whether this ContainerPolicy should requires data modification events when objects are added or deleted during update- Returns:
-
setConstructor
protected void setConstructor(java.lang.reflect.Constructor constructor)
INTERNAL: Set the size constructor if available.
-
setContainerClass
public void setContainerClass(java.lang.Class containerClass)
INTERNAL: Set the class used for the container.- Specified by:
setContainerClass
in interfaceCoreContainerPolicy<AbstractSession>
-
setContainerClassName
public void setContainerClassName(java.lang.String containerClassName)
INTERNAL: Used by the MW
-
setElementDescriptor
public void setElementDescriptor(ClassDescriptor elementDescriptor)
INTERNAL: Used for wrapping and unwrapping with the wrapper policy.
-
setKeyName
public void setKeyName(java.lang.String instanceVariableName, java.lang.String elementClassName)
INTERNAL: It is illegal to send this message to this receiver. Try one of my subclasses. Throws an exception.- See Also:
MapContainerPolicy
-
setKeyName
public void setKeyName(java.lang.String instanceVariableName, java.lang.Class elementClass)
INTERNAL: Sets the key name to be used to generate the key in a Map type container class. The key name, may be the name of a field or method. An instance of the class is provided in the case when the descriptor is being built in code.
-
shouldAddAll
public boolean shouldAddAll()
INTERNAL: Indicates whether addAll method should be called to add entire collection, or it's possible to call addInto multiple times instead.- Returns:
-
shouldIncludeKeyInDeleteEvent
public boolean shouldIncludeKeyInDeleteEvent()
INTERNAL: Return whether data for a map key must be included on a Delete data modification event This will be overridden by subclasses that handle maps.
-
shouldUpdateForeignKeysPostInsert
public boolean shouldUpdateForeignKeysPostInsert()
INTERNAL: Certain types of container policies require an extra update statement after a relationship is inserted. Return whether this update statement is required.
-
sizeFor
public int sizeFor(java.lang.Object container)
INTERNAL: Return the size of container.- Specified by:
sizeFor
in interfaceCoreContainerPolicy<AbstractSession>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toStringInfo
protected java.lang.Object toStringInfo()
-
updateJoinedMappingIndexesForMapKey
public int updateJoinedMappingIndexesForMapKey(java.util.Map<DatabaseMapping,java.lang.Object> indexList, int index)
INTERNAL: Update the joined mapping indices This method is a no-op, but will be overridden by subclasses
-
updateChangeRecordForSelfMerge
public void updateChangeRecordForSelfMerge(ChangeRecord changeRecord, java.lang.Object source, java.lang.Object target, ForeignReferenceMapping mapping, UnitOfWorkChangeSet parentUOWChangeSet, UnitOfWorkImpl unitOfWork)
INTERNAL: Update a ChangeRecord to replace the ChangeSet for the old entity with the changeSet for the new Entity. This is used when an Entity is merged into itself and the Entity reference new or detached entities.
-
unwrapElement
public java.lang.Object unwrapElement(java.lang.Object object)
INTERNAL: MapContainerPolicy's iterator iterates on the Entries of a Map. This method returns the object from the iterator
-
unwrapIteratorResult
public java.lang.Object unwrapIteratorResult(java.lang.Object object)
INTERNAL: Depending on the container, the entries returned of iteration using the ContainerPolicy.iteratorFor() method may be wrapped. This method unwraps the values.
-
valueFromPKList
public java.lang.Object valueFromPKList(java.lang.Object[] pks, AbstractRecord foreignKeys, ForeignReferenceMapping mapping, AbstractSession session)
INTERNAL: This method is used to load a relationship from a list of PKs. This list may be available if the relationship has been cached.
-
vectorFor
public java.util.Vector vectorFor(java.lang.Object container, AbstractSession session)
INTERNAL: Return a Vector populated with the contents of container. Added for bug 2766379, must implement a version of vectorFor that handles wrapped objects.- Specified by:
vectorFor
in interfaceCoreContainerPolicy<AbstractSession>
-
copyMapDataToRow
public static void copyMapDataToRow(java.util.Map mappingData, AbstractRecord databaseRow)
INTERNAL: convenience method to copy the keys and values from a Map into an AbstractRecord- Parameters:
mappingData
- a Map containing a database field as the key and the value of that field as the valuedatabaseRow
-
-
-