public class MappedKeyMapContainerPolicy extends MapContainerPolicy implements CoreMappedKeyMapContainerPolicy<AbstractSession>
MapContainerPolicy,
MapKeyMapping,
MapComponentMapping,
Serialized FormMapContainerPolicy.MapContainerPolicyIterator| Modifier and Type | Field and Description |
|---|---|
DatabaseQuery |
keyQuery |
| Constructor and Description |
|---|
MappedKeyMapContainerPolicy()
INTERNAL:
Construct a new policy.
|
MappedKeyMapContainerPolicy(java.lang.Class containerClass)
INTERNAL:
Construct a new policy for the specified class.
|
MappedKeyMapContainerPolicy(java.lang.String containerClassName)
INTERNAL:
Construct a new policy for the specified class name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAdditionalFieldsToQuery(ReadQuery selectionQuery,
Expression baseExpression)
INTERNAL:
Called when the selection query is being initialize to add the fields for the key to the query
|
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
|
boolean |
addInto(java.lang.Object element,
java.lang.Object container,
AbstractSession session)
INTERNAL:
Add element into container which implements the Map interface.
|
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 ordered List containers to add all of the elements
to the collection in the order of the index field in the row.
|
boolean |
addInto(java.lang.Object element,
java.lang.Object container,
AbstractSession session,
AbstractRecord dbRow,
ObjectBuildingQuery query,
CacheKey parentCacheKey,
boolean isTargetProtected)
INTERNAL:
Add element to that implements the Map interface
use the row to compute the key
|
void |
addNestedJoinsQueriesForMapKey(JoinedAttributeManager joinManager,
ObjectLevelReadQuery query,
AbstractSession session)
INTERNAL:
Used for joining.
|
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.
|
java.lang.Object |
buildKey(AbstractRecord row,
ObjectBuildingQuery query,
CacheKey parentCacheKey,
AbstractSession session,
boolean isTargetProtected)
Extract the key for the map from the provided row.
|
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.
|
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:
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 discover and persist new objects during commit to the map key
|
void |
cascadePerformRemoveIfRequired(java.lang.Object object,
UnitOfWorkImpl uow,
java.util.Map visitedObjects)
INTERNAL:
Cascade registerNew 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.
|
java.lang.Object |
clone()
INTERNAL:
The mapping clones itself to create deep copy.
|
boolean |
compareContainers(java.lang.Object firstObjectMap,
java.lang.Object secondObjectMap)
INTERNAL:
Return true if keys are the same.
|
boolean |
compareKeys(java.lang.Object sourceValue,
AbstractSession session)
INTERNAL:
Return true if keys are the same in the source as the backup.
|
void |
convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL:
Convert all the class-name-based settings in this ContainerPolicy to actual class-based
settings
|
QueryKey |
createQueryKeyForMapKey()
INTERNAL:
Create a query key that links to the map key.
|
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 key and value of the passed association passed object.
|
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.lang.Object |
getCloneDataFromChangeSet(ObjectChangeSet changeSet)
INTERNAL:
Used when objects are added or removed during an update.
|
ClassDescriptor |
getDescriptorForMapKey()
INTERNAL:
Return the reference descriptor for the map key if it exists.
|
DatabaseField |
getDirectKeyField(CollectionMapping baseMapping)
INTERNAL:
Return the DatabaseField that represents the key in a DirectMapMapping.
|
java.util.Map<DatabaseField,DatabaseField> |
getForeignKeyFieldsForMapKey()
INTERNAL:
Return a Map of any foreign keys defined within the the MapKey.
|
java.util.List<DatabaseField> |
getIdentityFieldsForMapKey()
INTERNAL:
Return the fields that make up the identity of the mapped object.
|
Converter |
getKeyConverter()
INTERNAL:
Get the Converter for the key of this mapping if one exists.
|
MapKeyMapping |
getKeyMapping() |
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.
|
DatabaseQuery |
getKeyQuery()
INTERNAL:
Some map keys must be obtained from the database.
|
Expression |
getKeySelectionCriteria()
INTERNAL:
Get the selection criteria for the map key.
|
java.lang.Object |
getKeyType()
INTERNAL:
Return the type of the map key, this will be overridden by container policies that allow maps.
|
MapComponentMapping |
getValueMapping() |
void |
initialize(AbstractSession session,
DatabaseTable keyTable)
INTERNAL:
Initialize the key mapping
|
boolean |
isMapKeyAttribute()
INTERNAL:
Return whether a map key this container policy represents is an attribute
By default this method will return false since only subclasses actually represent maps.
|
boolean |
isMapKeyObject()
INTERNAL:
Return if the map key this container policy represents is a OneToOne.
|
boolean |
isMappedKeyMapPolicy() |
void |
iterateOnMapKey(DescriptorIterator iterator,
java.lang.Object element)
INTERNAL:
Used in Descriptor Iteration to iterate on map keys.
|
java.lang.Object |
keyFrom(java.lang.Object element,
AbstractSession session)
INTERNAL:
Return the key for the specified element.
|
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 |
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 |
postInitialize(AbstractSession session)
INTERNAL:
Some subclasses need to post initialize mappings associated with them.
|
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 true if the key mapping is an AggregateObjectMapping.
|
void |
propogatePostDelete(DeleteObjectQuery query,
java.lang.Object object)
INTERNAL:
Propagate the postDeleteEvent to any additional objects the query is aware of
|
void |
propogatePostInsert(WriteObjectQuery query,
java.lang.Object object)
INTERNAL:
Propagate the postDeleteEvent to any additional objects the query is aware of
|
void |
propogatePostUpdate(WriteObjectQuery query,
java.lang.Object object)
INTERNAL:
Propagate the postDeleteEvent to any additional objects the query is aware of
|
void |
propogatePreDelete(DeleteObjectQuery query,
java.lang.Object object)
INTERNAL:
Propagate the postDeleteEvent to any additional objects the query is aware of
|
void |
propogatePreInsert(WriteObjectQuery query,
java.lang.Object object)
INTERNAL:
Propagate the postDeleteEvent to any additional objects the query is aware of
|
void |
propogatePreUpdate(WriteObjectQuery query,
java.lang.Object object)
INTERNAL:
Propagate the postDeleteEvent to any additional objects the query is aware of
|
void |
recordPrivateOwnedRemovals(java.lang.Object object,
ClassDescriptor referenceDescriptor,
UnitOfWorkImpl uow)
INTERNAL:
Add the key and value from provided association to the deleted objects list on the commit manager.
|
boolean |
requiresDataModificationEvents()
INTERNAL:
Returns whether this ContainerPolicy requires data modification events when
objects are added or deleted during update.
|
void |
setDescriptorForKeyMapping(ClassDescriptor descriptor)
INTERNAL:
Used during initialization of DirectMapMapping.
|
void |
setKeyConverter(Converter keyConverter,
DirectMapMapping mapping)
INTERNAL:
Set a converter on the KeyField of a DirectCollectionMapping.
|
void |
setKeyConverterClassName(java.lang.String keyConverterClassName,
DirectMapMapping mapping)
INTERNAL:
Set the name of the class to be used as a converter for the key of a DirectMapMaping.
|
void |
setKeyField(DatabaseField keyField,
ClassDescriptor descriptor)
INTERNAL:
Set the DatabaseField that will represent the key in a DirectMapMapping.
|
void |
setKeyMapping(MapKeyMapping mapping) |
void |
setKeyQuery(DatabaseQuery keyQuery)
INTERNAL:
Some map keys must be obtained from the database.
|
void |
setValueMapping(MapComponentMapping mapping) |
boolean |
shouldIncludeKeyInDeleteEvent()
INTERNAL:
Return whether data for a map key must be included on a Delete datamodification event
If the keyMapping is privateOwned, that data should be.
|
boolean |
shouldUpdateForeignKeysPostInsert()
INTERNAL:
Certain types of container policies require an extra update statement after a relationship
is inserted.
|
java.lang.Object |
unwrapKey(java.lang.Object key,
AbstractSession session)
INTERNAL:
Allow the key to be unwrapped.
|
int |
updateJoinedMappingIndexesForMapKey(java.util.Map<DatabaseMapping,java.lang.Object> indexList,
int index)
INTERNAL:
Update the joined mapping indices
Adds the key mapping and it's index to the list of joined mappings.
|
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.
|
addInto, addNextValueFromIteratorInto, buildChangeSetForNewObjectInCollection, buildCollectionEntry, clear, cloneFor, concatenateContainers, createChangeEvent, getElementClass, getElementClassName, getInterfaceType, getKeyName, hasNext, isMapPolicy, isValidContainer, iteratorFor, keyFromEntry, keyFromIterator, nextEntry, nextEntry, prepare, recordUpdateToCollectionInChangeRecord, removeFrom, setElementClass, setKeyMethod, setKeyMethod, setKeyMethodName, setKeyName, setKeyName, setKeyName, sizeFor, unwrapElement, unwrapIteratorResultbuildContainerFromVector, equals, getCloneMethod, getContainerClass, getContainerClassName, isValidContainerType, setCloneMethod, setContainerClass, setContainerClassNameaddAll, addAll, buildDefaultPolicy, buildPolicyFor, buildPolicyFor, clone, compareCollectionsForChange, containerInstance, containerInstance, contains, copyMapDataToRow, execute, getChangeValuesFrom, getDefaultContainerClass, getElementDescriptor, hasElementDescriptor, hasOrder, initializeConstructor, isCollectionPolicy, isCursoredStreamPolicy, isCursorPolicy, isDirectMapPolicy, isEmpty, isListPolicy, isOrderedListPolicy, isScrollableCursorPolicy, mergeCascadeParts, mergeChanges, next, overridesRead, prepareForExecution, recordAddToCollectionInChangeRecord, recordRemoveFromCollectionInChangeRecord, remoteExecute, removeFrom, setDefaultContainerClass, setElementDescriptor, shouldAddAll, toString, updateChangeRecordForSelfMerge, vectorForgetClass, hashCode, notify, notifyAll, wait, wait, waitaddInto, clear, containerInstance, containerInstance, contains, hasNext, isEmpty, isListPolicy, iteratorFor, next, nextEntry, nextEntry, removeFrom, setContainerClass, sizeFor, vectorForpublic DatabaseQuery keyQuery
public MappedKeyMapContainerPolicy()
public MappedKeyMapContainerPolicy(java.lang.Class containerClass)
public MappedKeyMapContainerPolicy(java.lang.String containerClassName)
public void addAdditionalFieldsToQuery(ReadQuery selectionQuery, Expression baseExpression)
addAdditionalFieldsToQuery in class ContainerPolicyMappedKeyMapContinerPolicypublic java.util.Map getKeyMappingDataForWriteQuery(java.lang.Object object,
AbstractSession session)
getKeyMappingDataForWriteQuery in class ContainerPolicypublic java.lang.Object getKeyType()
getKeyType in class MapContainerPolicypublic void addFieldsForMapKey(AbstractRecord joinRow)
addFieldsForMapKey in class ContainerPolicyMappedKeyMapContainerPolicypublic boolean addInto(java.lang.Object element,
java.lang.Object container,
AbstractSession session)
addInto in interface CoreContainerPolicy<AbstractSession>addInto in class MapContainerPolicypublic boolean addInto(java.lang.Object element,
java.lang.Object container,
AbstractSession session,
AbstractRecord row,
DataReadQuery query,
CacheKey parentCacheKey,
boolean isTargetProtected)
addInto in class ContainerPolicypublic boolean addInto(java.lang.Object element,
java.lang.Object container,
AbstractSession session,
AbstractRecord dbRow,
ObjectBuildingQuery query,
CacheKey parentCacheKey,
boolean isTargetProtected)
addInto in class ContainerPolicypublic void addNestedJoinsQueriesForMapKey(JoinedAttributeManager joinManager, ObjectLevelReadQuery query, AbstractSession session)
addNestedJoinsQueriesForMapKey in class ContainerPolicypublic java.lang.Object buildCloneForKey(java.lang.Object key,
java.lang.Object parent,
CacheKey parentCacheKey,
java.lang.Integer refreshCascade,
AbstractSession cloningSession,
boolean isExisting,
boolean isCacheCheckComplete)
buildCloneForKey in class ContainerPolicypublic ReadQuery buildSelectionQueryForDirectCollectionMapping()
buildSelectionQueryForDirectCollectionMapping in class ContainerPolicypublic java.lang.Object buildKey(AbstractRecord row, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)
buildKey in class ContainerPolicypublic java.lang.Object buildKeyFromJoinedRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)
buildKeyFromJoinedRow in class ContainerPolicypublic java.lang.Object[] buildReferencesPKList(java.lang.Object container,
AbstractSession session)
buildReferencesPKList in class MapContainerPolicyObjectReferenceMapping.buildReferencesPKList,
ContainerPolicy.buildReferencesPKListpublic void cascadeDiscoverAndPersistUnregisteredNewObjects(java.lang.Object object,
java.util.Map newObjects,
java.util.Map unregisteredExistingObjects,
java.util.Map visitedObjects,
UnitOfWorkImpl uow,
java.util.Set cascadeErrors)
cascadeDiscoverAndPersistUnregisteredNewObjects in class ContainerPolicypublic void cascadePerformRemoveIfRequired(java.lang.Object object,
UnitOfWorkImpl uow,
java.util.Map visitedObjects)
cascadePerformRemoveIfRequired in class ContainerPolicypublic void cascadeRegisterNewIfRequired(java.lang.Object object,
UnitOfWorkImpl uow,
java.util.Map visitedObjects)
cascadeRegisterNewIfRequired in class ContainerPolicypublic java.lang.Object clone()
clone in class ContainerPolicypublic boolean compareContainers(java.lang.Object firstObjectMap,
java.lang.Object secondObjectMap)
public boolean compareKeys(java.lang.Object sourceValue,
AbstractSession session)
compareKeys in class MapContainerPolicypublic QueryKey createQueryKeyForMapKey()
createQueryKeyForMapKey in class MapContainerPolicypublic java.lang.Object createWrappedObjectFromExistingWrappedObject(java.lang.Object wrappedObject,
java.lang.Object parent,
ClassDescriptor referenceDescriptor,
MergeManager mergeManager,
AbstractSession targetSession)
createWrappedObjectFromExistingWrappedObject in class MapContainerPolicyparent - if this is an aggregate, the owner of the aggregateMappedKeyMapContainerPolicypublic void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
convertClassNamesToClasses in class MapContainerPolicyclassLoader - public void deleteWrappedObject(java.lang.Object objectDeleted,
AbstractSession session)
deleteWrappedObject in class ContainerPolicyMappedKeyMapContainerPolicypublic java.util.List<DatabaseTable> getAdditionalTablesForJoinQuery()
getAdditionalTablesForJoinQuery in class ContainerPolicypublic java.util.List<DatabaseField> getAdditionalFieldsForJoin(CollectionMapping baseMapping)
getAdditionalFieldsForJoin in class ContainerPolicypublic java.util.Map<DatabaseField,DatabaseField> getForeignKeyFieldsForMapKey()
public ClassDescriptor getDescriptorForMapKey()
getDescriptorForMapKey in class ContainerPolicypublic java.lang.Object getCloneDataFromChangeSet(ObjectChangeSet changeSet)
getCloneDataFromChangeSet in class ContainerPolicypublic DatabaseField getDirectKeyField(CollectionMapping baseMapping)
getDirectKeyField in class MapContainerPolicypublic java.util.List<DatabaseField> getIdentityFieldsForMapKey()
getIdentityFieldsForMapKey in class ContainerPolicypublic Converter getKeyConverter()
public MapKeyMapping getKeyMapping()
public DatabaseQuery getKeyQuery()
public Expression getKeySelectionCriteria()
getKeySelectionCriteria in class ContainerPolicypublic MapComponentMapping getValueMapping()
public void initialize(AbstractSession session, DatabaseTable keyTable)
initialize in class ContainerPolicypublic boolean isMappedKeyMapPolicy()
isMappedKeyMapPolicy in class ContainerPolicypublic boolean isMapKeyAttribute()
isMapKeyAttribute in class MapContainerPolicypublic boolean isMapKeyObject()
isMapKeyObject in class ContainerPolicypublic void iterateOnMapKey(DescriptorIterator iterator, java.lang.Object element)
iterateOnMapKey in class ContainerPolicypublic void postCalculateChanges(ObjectChangeSet ocs, ClassDescriptor referenceDescriptor, DatabaseMapping mapping, UnitOfWorkImpl uow)
postCalculateChanges in class ContainerPolicyMappedKeyMapContainerPolicypublic void postCalculateChanges(java.lang.Object key,
java.lang.Object value,
ClassDescriptor referenceDescriptor,
DatabaseMapping mapping,
UnitOfWorkImpl uow)
postCalculateChanges in class ContainerPolicypublic void processAdditionalWritableMapKeyFields(AbstractSession session)
processAdditionalWritableMapKeyFields in class ContainerPolicypublic void recordPrivateOwnedRemovals(java.lang.Object object,
ClassDescriptor referenceDescriptor,
UnitOfWorkImpl uow)
recordPrivateOwnedRemovals in class ContainerPolicypublic boolean requiresDataModificationEvents()
requiresDataModificationEvents in class ContainerPolicypublic java.lang.Object keyFrom(java.lang.Object element,
AbstractSession session)
keyFrom in class MapContainerPolicypublic void postInitialize(AbstractSession session)
postInitialize in class ContainerPolicypublic void propogatePostDelete(DeleteObjectQuery query, java.lang.Object object)
propogatePostDelete in class ContainerPolicypublic void propogatePostInsert(WriteObjectQuery query, java.lang.Object object)
propogatePostInsert in class ContainerPolicypublic void propogatePostUpdate(WriteObjectQuery query, java.lang.Object object)
propogatePostUpdate in class ContainerPolicypublic void propogatePreDelete(DeleteObjectQuery query, java.lang.Object object)
propogatePreDelete in class ContainerPolicypublic void propogatePreInsert(WriteObjectQuery query, java.lang.Object object)
propogatePreInsert in class ContainerPolicypublic void propogatePreUpdate(WriteObjectQuery query, java.lang.Object object)
propogatePreUpdate in class ContainerPolicypublic boolean propagatesEventsToCollection()
propagatesEventsToCollection in class ContainerPolicypublic void setKeyField(DatabaseField keyField, ClassDescriptor descriptor)
public void setDescriptorForKeyMapping(ClassDescriptor descriptor)
public void setKeyConverter(Converter keyConverter, DirectMapMapping mapping)
public void setKeyConverterClassName(java.lang.String keyConverterClassName,
DirectMapMapping mapping)
public void setKeyMapping(MapKeyMapping mapping)
public void setKeyQuery(DatabaseQuery keyQuery)
keyQuery - public void setValueMapping(MapComponentMapping mapping)
public boolean shouldIncludeKeyInDeleteEvent()
shouldIncludeKeyInDeleteEvent in class ContainerPolicypublic boolean shouldUpdateForeignKeysPostInsert()
shouldUpdateForeignKeysPostInsert in class ContainerPolicypublic int updateJoinedMappingIndexesForMapKey(java.util.Map<DatabaseMapping,java.lang.Object> indexList, int index)
updateJoinedMappingIndexesForMapKey in class ContainerPolicypublic java.lang.Object unwrapKey(java.lang.Object key,
AbstractSession session)
unwrapKey in class MapContainerPolicypublic java.lang.Object valueFromPKList(java.lang.Object[] pks,
AbstractRecord foreignKeys,
ForeignReferenceMapping mapping,
AbstractSession session)
valueFromPKList in class MapContainerPolicyEclipseLink 2.6.3, "build v20160428-59c81c5" API Reference