OakEventFilterImpl extends OakEventFilter { static void addAncestorPaths(Set<String> ancestorPaths, String globPath) { if (globPath == null || !globPath.contains("/")) { return; } Iterator<String> it = PathUtils.elements(globPath).iterator(); StringBuffer sb = new StringBuffer(); while(it.hasNext()) { String element = it.next(); sb.append("/"); sb.append(element); ancestorPaths.add(sb.toString()); if (element.equals("**")) { break; } } } OakEventFilterImpl(@NotNull JackrabbitEventFilter delegate); @Override String getAbsPath(); @Override JackrabbitEventFilter setAbsPath(String absPath); @Override String[] getAdditionalPaths(); @Override JackrabbitEventFilter setAdditionalPaths(String... absPaths); @Override int getEventTypes(); @Override JackrabbitEventFilter setEventTypes(int eventTypes); @Override String[] getExcludedPaths(); @Override JackrabbitEventFilter setExcludedPaths(String... excludedPaths); @Override String[] getIdentifiers(); @Override JackrabbitEventFilter setIdentifiers(String[] identifiers); @Override boolean getIsDeep(); @Override JackrabbitEventFilter setIsDeep(boolean isDeep); @Override String[] getNodeTypes(); @Override JackrabbitEventFilter setNodeTypes(String[] nodeTypeNames); @Override boolean getNoExternal(); @Override JackrabbitEventFilter setNoExternal(boolean noExternal); @Override boolean getNoInternal(); @Override JackrabbitEventFilter setNoInternal(boolean noInternal); @Override boolean getNoLocal(); @Override JackrabbitEventFilter setNoLocal(boolean noLocal); @Override OakEventFilter withApplyNodeTypeOnSelf(); @Override OakEventFilter withIncludeAncestorsRemove(); Condition wrapMainCondition(Condition mainCondition, FilterBuilder filterBuilder, PermissionProviderFactory permissionProviderFactory); @Override OakEventFilter withIncludeSubtreeOnRemove(); @Override OakEventFilter withIncludeGlobPaths(String... globPaths); FilterBuilder builder(); OakEventFilterImpl aggregator(EventAggregator aggregator); Condition getAdditionalIncludeConditions(Set<String> includePaths); EventAggregator getAggregator(); @Override OakEventFilter withNodeTypeAggregate(String[] nodeTypes, String[] relativeGlobPaths);  }
@Test public void testAddAncestorPaths() throws Exception { assertMatches(new String[] {}, "/"); assertMatches(new String[] {"d"); assertMatches(new String[] {"/a", "/a/b", "/a/bddf"); assertMatches(new String[] {"/a", "/a/b", "/a/b/c", "/a/b/c/d"}, "/a/b/c/d"); assertMatches(new String[] {"/a", "/a/b", "/a/b/c", "/a/b/c/*"}, "/a/b/c/*"); assertMatches(new String[] {"/a", "/a/b", "/a/b/c", "/a/b/c/**"}, "/a/b/c/**"); }