Class UnitOfWorkChangeSet

    • Constructor Detail

      • UnitOfWorkChangeSet

        public UnitOfWorkChangeSet()
        INTERNAL: Create a ChangeSet
      • UnitOfWorkChangeSet

        public UnitOfWorkChangeSet​(AbstractSession session)
        INTERNAL: Create a ChangeSet
    • Method Detail

      • getSession

        public AbstractSession getSession()
        Return the session. This only exists before serialization.
      • setSession

        public void setSession​(AbstractSession session)
        INTERNAL: Set the session. This only exists before serialization.
      • addDeletedObjects

        public void addDeletedObjects​(Map deletedObjects,
                                      AbstractSession session)
        INTERNAL: Add the Deleted objects to the changeSet.
      • addDeletedObject

        public void addDeletedObject​(Object object,
                                     AbstractSession session)
        INTERNAL: Add the Deleted object to the changeSet.
      • addObjectChangeSet

        public void addObjectChangeSet​(ObjectChangeSet objectChanges,
                                       AbstractSession session,
                                       boolean forceToNewObjectList)
        INTERNAL: Add to the changes for 'object' object to this changeSet. This method will not add to the lists that are used for identity lookups. The passed change set *must* either have changes or forced changes.
        Parameters:
        forceToNewObjectList - - Any pre commit actions should pass in true since new objects have extra-handling. Anything post commit, pass in false.
        See Also:
        addObjectChangeSetForIdentity(ObjectChangeSet, Object)
      • addNewObjectChangeSet

        protected void addNewObjectChangeSet​(ObjectChangeSet objectChanges,
                                             AbstractSession session)
        INTERNAL: Add to the changes for 'object' object to this changeSet. This method will not add to the lists that are used for identity lookups. It is called specifically for new objects, and new object will be moved to the standard changes list by the QueryMechanism after insert.
        Parameters:
        objectChanges - the new object change set
        See Also:
        addObjectChangeSetForIdentity(ObjectChangeSet, Object)
      • findObjectChangeSet

        public ObjectChangeSet findObjectChangeSet​(ObjectChangeSet changeSet,
                                                   UnitOfWorkChangeSet mergeFromChangeSet)
        INTERNAL: This method can be used find the equivalent changeset within this UnitOfWorkChangeSet Aggregates, and new objects without primaryKeys from serialized ChangeSets will not be found Which may result in duplicates, in the UnitOfWorkChangeSet.
      • findOrIntegrateObjectChangeSet

        public ObjectChangeSet findOrIntegrateObjectChangeSet​(ObjectChangeSet tofind,
                                                              UnitOfWorkChangeSet mergeFromChangeSet)
        INTERNAL: This method will be used during the merge process to either find an equivalent change set within this UnitOfWorkChangeSet or integrate that changeset into this UOW ChangeSet
      • findOrCreateLocalObjectChangeSet

        public ObjectChangeSet findOrCreateLocalObjectChangeSet​(Object entityClone,
                                                                ClassDescriptor descriptor,
                                                                boolean isNew)
        INTERNAL" This method is used during the merge process to either find the existing ChangeSet or create a new one.
      • getAggregateChangeSets

        public Map<ObjectChangeSet,​ObjectChangeSet> getAggregateChangeSets()
        INTERNAL: Get the Aggregate list. Lazy initializes the map if required.
      • buildCacheCoordinationMergeChangeSet

        public UnitOfWorkChangeSet buildCacheCoordinationMergeChangeSet​(AbstractSession session)
        INTERNAL: Return a new UnitOfWorkChangeSet that only includes data require for the remote merge, for cache coordination.
        Parameters:
        session - current database session
      • getCloneToObjectChangeSet

        public Map<Object,​ObjectChangeSet> getCloneToObjectChangeSet()
        INTERNAL: Get the clone to object change hash table. Lazy initializes the map if required.
      • findUpdatedObjectsClasses

        public Set<ClassDescriptor> findUpdatedObjectsClasses()
        INTERNAL: Returns the set of classes corresponding to updated objects in objectChanges.
      • getObjectChangeSetToUOWClone

        protected Map<ObjectChangeSet,​Object> getObjectChangeSetToUOWClone()
        INTERNAL: This method returns a reference to the collection
        Returns:
        Map
      • hasChanges

        public boolean hasChanges()
        INTERNAL: Returns true if the Unit Of Work change Set has changes
        Specified by:
        hasChanges in interface UnitOfWorkChangeSet
        Returns:
        boolean
      • hasDeletedObjects

        public boolean hasDeletedObjects()
        INTERNAL: Returns true if any deleted objects. This should be used before accessing deleted object to avoid creation of map.
      • setHasChanges

        public void setHasChanges​(boolean flag)
        INTERNAL: Set whether the Unit Of Work change Set has changes
      • hasForcedChanges

        public boolean hasForcedChanges()
        INTERNAL: Returns true if this uowChangeSet contains an objectChangeSet that has forced SQL changes. This is true whenever CMPPolicy.getForceUpdate() == true.
        Returns:
        boolean
      • mergeObjectChanges

        public ObjectChangeSet mergeObjectChanges​(ObjectChangeSet objectChangeSet,
                                                  UnitOfWorkChangeSet mergeFromChangeSet)
        INTERNAL: This method will be used to merge a change set into an UnitOfWorkChangeSet This method returns the local instance of the changeset
      • mergeUnitOfWorkChangeSet

        public void mergeUnitOfWorkChangeSet​(UnitOfWorkChangeSet mergeFromChangeSet,
                                             AbstractSession session,
                                             boolean postCommit)
        INTERNAL: THis method will be used to merge another changeset into this changeset. The Main use of this method is for non-deferred writes and checkpointing so that the accumulated changes are collected and merged at the end of the transaction.
      • putNewObjectInChangesList

        public void putNewObjectInChangesList​(ObjectChangeSet objectChangeSet,
                                              AbstractSession session)
        INTERNAL: Used to rehash the new objects back into the objectChanges list for serialization Assumes the transaction in in post commit stage.
      • removeObjectChangeSetFromNewList

        public void removeObjectChangeSetFromNewList​(ObjectChangeSet objectChangeSet,
                                                     AbstractSession session)
        INTERNAL: Used to remove a new object from the new objects list once it has been inserted and added to the objectChangesList
      • removeObjectChangeSet

        public void removeObjectChangeSet​(ObjectChangeSet changeSet)
        INTERNAL: Add the changed Object's records to the ChangeSet.
      • setIsChangeSetFromOutsideUOW

        public void setIsChangeSetFromOutsideUOW​(boolean isChangeSetFromOutsideUOW)
        INTERNAL: Set the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOW
      • isChangeSetFromOutsideUOW

        public boolean isChangeSetFromOutsideUOW()
        INTERNAL: Get the internal flag that tells that this change set was built outside this UOW and the changes it contains cannot be calculated from the contents of this UOW
      • setCloneToObjectChangeSet

        public void setCloneToObjectChangeSet​(Map<Object,​ObjectChangeSet> cloneToObjectChangeSet)
        INTERNAL: This method is used to set the map for cloneToObject reference.
      • setObjectChanges

        protected void setObjectChanges​(Map objectChanges)
        INTERNAL: Sets the collection of ObjectChanges in the change Set.
      • setAllChangeSets

        public void setAllChangeSets​(Map allChangeSets)
        INTERNAL: Sets the collection of ObjectChanges in the change Set.
      • setDeletedObjects

        public void setDeletedObjects​(Map deletedObjects)
        INTERNAL: Sets the collection of deleted objects.
      • setObjectChangeSetToUOWClone

        public void setObjectChangeSetToUOWClone​(Map<ObjectChangeSet,​Object> objectChangeSetToUOWClone)
        INTERNAL: This method is used to insert a new collection into the UOWChangeSet.