Class AbstractCompositeCollectionMapping

    • Field Detail

      • field

        protected org.eclipse.persistence.internal.helper.DatabaseField field
        The aggregate objects are stored in a single field.
      • converter

        protected Converter converter
        Allows user defined conversion between the object attribute value and the database value.
    • Constructor Detail

      • AbstractCompositeCollectionMapping

        public AbstractCompositeCollectionMapping()
        Default constructor.
    • Method Detail

      • buildAddedElementFromChangeSet

        public java.lang.Object buildAddedElementFromChangeSet​(java.lang.Object changeSet,
                                                               org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
                                                               org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
        INTERNAL: Build and return a new element based on the change set.
        Specified by:
        buildAddedElementFromChangeSet in interface ArrayCollectionMapping
      • buildBackupClonePart

        protected java.lang.Object buildBackupClonePart​(java.lang.Object attributeValue,
                                                        org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
        Build and return a backup clone of the attribute.
        Overrides:
        buildBackupClonePart in class AggregateMapping
      • buildChangeSet

        public java.lang.Object buildChangeSet​(java.lang.Object element,
                                               org.eclipse.persistence.internal.sessions.ObjectChangeSet owner,
                                               org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Build and return a change set for the specified element.
        Specified by:
        buildChangeSet in interface ArrayCollectionMapping
      • buildClonePart

        protected java.lang.Object buildClonePart​(java.lang.Object original,
                                                  java.lang.Object clone,
                                                  org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey,
                                                  java.lang.Object attributeValue,
                                                  java.lang.Integer refreshCascade,
                                                  org.eclipse.persistence.internal.sessions.AbstractSession clonningSession)
        Build and return a clone of the attribute.
        Overrides:
        buildClonePart in class AggregateMapping
      • buildCopyOfAttributeValue

        protected java.lang.Object buildCopyOfAttributeValue​(java.lang.Object attributeValue,
                                                             CopyGroup group)
        Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.
        Overrides:
        buildCopyOfAttributeValue in class AggregateMapping
      • buildElementFromChangeSet

        protected java.lang.Object buildElementFromChangeSet​(java.lang.Object changeSet,
                                                             org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
                                                             org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
        Build and return a new element based on the change set.
      • buildElementFromElement

        public java.lang.Object buildElementFromElement​(java.lang.Object element,
                                                        org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
                                                        org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
        INTERNAL: Build and return a new element based on the specified element.
        Specified by:
        buildElementFromElement in interface ArrayCollectionMapping
      • buildExpression

        public Expression buildExpression​(java.lang.Object queryObject,
                                          QueryByExamplePolicy policy,
                                          Expression expressionBuilder,
                                          java.util.Map processedObjects,
                                          org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribute and it's value.
        Overrides:
        buildExpression in class AggregateMapping
      • buildRemovedElementFromChangeSet

        public java.lang.Object buildRemovedElementFromChangeSet​(java.lang.Object changeSet,
                                                                 org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
                                                                 org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
        INTERNAL: Build and return a new element based on the change set.
        Specified by:
        buildRemovedElementFromChangeSet in interface ArrayCollectionMapping
      • cascadePerformRemoveIfRequired

        public void cascadePerformRemoveIfRequired​(java.lang.Object object,
                                                   org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                                   java.util.Map visitedObjects)
        INTERNAL: Cascade perform delete through mappings that require the cascade
        Specified by:
        cascadePerformRemoveIfRequired in class DatabaseMapping
      • cascadeDiscoverAndPersistUnregisteredNewObjects

        public void cascadeDiscoverAndPersistUnregisteredNewObjects​(java.lang.Object object,
                                                                    java.util.Map newObjects,
                                                                    java.util.Map unregisteredExistingObjects,
                                                                    java.util.Map visitedObjects,
                                                                    org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                                                    java.util.Set cascadeErrors)
        INTERNAL: Cascade discover and persist new objects during commit.
        Overrides:
        cascadeDiscoverAndPersistUnregisteredNewObjects in class DatabaseMapping
      • cascadeRegisterNewIfRequired

        public void cascadeRegisterNewIfRequired​(java.lang.Object object,
                                                 org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                                 java.util.Map visitedObjects)
        INTERNAL: Cascade registerNew for Create through mappings that require the cascade
        Specified by:
        cascadeRegisterNewIfRequired in class DatabaseMapping
      • collectFields

        protected java.util.Vector collectFields()
        Return the fields handled by the mapping.
        Overrides:
        collectFields in class DatabaseMapping
      • compareElements

        public boolean compareElements​(java.lang.Object element1,
                                       java.lang.Object element2,
                                       org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Compare the non-null elements and return true if they are alike.
        Specified by:
        compareElements in interface ArrayCollectionMapping
      • compareElementsForChange

        public boolean compareElementsForChange​(java.lang.Object element1,
                                                java.lang.Object element2,
                                                org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Compare the non-null elements and return true if they are alike.
        Specified by:
        compareElementsForChange in interface ArrayCollectionMapping
      • convertClassNamesToClasses

        public void convertClassNamesToClasses​(java.lang.ClassLoader classLoader)
        INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.
        Overrides:
        convertClassNamesToClasses in class AggregateMapping
        Parameters:
        classLoader -
      • convertToChangeRecord

        protected org.eclipse.persistence.internal.sessions.ChangeRecord convertToChangeRecord​(java.lang.Object cloneCollection,
                                                                                               org.eclipse.persistence.internal.sessions.ObjectChangeSet owner,
                                                                                               org.eclipse.persistence.internal.sessions.AbstractSession session)
      • fixAttributeValue

        protected void fixAttributeValue​(java.lang.Object attributeValue,
                                         java.util.Map objectDescriptors,
                                         java.util.Map processedObjects,
                                         ObjectLevelReadQuery query,
                                         DistributedSession session)
        An object has been serialized from the server to the remote client. Replace the transient attributes of the remote value holders with client-side objects.
        Overrides:
        fixAttributeValue in class AggregateMapping
      • getAttributeValueFromBackupClone

        protected java.lang.Object getAttributeValueFromBackupClone​(java.lang.Object backupClone)
        Return the appropriate attribute value. This method is a hack to allow the aggregate collection subclass to override.... The intent is to return the aggregate object in the backup clone that corresponds to the one in the working copy. Since we don't know which element in the backup clone collection corresponds any given element in the working copy collection (there is no "primary key"); we simply return null, which will cause a new, empty, instance to be built and used for comparison.
        Overrides:
        getAttributeValueFromBackupClone in class AggregateMapping
      • getConverter

        public Converter getConverter()
        PUBLIC: Return the converter on the mapping. A converter can be used to convert between the object's value and database value of the attribute.
      • getField

        public org.eclipse.persistence.internal.helper.DatabaseField getField()
        INTERNAL: Return the field mapped by this mapping.
        Overrides:
        getField in class DatabaseMapping
      • getStructureName

        protected java.lang.String getStructureName()
        This is required for ObjectArrayMapping which defines a name for the collection type. Currently this type name is not required or used in general with the SDK.
      • hasConverter

        public boolean hasConverter()
        PUBLIC: Indicates if there is a converter on the mapping.
      • initialize

        public void initialize​(org.eclipse.persistence.internal.sessions.AbstractSession session)
                        throws DescriptorException
        INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
        Overrides:
        initialize in class AggregateMapping
        Throws:
        DescriptorException
      • iterateOnAttributeValue

        protected void iterateOnAttributeValue​(org.eclipse.persistence.internal.descriptors.DescriptorIterator descriptorIterator,
                                               java.lang.Object attributeValue)
        Iterate on the specified attribute value.
        Overrides:
        iterateOnAttributeValue in class AggregateMapping
      • mapKeyHasChanged

        public boolean mapKeyHasChanged​(java.lang.Object element,
                                        org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Return whether the element's user-defined Map key has changed since it was cloned from the original version. Aggregate elements cannot change their keys without detection.
        Specified by:
        mapKeyHasChanged in interface ArrayCollectionMapping
      • setContainerPolicy

        public void setContainerPolicy​(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
        ADVANCED: Set the mapping's containerPolicy.
        Specified by:
        setContainerPolicy in interface ContainerMapping
      • setConverter

        public void setConverter​(Converter converter)
        PUBLIC: Set the converter on the mapping. A converter can be used to convert between the object's value and database value of the attribute.
      • setField

        public void setField​(org.eclipse.persistence.internal.helper.DatabaseField field)
        Set the field in the mapping.
      • useCollectionClass

        public void useCollectionClass​(java.lang.Class concreteContainerClass)
        PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target 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
      • useCollectionClassName

        public void useCollectionClassName​(java.lang.String concreteContainerClassName)
        Description copied from interface: ContainerMapping
        PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.

        The container class must implement (directly or indirectly) the java.util.Collection interface.

        Specified by:
        useCollectionClassName in interface ContainerMapping
      • useListClassName

        public void useListClassName​(java.lang.String concreteContainerClassName)
        Description copied from interface: ContainerMapping
        PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.

        The container class must implement (directly or indirectly) the java.util.List interface.

        Specified by:
        useListClassName in interface ContainerMapping
      • useMapClass

        public void useMapClass​(java.lang.Class concreteContainerClass,
                                java.lang.String methodName)
        PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. The key used to index the value in the Map is the value returned by a call to the specified zero-argument method. The method must be implemented by the class (or a superclass) of the value to be inserted into the Map.

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

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

        The referenceClass must be set before calling this method.

        Specified by:
        useMapClass in interface ContainerMapping
      • useMapClassName

        public void useMapClassName​(java.lang.String concreteContainerClassName,
                                    java.lang.String methodName)
        Description copied from interface: ContainerMapping
        PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. The key used to index a value in the Map is the value returned by a call to the specified zero-argument method. The method must be implemented by the class (or a superclass) of any value to be inserted into the Map.

        The container class must implement (directly or indirectly) the java.util.Map interface.

        To facilitate resolving the method, the mapping's referenceClass must set before calling this method.

        Specified by:
        useMapClassName in interface ContainerMapping
      • valueFromRow

        public java.lang.Object valueFromRow​(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                             org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                             ObjectBuildingQuery sourceQuery,
                                             org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey,
                                             org.eclipse.persistence.internal.sessions.AbstractSession executionSession,
                                             boolean isTargetProtected,
                                             java.lang.Boolean[] wasCacheUsed)
                                      throws DatabaseException
        INTERNAL: Build and return an aggregate collection from the specified row.
        Overrides:
        valueFromRow in class DatabaseMapping
        Throws:
        DatabaseException
      • buildCompositeObject

        protected abstract java.lang.Object buildCompositeObject​(ClassDescriptor descriptor,
                                                                 org.eclipse.persistence.internal.sessions.AbstractRecord nestedRow,
                                                                 ObjectBuildingQuery query,
                                                                 org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey,
                                                                 org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManger,
                                                                 org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
      • buildCompositeRow

        protected abstract org.eclipse.persistence.internal.sessions.AbstractRecord buildCompositeRow​(java.lang.Object attributeValue,
                                                                                                      org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                                                      org.eclipse.persistence.internal.sessions.AbstractRecord record,
                                                                                                      DatabaseMapping.WriteType writeType)
      • writeInsertFieldsIntoRow

        public void writeInsertFieldsIntoRow​(org.eclipse.persistence.internal.sessions.AbstractRecord record,
                                             org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Write fields needed for insert into the template with null values.
        Overrides:
        writeInsertFieldsIntoRow in class DatabaseMapping
      • compareForChange

        public org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange​(java.lang.Object clone,
                                                                                       java.lang.Object backup,
                                                                                       org.eclipse.persistence.internal.sessions.ObjectChangeSet owner,
                                                                                       org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Build and return the change record that results from comparing the two direct collection attributes.
        Overrides:
        compareForChange in class AggregateMapping
        Returns:
        prototype.changeset.ChangeRecord
      • compareObjects

        public boolean compareObjects​(java.lang.Object object1,
                                      java.lang.Object object2,
                                      org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Compare the attributes belonging to this mapping for the objects.
        Overrides:
        compareObjects in class AggregateMapping
      • mergeChangesIntoObject

        public void mergeChangesIntoObject​(java.lang.Object target,
                                           org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                           java.lang.Object source,
                                           org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
                                           org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
        INTERNAL: Merge changes from the source to the target object.
        Overrides:
        mergeChangesIntoObject in class AggregateMapping
      • mergeIntoObject

        public void mergeIntoObject​(java.lang.Object target,
                                    boolean isTargetUnInitialized,
                                    java.lang.Object source,
                                    org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
                                    org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
        INTERNAL: Merge changes from the source to the target object. Simply replace the entire target collection.
        Overrides:
        mergeIntoObject in class AggregateMapping
      • simpleAddToCollectionChangeRecord

        public void simpleAddToCollectionChangeRecord​(java.lang.Object referenceKey,
                                                      java.lang.Object changeSetToAdd,
                                                      org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet,
                                                      org.eclipse.persistence.internal.sessions.AbstractSession 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,
                                                           org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet,
                                                           org.eclipse.persistence.internal.sessions.AbstractSession 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
      • createMapComponentFromRow

        public java.lang.Object createMapComponentFromRow​(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow,
                                                          ObjectBuildingQuery query,
                                                          org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey,
                                                          org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                          boolean isTargetProtected)
        INTERNAL Called when a DatabaseMapping is used to map the key in a collection. Returns the key.