Class ModelTransaction.Operations

  • Enclosing class:
    ModelTransaction

    private final class ModelTransaction.Operations
    extends java.lang.Object
    A helper class which collects multiple update operations to be executed on a single node.
    • Field Detail

      • operations

        private java.util.Collection<ModelTransaction.Operation> operations
        A collection for the other operations to be performed on the target node.
      • addedNodesInOperation

        private java.util.Collection<ImmutableNode> addedNodesInOperation
        A collection with nodes added by an operation.
    • Constructor Detail

      • Operations

        private Operations()
    • Method Detail

      • apply

        public void apply​(ImmutableNode target,
                          int level)
        Executes all operations stored in this object on the given target node. The resulting node then has to be integrated in the current node hierarchy. Unless the root node is already reached, this causes another updated operation to be created which replaces the manipulated child in the parent node.
        Parameters:
        target - the target node for this operation
        level - the level of the target node
      • handleAddedNodes

        private void handleAddedNodes​(ImmutableNode node)
        Checks whether new nodes have been added during operation execution. If so, the parent mapping has to be updated.
        Parameters:
        node - the resulting node after applying all operations
      • newNodesAdded

        public void newNodesAdded​(java.util.Collection<ImmutableNode> newNodes)
        Notifies this object that new nodes have been added by a sub operation. It has to be ensured that these nodes are added to the parent mapping.
        Parameters:
        newNodes - the collection of newly added nodes
      • propagateChange

        private void propagateChange​(ImmutableNode target,
                                     ImmutableNode node,
                                     int level)
        Propagates the changes on the target node to the next level above of the hierarchy. If the updated node is no longer defined, it can even be removed from its parent. Otherwise, it is just replaced.
        Parameters:
        target - the target node for this operation
        node - the resulting node after applying all operations
        level - the level of the target node