java.lang.Object
org.apache.jackrabbit.oak.plugins.observation.filter.FilterBuilder

public final class FilterBuilder extends Object
Builder for FilterProvider instances.
  • Constructor Details

    • FilterBuilder

      public FilterBuilder()
  • Method Details

    • setChangeSetFilter

      @NotNull public @NotNull FilterBuilder setChangeSetFilter(@NotNull @NotNull ChangeSetFilter changeSetFilter)
    • addSubTree

      @NotNull public @NotNull FilterBuilder addSubTree(@NotNull @NotNull String absPath)
      Adds a path to the set of paths whose subtrees include all events of this filter. Does nothing if the paths is already covered by an path added earlier.

      This is used for optimisation in order to restrict traversal to these sub trees.

      Parameters:
      absPath - absolute path
      Returns:
      this instance
    • addPathsForMBean

      public FilterBuilder addPathsForMBean(@NotNull @NotNull Set<String> paths)
      Adds paths to the FilterConfigMBean's getPaths set
      Parameters:
      paths -
      Returns:
    • aggregator

      public FilterBuilder aggregator(EventAggregator aggregator)
    • includeSessionLocal

      @NotNull public @NotNull FilterBuilder includeSessionLocal(boolean include)
      Whether to include session local changes. Defaults to false.
      Parameters:
      include - if true session local changes are included, otherwise session local changes are not included.
      Returns:
      this instance
    • includeClusterExternal

      @NotNull public @NotNull FilterBuilder includeClusterExternal(boolean include)
      Whether to include cluster external changes. Defaults to false.
      Parameters:
      include - if true cluster external changes are included, otherwise cluster external changes are not included.
      Returns:
      this instance
    • includeClusterLocal

      @NotNull public @NotNull FilterBuilder includeClusterLocal(boolean include)
      Whether to include cluster local changes. Defaults to true.
      Parameters:
      include - if true cluster local changes are included, otherwise cluster local changes are not included.
      Returns:
      this instance
    • condition

      @NotNull public @NotNull FilterBuilder condition(@NotNull @NotNull FilterBuilder.Condition condition)
      Set the condition of this filter. Conditions are obtained from the various methods on this instance that return a Condition instance.
      Parameters:
      condition - the conditions to apply
      Returns:
      this instance
    • includeAll

      @NotNull public @NotNull FilterBuilder.Condition includeAll()
      A condition the always holds
      Returns:
      true condition
    • excludeAll

      @NotNull public @NotNull FilterBuilder.Condition excludeAll()
      A condition that never holds
      Returns:
      false condition
    • accessControl

      @NotNull public @NotNull FilterBuilder.Condition accessControl(@NotNull @NotNull PermissionProviderFactory permissionProviderFactory)
      A condition that hold for accessible items as determined by the passed permission provider.
      Parameters:
      permissionProviderFactory - permission provider for checking whether an item is accessible.
      Returns:
      access control condition
      See Also:
    • path

      @NotNull public @NotNull FilterBuilder.Condition path(@NotNull @NotNull String pathPattern)
      A condition that holds on the paths matching a certain pattern.
      Parameters:
      pathPattern -
      Returns:
      path condition
      See Also:
    • eventType

      @NotNull public @NotNull FilterBuilder.Condition eventType(int eventTypes)
      A condition that holds for matching event types.
      Parameters:
      eventTypes -
      Returns:
      event type condition
      See Also:
    • nodeType

      @NotNull public @NotNull FilterBuilder.Condition nodeType(@NotNull @NotNull UniversalFilter.Selector selector, @Nullable @Nullable String[] ntNames)
      A condition that holds for matching node types.
      Parameters:
      selector - selector selecting the node to check the condition on
      ntNames - node type names to match. This conditions never matches if null and always matches if empty.
      Returns:
      node type condition
    • uuid

      @NotNull public @NotNull FilterBuilder.Condition uuid(@NotNull @NotNull UniversalFilter.Selector selector, @Nullable @Nullable String[] uuids)
      A condition that holds for matching uuids.
      Parameters:
      selector - selector selecting the node to check the condition on
      uuids - uuids to match. This conditions never matches if null and always matches if empty.
      Returns:
      node type condition
    • property

      @NotNull public @NotNull FilterBuilder.Condition property(@NotNull @NotNull UniversalFilter.Selector selector, @NotNull @NotNull String name, @NotNull @NotNull Predicate<PropertyState> predicate)
      A condition that holds when the property predicate matches.
      Parameters:
      selector - selector selecting the node to check the condition on
      name - the name of the property to check the predicate on
      predicate - the predicate to check on the named property
      Returns:
      property condition
    • universal

      @NotNull public @NotNull FilterBuilder.Condition universal(@NotNull @NotNull UniversalFilter.Selector selector, @NotNull @NotNull Predicate<NodeState> predicate)
      A condition that holds when the predicate matches.
      Parameters:
      selector - selector selecting the node to check the condition on
      predicate - the predicate to check on the selected node
      Returns:
      universal condition
    • addSubtree

      @NotNull public @NotNull FilterBuilder.Condition addSubtree()
      Returns:
      a condition that holds for children of added nodes.
    • deleteSubtree

      @NotNull public @NotNull FilterBuilder.Condition deleteSubtree()
      Returns:
      a condition that holds for children of deleted nodes.
    • moveSubtree

      @NotNull public @NotNull FilterBuilder.Condition moveSubtree()
      Returns:
      a condition that holds for children of the target of a moved node
    • any

      @NotNull public @NotNull FilterBuilder.Condition any(@NotNull @NotNull FilterBuilder.Condition... conditions)
      A compound condition that holds when any of its constituents hold.
      Parameters:
      conditions - conditions of which any must hold in order for this condition to hold
      Returns:
      any condition
    • all

      @NotNull public @NotNull FilterBuilder.Condition all(@NotNull @NotNull FilterBuilder.Condition... conditions)
      A compound condition that holds when all of its constituents hold.
      Parameters:
      conditions - conditions of which all must hold in order for this condition to hold
      Returns:
      any condition
    • all

      @NotNull public @NotNull FilterBuilder.Condition all(@NotNull @NotNull List<FilterBuilder.Condition> conditions)
      A compound condition that holds when all of its constituents hold.
      Parameters:
      conditions - conditions of which all must hold in order for this condition to hold
      Returns:
      any condition
    • not

      @NotNull public @NotNull FilterBuilder.Condition not(@NotNull @NotNull FilterBuilder.Condition condition)
      A compound condition that holds when its constituent does not hold.
      Parameters:
      condition - condition which must not hold in order for this condition to hold
      Returns:
      not condition
    • any

      @NotNull public @NotNull FilterBuilder.Condition any(@NotNull @NotNull Iterable<FilterBuilder.Condition> conditions)
      A compound condition that holds when any of its constituents hold.
      Parameters:
      conditions - conditions of which any must hold in order for this condition to hold
      Returns:
      any condition
    • all

      @NotNull public @NotNull FilterBuilder.Condition all(@NotNull @NotNull Iterable<FilterBuilder.Condition> conditions)
      A compound condition that holds when all of its constituents hold.
      Parameters:
      conditions - conditions of which all must hold in order for this condition to hold
      Returns:
      any condition
    • build

      @NotNull public @NotNull FilterProvider build()
      Create a FilterProvider reflecting the current state of this builder.
      Returns:
      filter provider of the current state of this builder