Class FilteringNodeState

  • All Implemented Interfaces:
    org.apache.jackrabbit.oak.spi.state.NodeState

    public class FilteringNodeState
    extends AbstractDecoratedNodeState
    NodeState implementation that decorates another node-state instance in order to hide subtrees or partial subtrees from the consumer of the API.
    The set of visible subtrees is defined by two parameters: include paths and exclude paths, both of which are sets of absolute paths.
    Any paths that are equal or are descendants of one of the excluded paths are hidden by this implementation.
    For all included paths, the direct ancestors, the node-state at the path itself and all descendants are visible. Any siblings of the defined path or its ancestors are implicitly hidden (unless made visible by another include path).
    The implementation delegates to the decorated node-state instance and filters out hidden node-states in the following methods: When referenceableFrozenNodes is set to false, then the implementation will hide the jcr:uuid property on nt:frozenNode nodes (see also OAK-9134).
    Additionally, hidden node-state names are removed from the property :childOrder in the following two methods:
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Set<java.lang.String> ALL  
      static java.util.Set<java.lang.String> NONE  
      • Fields inherited from interface org.apache.jackrabbit.oak.spi.state.NodeState

        EXISTS
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected @NotNull org.apache.jackrabbit.oak.spi.state.NodeState decorateChild​(@NotNull java.lang.String name, @NotNull org.apache.jackrabbit.oak.spi.state.NodeState child)  
      protected org.apache.jackrabbit.oak.api.PropertyState decorateProperty​(@NotNull org.apache.jackrabbit.oak.api.PropertyState propertyState)  
      protected boolean hideChild​(@NotNull java.lang.String name, @NotNull org.apache.jackrabbit.oak.spi.state.NodeState delegateChild)  
      static @NotNull org.apache.jackrabbit.oak.spi.state.NodeState wrap​(@NotNull java.lang.String path, @NotNull org.apache.jackrabbit.oak.spi.state.NodeState delegate, @Nullable java.util.Set<java.lang.String> includePaths, @Nullable java.util.Set<java.lang.String> excludePaths, @Nullable java.util.Set<java.lang.String> fragmentPaths, @Nullable java.util.Set<java.lang.String> excludedFragments, boolean referenceableFrozenNodes)
      Factory method that conditionally decorates the given node-state iff the node-state is (a) hidden itself or (b) has hidden descendants.
      • Methods inherited from class org.apache.jackrabbit.oak.spi.state.AbstractNodeState

        checkValidName, compareAgainstBaseState, comparePropertiesAgainstBaseState, count, equals, getBoolean, getBoolean, getChildNodeCount, getChildNodeNames, getLong, getLong, getName, getName, getNames, getNames, getPropertyCount, getString, getString, getStrings, getStrings, hashCode, hasProperty, isValidName, toString, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ALL

        public static final java.util.Set<java.lang.String> ALL
      • NONE

        public static final java.util.Set<java.lang.String> NONE
    • Method Detail

      • wrap

        @NotNull
        public static @NotNull org.apache.jackrabbit.oak.spi.state.NodeState wrap​(@NotNull
                                                                                  @NotNull java.lang.String path,
                                                                                  @NotNull
                                                                                  @NotNull org.apache.jackrabbit.oak.spi.state.NodeState delegate,
                                                                                  @Nullable
                                                                                  @Nullable java.util.Set<java.lang.String> includePaths,
                                                                                  @Nullable
                                                                                  @Nullable java.util.Set<java.lang.String> excludePaths,
                                                                                  @Nullable
                                                                                  @Nullable java.util.Set<java.lang.String> fragmentPaths,
                                                                                  @Nullable
                                                                                  @Nullable java.util.Set<java.lang.String> excludedFragments,
                                                                                  boolean referenceableFrozenNodes)
        Factory method that conditionally decorates the given node-state iff the node-state is (a) hidden itself or (b) has hidden descendants.
        Parameters:
        path - The path where the node-state should be assumed to be located.
        delegate - The node-state to decorate.
        includePaths - A Set of paths that should be visible. Defaults to ["/"] if null.
        excludePaths - A Set of paths that should be hidden. Empty if null.
        fragmentPaths - A Set of paths that should support the fragments (see below). Empty if null.
        excludedFragments - A Set of name fragments that should be hidden. Empty if null.
        referenceableFrozenNodes - Whether nt:frozenNode are referenceable on the target.
        Returns:
        The decorated node-state if required, the original node-state if decoration is unnecessary.
      • decorateChild

        @NotNull
        protected @NotNull org.apache.jackrabbit.oak.spi.state.NodeState decorateChild​(@NotNull
                                                                                       @NotNull java.lang.String name,
                                                                                       @NotNull
                                                                                       @NotNull org.apache.jackrabbit.oak.spi.state.NodeState child)
        Specified by:
        decorateChild in class AbstractDecoratedNodeState
      • hideChild

        protected boolean hideChild​(@NotNull
                                    @NotNull java.lang.String name,
                                    @NotNull
                                    @NotNull org.apache.jackrabbit.oak.spi.state.NodeState delegateChild)
        Overrides:
        hideChild in class AbstractDecoratedNodeState
      • decorateProperty

        protected org.apache.jackrabbit.oak.api.PropertyState decorateProperty​(@NotNull
                                                                               @NotNull org.apache.jackrabbit.oak.api.PropertyState propertyState)
        Specified by:
        decorateProperty in class AbstractDecoratedNodeState