Class VisibleValidator

  • All Implemented Interfaces:
    Editor, Validator

    public class VisibleValidator
    extends java.lang.Object
    implements Validator
    Validator implementation that allows to exclude hidden nodes and/or properties for the validation process.
    • Constructor Summary

      Constructors 
      Constructor Description
      VisibleValidator​(@NotNull Validator validator, boolean hideNodes, boolean hideProperties)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @Nullable Validator childNodeAdded​(java.lang.String name, NodeState after)
      Validate an added node
      @Nullable Validator childNodeChanged​(java.lang.String name, NodeState before, NodeState after)
      Validate a changed node
      @Nullable Validator childNodeDeleted​(java.lang.String name, NodeState before)
      Validate a deleted node
      void enter​(NodeState before, NodeState after)
      Called before the given before and after states are compared.
      void leave​(NodeState before, NodeState after)
      Called after the given before and after states are compared.
      void propertyAdded​(org.apache.jackrabbit.oak.api.PropertyState after)
      Validate an added property
      void propertyChanged​(org.apache.jackrabbit.oak.api.PropertyState before, org.apache.jackrabbit.oak.api.PropertyState after)
      Validate a changed property
      void propertyDeleted​(org.apache.jackrabbit.oak.api.PropertyState before)
      Validate a deleted property
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VisibleValidator

        public VisibleValidator​(@NotNull
                                @NotNull Validator validator,
                                boolean hideNodes,
                                boolean hideProperties)
    • Method Detail

      • enter

        public void enter​(NodeState before,
                          NodeState after)
                   throws org.apache.jackrabbit.oak.api.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:
        org.apache.jackrabbit.oak.api.CommitFailedException - if this commit should be rejected
      • leave

        public void leave​(NodeState before,
                          NodeState after)
                   throws org.apache.jackrabbit.oak.api.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:
        org.apache.jackrabbit.oak.api.CommitFailedException - if this commit should be rejected
      • propertyAdded

        public void propertyAdded​(org.apache.jackrabbit.oak.api.PropertyState after)
                           throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Validator
        Validate an added property
        Specified by:
        propertyAdded in interface Editor
        Specified by:
        propertyAdded in interface Validator
        Parameters:
        after - the added property
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if validation fails.
      • propertyChanged

        public void propertyChanged​(org.apache.jackrabbit.oak.api.PropertyState before,
                                    org.apache.jackrabbit.oak.api.PropertyState after)
                             throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Validator
        Validate a changed property
        Specified by:
        propertyChanged in interface Editor
        Specified by:
        propertyChanged in interface Validator
        Parameters:
        before - the original property
        after - the changed property
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if validation fails.
      • propertyDeleted

        public void propertyDeleted​(org.apache.jackrabbit.oak.api.PropertyState before)
                             throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Validator
        Validate a deleted property
        Specified by:
        propertyDeleted in interface Editor
        Specified by:
        propertyDeleted in interface Validator
        Parameters:
        before - the original property
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if validation fails.
      • childNodeAdded

        @Nullable
        public @Nullable Validator childNodeAdded​(java.lang.String name,
                                                  NodeState after)
                                           throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Validator
        Validate an added node
        Specified by:
        childNodeAdded in interface Editor
        Specified by:
        childNodeAdded in interface Validator
        Parameters:
        name - the name of the added node
        after - the added node
        Returns:
        a Validator for after or null if validation should not decent into the subtree rooted at after.
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if validation fails.
      • childNodeChanged

        @Nullable
        public @Nullable Validator childNodeChanged​(java.lang.String name,
                                                    NodeState before,
                                                    NodeState after)
                                             throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Validator
        Validate a changed node
        Specified by:
        childNodeChanged in interface Editor
        Specified by:
        childNodeChanged in interface Validator
        Parameters:
        name - the name of the changed node
        before - the original node
        after - the changed node
        Returns:
        a Validator for after or null if validation should not decent into the subtree rooted at after.
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if validation fails.
      • childNodeDeleted

        @Nullable
        public @Nullable Validator childNodeDeleted​(java.lang.String name,
                                                    NodeState before)
                                             throws org.apache.jackrabbit.oak.api.CommitFailedException
        Description copied from interface: Validator
        Validate a deleted node
        Specified by:
        childNodeDeleted in interface Editor
        Specified by:
        childNodeDeleted in interface Validator
        Parameters:
        name - The name of the deleted node.
        before - the original node
        Returns:
        a Validator for the removed subtree or null if validation should not decent into the subtree
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException - if validation fails.