Class MoveDetector

  • All Implemented Interfaces:
    Editor, Validator

    public class MoveDetector
    extends java.lang.Object
    implements Validator
    A MoveDetector is a validator that can detect certain move operations and reports these to the wrapped MoveValidator by calling MoveValidator.move(String, String, NodeState). That method is called additional to MoveValidator.childNodeAdded(String, NodeState) for the destination of the move operation and MoveValidator.childNodeDeleted(String, NodeState) for the source of the move operation.

    Detection of move operations relies on the presence of the SOURCE_PATH property. New nodes with this property set have been moved from the path indicated by the value of the property to its current location.

    Limitations:

    • Moving a moved node only reports one move from the original source to the final target.
    • Moving a transiently added node is not reported as a move operation but as an add operation on the move target.
    • Removing a moved node is not reported as a move operation but as a remove operation from the source of the move.
    • Moving a child node of a transiently moved node is reported from the original source node, not from the intermediate one.
    • Moving a node back and forth to its original location is not reported at all.
    • Constructor Detail

      • MoveDetector

        public MoveDetector​(MoveValidator moveValidator)
    • Method Detail

      • enter

        public void enter​(NodeState before,
                          NodeState after)
                   throws CommitFailedException
        Description copied from interface: Editor
        Called before the given before and after states are compared. The implementation can use this method to initialize any internal state needed for processing the results of the comparison. For example an implementation could look up the effective node type of the after state to know what constraints to apply to on the content changes.
        Specified by:
        enter in interface Editor
        Parameters:
        before - before state, non-existent if this node was added
        after - after state, non-existent if this node was removed
        Throws:
        CommitFailedException - if this commit should be rejected
      • leave

        public void leave​(NodeState before,
                          NodeState after)
                   throws CommitFailedException
        Description copied from interface: Editor
        Called after the given before and after states are compared. The implementation can use this method to post-process information collected during the content diff. For example an implementation that during the diff just recorded the fact that this node was modified in some way could then use this method to trigger an index update based on that modification flag.
        Specified by:
        leave in interface Editor
        Parameters:
        before - before state, non-existent if this node was added
        after - after state, non-existent if this node was removed
        Throws:
        CommitFailedException - if this commit should be rejected