Oracle Application Server TopLink API Reference
10g (9.0.4.3)

B10491-02

oracle.toplink.sdk
Class SDKDirectCollectionMapping

java.lang.Object
  extended byoracle.toplink.mappings.DatabaseMapping
      extended byoracle.toplink.sdk.SDKDirectCollectionMapping

All Implemented Interfaces:
java.lang.Cloneable, ContainerMapping, SDKCollectionMapping, java.io.Serializable
Direct Known Subclasses:
ArrayMapping

public class SDKDirectCollectionMapping
extends DatabaseMapping
implements SDKCollectionMapping

SDKDirectCollectionMapping consolidates the behavior of mappings that map collections of "native" data objects (e.g. Strings). These are objects that do not have their own descriptor and repeat within the database row for the containing object. (Sorta like a DirectCollectionMapping without the additional table.)

Since:
TOPLink/Java 3.0
See Also:
SDKDescriptor, SDKFieldValue, SDKCollectionMappingHelper, SDKCollectionChangeRecord, SDKOrderedCollectionChangeRecord, Serialized Form

Constructor Summary
SDKDirectCollectionMapping()
          Default constructor.

 

Method Summary
 java.lang.Object buildAddedElementFromChangeSet(java.lang.Object changeSet, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Build and return a new element based on the change set.
 void buildBackupClone(java.lang.Object clone, java.lang.Object backup, oracle.toplink.publicinterface.UnitOfWork unitOfWork)
          INTERNAL: Clone the attribute from the clone and assign it to the backup.
 java.lang.Object buildChangeSet(java.lang.Object element, oracle.toplink.internal.sessions.ObjectChangeSet owner, oracle.toplink.publicinterface.Session session)
          INTERNAL: Build and return a change set for the specified element.
 void buildClone(java.lang.Object original, java.lang.Object clone, oracle.toplink.publicinterface.UnitOfWork unitOfWork)
          INTERNAL: Clone the attribute from the original and assign it to the clone.
 void buildCopy(java.lang.Object copy, java.lang.Object original, ObjectCopyingPolicy policy)
          INTERNAL: Copy of the attribute of the object.
 java.lang.Object buildElementFromElement(java.lang.Object object, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Build and return a new element based on the specified element.
 java.lang.Object buildRemovedElementFromChangeSet(java.lang.Object changeSet, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Build and return a new element based on the change set.
 boolean compareElements(java.lang.Object element1, java.lang.Object element2, oracle.toplink.publicinterface.Session session)
          INTERNAL: Compare the non-null elements.
 boolean compareElementsForChange(java.lang.Object element1, java.lang.Object element2, oracle.toplink.publicinterface.Session session)
          INTERNAL: Compare the non-null elements and return true if they are alike.
 oracle.toplink.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone, java.lang.Object backup, oracle.toplink.internal.sessions.ObjectChangeSet owner, oracle.toplink.publicinterface.Session session)
          INTERNAL: Build and return the change record that results from comparing the two direct collection attributes.
 boolean compareObjects(java.lang.Object object1, java.lang.Object object2, oracle.toplink.publicinterface.Session session)
          INTERNAL: Compare the attributes belonging to this mapping for the objects.
 void fixObjectReferences(java.lang.Object object, oracle.toplink.internal.helper.IdentityHashtable objectDescriptors, oracle.toplink.internal.helper.IdentityHashtable processedObjects, ObjectLevelReadQuery query, RemoteSession session)
          INTERNAL: An object has been serialized from the server to the client.
 java.lang.Class getAttributeElementClass()
          PUBLIC: Return the class each element in the object's collection should be converted to, before the collection is inserted into the object.
 oracle.toplink.internal.queryframework.ContainerPolicy getContainerPolicy()
          INTERNAL: Return the mapping's containerPolicy.
 java.lang.String getElementDataTypeName()
          PUBLIC: Return the "data type" associated with each element in the nested collection.
 oracle.toplink.internal.helper.DatabaseField getField()
          INTERNAL: Return the field that holds the nested collection.
 java.lang.Class getFieldElementClass()
          PUBLIC: Return the class each element in the database row's collection should be converted to, before the collection is inserted into the database.
 java.lang.String getFieldName()
          PUBLIC: Return the name of the field that holds the nested collection.
 java.lang.Object getRealCollectionAttributeValueFromObject(java.lang.Object object, oracle.toplink.publicinterface.Session session)
          INTERNAL: Convenience method.
 void initialize(oracle.toplink.publicinterface.Session session)
          INTERNAL: Initialize the mapping.
 void iterate(oracle.toplink.internal.descriptors.DescriptorIterator iterator)
          INTERNAL: Iterate on the appropriate attribute value.
 boolean mapKeyHasChanged(java.lang.Object element, oracle.toplink.publicinterface.Session session)
          INTERNAL: Return whether the element's user-defined Map key has changed since it was cloned from the original version.
 void mergeChangesIntoObject(java.lang.Object target, oracle.toplink.internal.sessions.ChangeRecord changeRecord, java.lang.Object source, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
 void mergeIntoObject(java.lang.Object target, boolean isTargetUnInitialized, java.lang.Object source, oracle.toplink.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
 void setAttributeElementClass(java.lang.Class attributeElementClass)
          PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object.
 void setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy containerPolicy)
          ADVANCED: Set the mapping's containerPolicy.
 void setElementDataTypeName(java.lang.String elementDataTypeName)
          PUBLIC: Set the "data type" associated with each element in the nested collection.
 void setFieldElementClass(java.lang.Class fieldElementClass)
          PUBLIC: Set the class each element in the database row's collection should be converted to, before the collection is inserted into the database.
 void setFieldName(java.lang.String fieldName)
          PUBLIC: Set the name of the field that holds the nested collection.
 void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey, java.lang.Object changeSetToAdd, oracle.toplink.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.publicinterface.Session session)
          ADVANCED: This method is used to have an object add to a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
 void simpleRemoveFromCollectionChangeRecord(java.lang.Object referenceKey, java.lang.Object changeSetToRemove, oracle.toplink.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.publicinterface.Session session)
          ADVANCED: This method is used to have an object removed from a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
 void useCollectionClass(java.lang.Class concreteClass)
          PUBLIC: Configure the mapping to use an instance of the specified container class to hold the nested objects.
 void useMapClass(java.lang.Class concreteClass, java.lang.String methodName)
          PUBLIC: SDKDirectCollectionMapping does not support Map containers.
 java.lang.Object valueFromRow(DatabaseRow row, ObjectLevelReadQuery query)
          INTERNAL: Build the nested collection from the database row.
 void writeFromObjectIntoRow(java.lang.Object object, DatabaseRow row, oracle.toplink.publicinterface.Session session)
          INTERNAL: Get the attribute value from the object and store it in the appropriate field of the row.
 void writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery, DatabaseRow row)
          INTERNAL: If any part of the nested collection has changed, the whole thing is written.
 void writeFromObjectIntoRowWithChangeRecord(oracle.toplink.internal.sessions.ChangeRecord changeRecord, DatabaseRow row, oracle.toplink.publicinterface.Session session)
          INTERNAL: Get the appropriate attribute value from the object and put it in the appropriate field of the database row.
 void writeInsertFieldsIntoRow(DatabaseRow row, oracle.toplink.publicinterface.Session session)
          INTERNAL: Write the fields needed for insert into the template with null values.

 

Methods inherited from class oracle.toplink.mappings.DatabaseMapping
buildBackupCloneForPartObject, buildCloneForPartObject, buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, cascadeMerge, clone, createUnitOfWorkValueHolder, fixRealObjectReferences, getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getDescriptor, getFieldClassification, getFields, getGetMethodName, getObjectCorrespondingTo, getProperties, getProperty, getRealAttributeValueFromObject, getReferenceDescriptor, getRelationshipPartner, getSetMethodName, getValueFromRemoteValueHolder, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectToFieldMapping, isForeignReferenceMapping, isManyToManyMapping, isNestedTableMapping, isObjectReferenceMapping, isObjectTypeMapping, isOneToManyMapping, isOneToOneMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isSerializedObjectMapping, isStructureMapping, isTransformationMapping, isTypeConversionMapping, isVariableOneToOneMapping, isWriteOnly, iterateOnRealAttributeValue, performDataModificationEvent, postDelete, postInitialize, postInsert, postUpdate, preDelete, preInitialize, preInsert, preUpdate, readFromRowIntoObject, readOnly, readWrite, rehashFieldDependancies, remoteInitialization, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDescriptor, setGetMethodName, setIsReadOnly, setProperties, setProperty, setRealAttributeValueInObject, setSetMethodName, setWeight, toString, validateAfterInitialization, validateBeforeInitialization, valueFromObject, verifyDelete, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForWhereClause, writeUpdateFieldsIntoRow

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Methods inherited from interface oracle.toplink.sdk.SDKCollectionMapping
getAttributeName, setRealAttributeValueInObject

 

Constructor Detail

SDKDirectCollectionMapping

public SDKDirectCollectionMapping()
Default constructor.
Method Detail

buildAddedElementFromChangeSet

public java.lang.Object buildAddedElementFromChangeSet(java.lang.Object changeSet,
                                                       oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Build and return a new element based on the change set.
Specified by:
buildAddedElementFromChangeSet in interface SDKCollectionMapping

buildBackupClone

public void buildBackupClone(java.lang.Object clone,
                             java.lang.Object backup,
                             oracle.toplink.publicinterface.UnitOfWork unitOfWork)
INTERNAL: Clone the attribute from the clone and assign it to the backup. For these mappings, this is the same as building the first clone.
Specified by:
buildBackupClone in class DatabaseMapping

buildChangeSet

public java.lang.Object buildChangeSet(java.lang.Object element,
                                       oracle.toplink.internal.sessions.ObjectChangeSet owner,
                                       oracle.toplink.publicinterface.Session session)
INTERNAL: Build and return a change set for the specified element. Direct collections simply store the element itself, since it is immutable.
Specified by:
buildChangeSet in interface SDKCollectionMapping

buildClone

public void buildClone(java.lang.Object original,
                       java.lang.Object clone,
                       oracle.toplink.publicinterface.UnitOfWork unitOfWork)
INTERNAL: Clone the attribute from the original and assign it to the clone.
Specified by:
buildClone in class DatabaseMapping

buildCopy

public void buildCopy(java.lang.Object copy,
                      java.lang.Object original,
ObjectCopyingPolicy policy)
INTERNAL: Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.
Overrides:
buildCopy in class DatabaseMapping

buildElementFromElement

public java.lang.Object buildElementFromElement(java.lang.Object object,
                                                oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Build and return a new element based on the specified element. Direct collections simply return the element itself, since it is immutable.
Specified by:
buildElementFromElement in interface SDKCollectionMapping

buildRemovedElementFromChangeSet

public java.lang.Object buildRemovedElementFromChangeSet(java.lang.Object changeSet,
                                                         oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Build and return a new element based on the change set.
Specified by:
buildRemovedElementFromChangeSet in interface SDKCollectionMapping

compareElements

public boolean compareElements(java.lang.Object element1,
                               java.lang.Object element2,
                               oracle.toplink.publicinterface.Session session)
INTERNAL: Compare the non-null elements. Return true if they are alike. Use #equals() to determine if two elements are the same.
Specified by:
compareElements in interface SDKCollectionMapping

compareElementsForChange

public boolean compareElementsForChange(java.lang.Object element1,
                                        java.lang.Object element2,
                                        oracle.toplink.publicinterface.Session session)
INTERNAL: Compare the non-null elements and return true if they are alike.
Specified by:
compareElementsForChange in interface SDKCollectionMapping

compareForChange

public oracle.toplink.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone,
                                                                      java.lang.Object backup,
                                                                      oracle.toplink.internal.sessions.ObjectChangeSet owner,
                                                                      oracle.toplink.publicinterface.Session session)
INTERNAL: Build and return the change record that results from comparing the two direct collection attributes.
Specified by:
compareForChange in class DatabaseMapping
Returns:
prototype.changeset.ChangeRecord

compareObjects

public boolean compareObjects(java.lang.Object object1,
                              java.lang.Object object2,
                              oracle.toplink.publicinterface.Session session)
INTERNAL: Compare the attributes belonging to this mapping for the objects.
Specified by:
compareObjects in class DatabaseMapping

fixObjectReferences

public void fixObjectReferences(java.lang.Object object,
                                oracle.toplink.internal.helper.IdentityHashtable objectDescriptors,
                                oracle.toplink.internal.helper.IdentityHashtable processedObjects,
ObjectLevelReadQuery query,
RemoteSession session)
INTERNAL: An object has been serialized from the server to the client. Replace the transient attributes of the remote value holders with client-side objects.
Specified by:
fixObjectReferences in class DatabaseMapping

getAttributeElementClass

public java.lang.Class getAttributeElementClass()
PUBLIC: Return the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted.

getContainerPolicy

public oracle.toplink.internal.queryframework.ContainerPolicy getContainerPolicy()
INTERNAL: Return the mapping's containerPolicy.
Specified by:
getContainerPolicy in interface ContainerMapping
Overrides:
getContainerPolicy in class DatabaseMapping

getElementDataTypeName

public java.lang.String getElementDataTypeName()
PUBLIC: Return the "data type" associated with each element in the nested collection. Depending on the data store, this could be optional.

getField

public oracle.toplink.internal.helper.DatabaseField getField()
INTERNAL: Return the field that holds the nested collection.
Overrides:
getField in class DatabaseMapping

getFieldElementClass

public java.lang.Class getFieldElementClass()
PUBLIC: Return the class each element in the database row's collection should be converted to, before the collection is inserted into the database. This is optional - if left null, the elements will be added to the database row's collection unconverted.

getFieldName

public java.lang.String getFieldName()
PUBLIC: Return the name of the field that holds the nested collection.

getRealCollectionAttributeValueFromObject

public java.lang.Object getRealCollectionAttributeValueFromObject(java.lang.Object object,
                                                                  oracle.toplink.publicinterface.Session session)
                                                           throws DescriptorException
INTERNAL: Convenience method. Return the value of an attribute, unwrapping value holders if necessary. If the value is null, build a new container.
Specified by:
getRealCollectionAttributeValueFromObject in interface SDKCollectionMapping
Overrides:
getRealCollectionAttributeValueFromObject in class DatabaseMapping
Throws:
DescriptorException

initialize

public void initialize(oracle.toplink.publicinterface.Session session)
                throws DescriptorException
INTERNAL: Initialize the mapping.
Overrides:
initialize in class DatabaseMapping
Throws:
DescriptorException

iterate

public void iterate(oracle.toplink.internal.descriptors.DescriptorIterator iterator)
INTERNAL: Iterate on the appropriate attribute value.
Specified by:
iterate in class DatabaseMapping

mapKeyHasChanged

public boolean mapKeyHasChanged(java.lang.Object element,
                                oracle.toplink.publicinterface.Session session)
INTERNAL: Return whether the element's user-defined Map key has changed since it was cloned from the original version. Direct elements are not allowed to have keys.
Specified by:
mapKeyHasChanged in interface SDKCollectionMapping

mergeChangesIntoObject

public void mergeChangesIntoObject(java.lang.Object target,
                                   oracle.toplink.internal.sessions.ChangeRecord changeRecord,
                                   java.lang.Object source,
                                   oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Merge changes from the source to the target object.
Specified by:
mergeChangesIntoObject in class DatabaseMapping

mergeIntoObject

public void mergeIntoObject(java.lang.Object target,
                            boolean isTargetUnInitialized,
                            java.lang.Object source,
                            oracle.toplink.internal.sessions.MergeManager mergeManager)
INTERNAL: Merge changes from the source to the target object. Simply replace the entire target collection.
Specified by:
mergeIntoObject in class DatabaseMapping

setAttributeElementClass

public void setAttributeElementClass(java.lang.Class attributeElementClass)
PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted.

setContainerPolicy

public void setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy containerPolicy)
ADVANCED: Set the mapping's containerPolicy.
Specified by:
setContainerPolicy in interface ContainerMapping

setElementDataTypeName

public void setElementDataTypeName(java.lang.String elementDataTypeName)
PUBLIC: Set the "data type" associated with each element in the nested collection. Depending on the data store, this could be optional.

setFieldElementClass

public void setFieldElementClass(java.lang.Class fieldElementClass)
PUBLIC: Set the class each element in the database row's collection should be converted to, before the collection is inserted into the database. This is optional - if left null, the elements will be added to the database row's collection unconverted.

setFieldName

public void setFieldName(java.lang.String fieldName)
PUBLIC: Set the name of the field that holds the nested collection.

simpleAddToCollectionChangeRecord

public void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey,
                                              java.lang.Object changeSetToAdd,
                                              oracle.toplink.internal.sessions.ObjectChangeSet changeSet,
                                              oracle.toplink.publicinterface.Session session)
ADVANCED: This method is used to have an object add to a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
Overrides:
simpleAddToCollectionChangeRecord in class DatabaseMapping

simpleRemoveFromCollectionChangeRecord

public void simpleRemoveFromCollectionChangeRecord(java.lang.Object referenceKey,
                                                   java.lang.Object changeSetToRemove,
                                                   oracle.toplink.internal.sessions.ObjectChangeSet changeSet,
                                                   oracle.toplink.publicinterface.Session session)
ADVANCED: This method is used to have an object removed from a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
Overrides:
simpleRemoveFromCollectionChangeRecord in class DatabaseMapping

useCollectionClass

public void useCollectionClass(java.lang.Class concreteClass)
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the nested objects.

jdk1.2.x: The container class must implement (directly or indirectly) the Collection interface.

jdk1.1.x: The container class must be a subclass of Vector.

Specified by:
useCollectionClass in interface ContainerMapping

useMapClass

public void useMapClass(java.lang.Class concreteClass,
                        java.lang.String methodName)
PUBLIC: SDKDirectCollectionMapping does not support Map containers. It supports only Collection containers.
Specified by:
useMapClass in interface ContainerMapping

valueFromRow

public java.lang.Object valueFromRow(DatabaseRow row,
ObjectLevelReadQuery query)
                              throws DatabaseException
INTERNAL: Build the nested collection from the database row.
Overrides:
valueFromRow in class DatabaseMapping
Throws:
DatabaseException

writeFromObjectIntoRow

public void writeFromObjectIntoRow(java.lang.Object object,
DatabaseRow row,
                                   oracle.toplink.publicinterface.Session session)
INTERNAL: Get the attribute value from the object and store it in the appropriate field of the row.
Overrides:
writeFromObjectIntoRow in class DatabaseMapping

writeFromObjectIntoRowForUpdate

public void writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery,
DatabaseRow row)
                                     throws DescriptorException
INTERNAL: If any part of the nested collection has changed, the whole thing is written.
Overrides:
writeFromObjectIntoRowForUpdate in class DatabaseMapping
Throws:
DescriptorException

writeFromObjectIntoRowWithChangeRecord

public void writeFromObjectIntoRowWithChangeRecord(oracle.toplink.internal.sessions.ChangeRecord changeRecord,
DatabaseRow row,
                                                   oracle.toplink.publicinterface.Session session)
INTERNAL: Get the appropriate attribute value from the object and put it in the appropriate field of the database row. Loop through the reference objects and extract the primary keys and put them in the vector of "nested" rows.
Overrides:
writeFromObjectIntoRowWithChangeRecord in class DatabaseMapping

writeInsertFieldsIntoRow

public void writeInsertFieldsIntoRow(DatabaseRow row,
                                     oracle.toplink.publicinterface.Session session)
INTERNAL: Write the fields needed for insert into the template with null values.
Overrides:
writeInsertFieldsIntoRow in class DatabaseMapping

Copyright © 1998, 2004 Oracle Corporation. All Rights Reserved.