Class UniversalFilter

  • All Implemented Interfaces:
    EventFilter

    public class UniversalFilter
    extends java.lang.Object
    implements EventFilter
    An universal Filter implementation, which can be parametrised by a UniversalFilter.Selector and a Predicate. The selector maps a call back on this filter to a NodeState. That node state is in turn passed to the predicate for determining whether to include or to exclude the respective event.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  UniversalFilter.Selector
      A selector instance maps call backs on Filters to NodeState instances, which should be used for determining inclusion or exclusion of the associated event.
    • Constructor Summary

      Constructors 
      Constructor Description
      UniversalFilter​(@NotNull org.apache.jackrabbit.oak.spi.state.NodeState before, @NotNull org.apache.jackrabbit.oak.spi.state.NodeState after, @NotNull UniversalFilter.Selector selector, @NotNull java.util.function.Predicate<org.apache.jackrabbit.oak.spi.state.NodeState> predicate)
      Create a new instance of an universal filter rooted at the passed trees.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      EventFilter create​(java.lang.String name, org.apache.jackrabbit.oak.spi.state.NodeState before, org.apache.jackrabbit.oak.spi.state.NodeState after)
      Factory for creating a filter instance for the given child node
      @NotNull org.apache.jackrabbit.oak.spi.state.NodeState getAfterState()  
      @NotNull org.apache.jackrabbit.oak.spi.state.NodeState getBeforeState()  
      boolean includeAdd​(java.lang.String name, org.apache.jackrabbit.oak.spi.state.NodeState after)
      Include an added node
      boolean includeAdd​(org.apache.jackrabbit.oak.api.PropertyState after)
      Include an added property
      boolean includeChange​(org.apache.jackrabbit.oak.api.PropertyState before, org.apache.jackrabbit.oak.api.PropertyState after)
      Include a changed property
      boolean includeDelete​(java.lang.String name, org.apache.jackrabbit.oak.spi.state.NodeState before)
      Include a deleted node
      boolean includeDelete​(org.apache.jackrabbit.oak.api.PropertyState before)
      Include a deleted property
      boolean includeMove​(java.lang.String sourcePath, java.lang.String name, org.apache.jackrabbit.oak.spi.state.NodeState moved)
      Include a moved node
      boolean includeReorder​(java.lang.String destName, java.lang.String name, org.apache.jackrabbit.oak.spi.state.NodeState reordered)
      Include a reordered node
      • Methods inherited from class java.lang.Object

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

      • UniversalFilter

        public UniversalFilter​(@NotNull
                               @NotNull org.apache.jackrabbit.oak.spi.state.NodeState before,
                               @NotNull
                               @NotNull org.apache.jackrabbit.oak.spi.state.NodeState after,
                               @NotNull
                               @NotNull UniversalFilter.Selector selector,
                               @NotNull
                               @NotNull java.util.function.Predicate<org.apache.jackrabbit.oak.spi.state.NodeState> predicate)
        Create a new instance of an universal filter rooted at the passed trees.
        Parameters:
        before - before state
        after - after state
        selector - selector for selecting the tree to match the predicate against
        predicate - predicate for determining whether to include or to exclude an event
    • Method Detail

      • getBeforeState

        @NotNull
        public @NotNull org.apache.jackrabbit.oak.spi.state.NodeState getBeforeState()
        Returns:
        before state for this filter
      • getAfterState

        @NotNull
        public @NotNull org.apache.jackrabbit.oak.spi.state.NodeState getAfterState()
        Returns:
        after state for this filter
      • includeAdd

        public boolean includeAdd​(org.apache.jackrabbit.oak.api.PropertyState after)
        Description copied from interface: EventFilter
        Include an added property
        Specified by:
        includeAdd in interface EventFilter
        Parameters:
        after - added property
        Returns:
        true if the property should be included
      • includeChange

        public boolean includeChange​(org.apache.jackrabbit.oak.api.PropertyState before,
                                     org.apache.jackrabbit.oak.api.PropertyState after)
        Description copied from interface: EventFilter
        Include a changed property
        Specified by:
        includeChange in interface EventFilter
        Parameters:
        before - property before the change
        after - property after the change
        Returns:
        true if the property should be included
      • includeDelete

        public boolean includeDelete​(org.apache.jackrabbit.oak.api.PropertyState before)
        Description copied from interface: EventFilter
        Include a deleted property
        Specified by:
        includeDelete in interface EventFilter
        Parameters:
        before - deleted property
        Returns:
        true if the property should be included
      • includeAdd

        public boolean includeAdd​(java.lang.String name,
                                  org.apache.jackrabbit.oak.spi.state.NodeState after)
        Description copied from interface: EventFilter
        Include an added node
        Specified by:
        includeAdd in interface EventFilter
        Parameters:
        name - name of the node
        after - added node
        Returns:
        true if the node should be included
      • includeDelete

        public boolean includeDelete​(java.lang.String name,
                                     org.apache.jackrabbit.oak.spi.state.NodeState before)
        Description copied from interface: EventFilter
        Include a deleted node
        Specified by:
        includeDelete in interface EventFilter
        Parameters:
        name - name of the node
        before - deleted node
        Returns:
        true if the node should be included
      • includeMove

        public boolean includeMove​(java.lang.String sourcePath,
                                   java.lang.String name,
                                   org.apache.jackrabbit.oak.spi.state.NodeState moved)
        Description copied from interface: EventFilter
        Include a moved node
        Specified by:
        includeMove in interface EventFilter
        Parameters:
        sourcePath - source path of the move operation
        name - name of the moved node
        moved - the moved node
        Returns:
        true if the node should be included
      • includeReorder

        public boolean includeReorder​(java.lang.String destName,
                                      java.lang.String name,
                                      org.apache.jackrabbit.oak.spi.state.NodeState reordered)
        Description copied from interface: EventFilter
        Include a reordered node
        Specified by:
        includeReorder in interface EventFilter
        Parameters:
        destName - name of the orderBefore() destination node
        name - name of the reordered node
        reordered - the reordered node
        Returns:
        true if the node should be included
      • create

        public EventFilter create​(java.lang.String name,
                                  org.apache.jackrabbit.oak.spi.state.NodeState before,
                                  org.apache.jackrabbit.oak.spi.state.NodeState after)
        Description copied from interface: EventFilter
        Factory for creating a filter instance for the given child node
        Specified by:
        create in interface EventFilter
        Parameters:
        name - name of the child node
        before - before state of the child node
        after - after state of the child node
        Returns:
        filter instance for filtering the child node or null to exclude the sub tree rooted at this child node.