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.
| Modifier and Type | Field and Description |
|---|---|
| protected transient Constructor | |
| protected static Class | defaultContainerClass
Allow the default collection class to be set. |
| protected transient ClassDescriptor | elementDescriptor
The descriptor is used to wrap and unwrap objects using the wrapper policy. |
| private static final long |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| 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. |
| public boolean | addAll(List<E> elements, Object container, AbstractSession session, 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. |
| public boolean | addAll(List<E> elements, Object container, AbstractSession session, 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. |
| 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 |
| public boolean | addInto(Object element, Object container, AbstractSession session)
Implements org. |
| public boolean | addInto(Object element, Object container, AbstractSession session, AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, boolean isTargetProtected)
INTERNAL: Add element to container. |
| public boolean | addInto(Object element, 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. |
| public boolean | addInto(Object key, Object element, Object container, AbstractSession session)
Implements org. |
| public void | addNestedJoinsQueriesForMapKey(JoinedAttributeManager joinManager, ObjectLevelReadQuery query, AbstractSession session)
INTERNAL: Used for joining. |
| public void | addNextValueFromIteratorInto(Object valuesIterator, Object parent, CacheKey parentCacheKey, Object toCollection, CollectionMapping mapping, 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. |
| public void | buildChangeSetForNewObjectInCollection(Object object, ClassDescriptor referenceDescriptor, UnitOfWorkChangeSet uowChangeSet, AbstractSession session)
|
| public Object | buildCloneForKey(Object key, Object parent, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isCacheCheckComplete)
Build a clone for the key of a Map represented by this container policy if necessary. |
| public Object | buildCollectionEntry(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 |
| public Object | buildContainerFromVector(Vector<E> vector, AbstractSession session)
INTERNAL: Return a container populated with the contents of the specified Vector. |
| public static ContainerPolicy | buildDefaultPolicy()
INTERNAL: Return the appropriate container policy for the default container class. |
| public 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 |
| public 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 |
| public static ContainerPolicy | buildPolicyFor(Class<?> concreteContainerClass)
INTERNAL: Return the appropriate container policy for the specified concrete container class. |
| public static ContainerPolicy | buildPolicyFor(Class<?> concreteContainerClass, boolean hasOrdering)
INTERNAL: Return the appropriate container policy for the specified concrete container class. |
| public Object[] | buildReferencesPKList(Object container, AbstractSession session)
INTERNAL: This method will access the target relationship and create a list of information to rebuild the collection. |
| public ReadQuery | buildSelectionQueryForDirectCollectionMapping()
INTERNAL: This Certain key mappings favor different types of selection query. |
| public void | cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map<K, V> newObjects, Map<K, V> unregisteredExistingObjects, Map<K, V> visitedObjects, UnitOfWorkImpl uow, Set<E> cascadeErrors)
INTERNAL: Cascade DiscoverAndPersistUnregisteredNewObjects to any mappings managed by the container policy. |
| public void | cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, Map<K, V> visitedObjects)
INTERNAL: Cascade performRemove to any mappings managed by the container policy. |
| public void | cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, Map<K, V> visitedObjects)
INTERNAL: Cascade registerNew to any mappings managed by the container policy. |
| public void | clear(Object container)
Implements org. |
| public Object | |
| public ContainerPolicy | |
| public Object | |
| protected void | collectObjectForNewCollection(Map<K, V> originalKeyValues, Map<K, V> cloneKeyValues, 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 |
| public void | compareCollectionsForChange(Object oldCollection, Object newCollection, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor)
INTERNAL: This method is used to calculate the differences between two collections. |
| public boolean | compareKeys(Object sourceKey, AbstractSession session)
INTERNAL: Return true if keys are the same in the source as the backup. |
| public Object | concatenateContainers(Object firstContainer, Object secondContainer, AbstractSession session)
INTERNAL: Build a new container, add the contents of each of the specified containers to it, and return it. |
| public Object | containerInstance()
Implements org. |
| public Object | containerInstance(int initialCapacity)
Implements org. |
| protected boolean | |
| public boolean | contains(Object element, Object container, AbstractSession session)
Implements org. |
| public void | convertClassNamesToClasses(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. |
| public static void | copyMapDataToRow(Map<K, V>
a Map containing a database field as the key and the value of that field as the value mappingData, AbstractRecord databaseRow)INTERNAL: convenience method to copy the keys and values from a Map into an AbstractRecord |
| public abstract CollectionChangeEvent | |
| protected void | createChangeSetForKeys(Map<K, V> originalKeyValues, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor)
INTERNAL: Create change sets that contain map keys. |
| public Object | createWrappedObjectFromExistingWrappedObject(Object wrappedObject, Object
if this is an aggregate, the owner of the aggregate parent, ClassDescriptor referenceDescriptor, MergeManager mergeManager, AbstractSession targetSession)INTERNAL: This method will actually potentially wrap an object in two ways. |
| public void | deleteWrappedObject(Object objectDeleted, AbstractSession session)
INTERNAL: Delete the passed object This may be overridden by subclasses to deal with composite objects |
| public boolean | equals(Object
the reference object with which to compare. object)Overrides java. |
| public Object | execute()
INTERNAL: This can be used by collection such as cursored stream to gain control over execution. |
| public List | getAdditionalFieldsForJoin(CollectionMapping baseMapping)
INTERNAL: Return any additional fields required by the policy for a fetch join. |
| public List | getAdditionalTablesForJoinQuery()
INTERNAL: Return any tables that will be required when this mapping is used as part of a join query. |
| public Iterator | getChangeValuesFrom(Map<K, V> map)
INTERNAL: Used to create an iterator on a the Map object passed to CollectionChangeRecord.addRemoveChange() to access the values to be removed. |
| public Object | getCloneDataFromChangeSet(ObjectChangeSet changeSet)
INTERNAL: Used when objects are added or removed during an update. |
| protected Constructor | |
| public Class | |
| public String | |
| public static Class | |
| public ClassDescriptor | |
| public ClassDescriptor | |
| public List | 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. |
| public Map | getKeyMappingDataForWriteQuery(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. |
| public Expression | getKeySelectionCriteria()
INTERNAL: Get the selection criteria for the map key This will be overridden by container policies that allow maps |
| public Object | getKeyType()
INTERNAL: Return the type of the map key, this will be overridden by container policies that allow maps. |
| public boolean | |
| public int | |
| public abstract boolean | hasNext(Object iterator)
Redeclares org. |
| public boolean | |
| public void | initialize(AbstractSession session, DatabaseTable keyTable)
INTERNAL: Provide a hook to allow initialization of Container Policy parts |
| public void | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isEmpty(Object container)
Implements org. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isValidContainer(Object container)
INTERNAL: Return whether the specified object is of a valid container type. |
| public boolean | isValidContainerType(Class<?> containerType)
INTERNAL: Return whether the specified type is a valid container type. |
| public void | iterateOnMapKey(DescriptorIterator iterator, Object element)
INTERNAL: Used in Descriptor Iteration to iterate on map keys. |
| public abstract Object | iteratorFor(Object container)
Redeclares org. |
| public Object | keyFrom(Object element, AbstractSession session)
INTERNAL: Return the key for the specified element.. |
| public Object | keyFromEntry(Object entry)
Get the key from the passed in Map.Entry This method will be overridden by ContainerPolicies that allows maps. |
| public Object | |
| public Object | mergeCascadeParts(ObjectChangeSet objectChanges, MergeManager mergeManager, AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object. |
| public void | mergeChanges(CollectionChangeRecord changeRecord, Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession, boolean isSynchronizeOnMerge)
INTERNAL: Merge changes from the source to the target object. |
| protected void | mergeChanges(CollectionChangeRecord changeRecord, Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object. |
| protected abstract Object | |
| public Object | next(Object iterator, AbstractSession session)
Implements org. |
| public Object | nextEntry(Object iterator)
Implements org. |
| public Object | nextEntry(Object iterator, AbstractSession session)
Implements org. |
| public boolean | overridesRead()
This can be used by collection such as cursored stream to gain control over execution. |
| 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. |
| public void | postCalculateChanges(Object key, Object value, ClassDescriptor referenceDescriptor, DatabaseMapping mapping, UnitOfWorkImpl uow)
INTERNAL: Add the provided object to the deleted objects list on the commit manager. |
| public void | postInitialize(AbstractSession session)
INTERNAL: Some subclasses need to post initialize mappings associated with them |
| public void | |
| public void | |
| 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. |
| public boolean | |
| public void | propogatePostDelete(DeleteObjectQuery query, 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 |
| public void | propogatePostInsert(WriteObjectQuery query, 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 |
| public void | propogatePostUpdate(WriteObjectQuery query, 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 |
| public void | propogatePreDelete(DeleteObjectQuery query, 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 |
| public void | propogatePreInsert(WriteObjectQuery query, 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 |
| public void | propogatePreUpdate(WriteObjectQuery query, 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 |
| 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. |
| public void | recordPrivateOwnedRemovals(Object object, ClassDescriptor referenceDescriptor, UnitOfWorkImpl uow)
INTERNAL: Add the provided object to the deleted objects list on the commit manager. |
| 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. |
| 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. |
| public Object | remoteExecute()
This can be used by collection such as cursored stream to gain control over execution. |
| protected boolean | removeFrom(Object key, Object element, Object container)
Implements org. |
| public boolean | removeFrom(Object key, Object element, Object container, AbstractSession session)
INTERNAL: Remove the object from the collection. |
| public boolean | removeFrom(Object element, Object container, AbstractSession session)
Implements org. |
| public boolean | requiresDataModificationEvents()
INTERNAL: Returns whether this ContainerPolicy should requires data modification events when objects are added or deleted during update |
| protected void | |
| public void | setContainerClass(Class<?> containerClass)
Implements org. |
| public void | |
| public static void | setDefaultContainerClass(Class<? extends Collection<E>> collectionClass)
ADVANCED: Allow the default collection class to be set. |
| public void | setElementDescriptor(ClassDescriptor elementDescriptor)
INTERNAL: Used for wrapping and unwrapping with the wrapper policy. |
| public void | setKeyName(String instanceVariableName, String elementClassName)
INTERNAL: It is illegal to send this message to this receiver. |
| public void | setKeyName(String instanceVariableName, Class<?> elementClass)
INTERNAL: Sets the key name to be used to generate the key in a Map type container class. |
| 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. |
| 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. |
| public boolean | shouldUpdateForeignKeysPostInsert()
INTERNAL: Certain types of container policies require an extra update statement after a relationship is inserted. |
| public int | sizeFor(Object container)
Implements org. |
| public String | |
| protected Object | |
| public Object | unwrapElement(Object object)
INTERNAL: MapContainerPolicy's iterator iterates on the Entries of a Map. |
| public Object | unwrapIteratorResult(Object object)
INTERNAL: Depending on the container, the entries returned of iteration using the ContainerPolicy.iteratorFor() method may be wrapped. |
| public void | updateChangeRecordForSelfMerge(ChangeRecord changeRecord, Object source, 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. |
| public int | updateJoinedMappingIndexesForMapKey(Map<DatabaseMapping, Object> indexList, int index)
INTERNAL: Update the joined mapping indices This method is a no-op, but will be overridden by subclasses |
| public Object | valueFromPKList(Object[] pks, AbstractRecord foreignKeys, ForeignReferenceMapping mapping, AbstractSession session)
INTERNAL: This method is used to load a relationship from a list of PKs. |
| public Vector | vectorFor(Object container, AbstractSession session)
Implements org. |