@Test public void testFindNodesNonExact() throws Exception { Value vs = valueFactory.createValue("value \\, containing backslash"); user.setProperty(propertyName, vs); root.commit(); Iterator<Authorizable> result = queryMgr.findAuthorizables(propertyName, "value \\, containing backslash", AuthorizableType.USER, false); assertResultContainsAuthorizables(result, user); }
@NotNull public Iterator<Authorizable> findAuthorizables(@NotNull Query query) throws RepositoryException { XPathQueryBuilder builder = new XPathQueryBuilder(); query.build(builder); if (builder.getMaxCount() == 0) { return Collections.emptyIterator(); } String statement = buildXPathStatement(builder); final String groupId = builder.getGroupID(); if (groupId == null || isEveryone(groupId)) { long offset = builder.getOffset(); Iterator<Authorizable> result = findAuthorizables(statement, builder.getMaxCount(), offset, null); if (groupId == null) { return result; } else { return Iterators.filter(result, authorizable -> !groupId.equals(getID(authorizable))); } } else { Iterator<Authorizable> result = findAuthorizables(statement, Long.MAX_VALUE, 0, null); Predicate<Authorizable> filter; if (builder.isDeclaredMembersOnly()) { filter = new DeclaredMembershipPredicate(userManager, groupId); } else { filter = new GroupPredicate(userManager, groupId, false); } return ResultIterator.create(builder.getOffset(), builder.getMaxCount(), Iterators.filter(result, filter)); } }
UserQueryManager { @NotNull public Iterator<Authorizable> findAuthorizables(@NotNull Query query) throws RepositoryException { XPathQueryBuilder builder = new XPathQueryBuilder(); query.build(builder); if (builder.getMaxCount() == 0) { return Collections.emptyIterator(); } String statement = buildXPathStatement(builder); final String groupId = builder.getGroupID(); if (groupId == null || isEveryone(groupId)) { long offset = builder.getOffset(); Iterator<Authorizable> result = findAuthorizables(statement, builder.getMaxCount(), offset, null); if (groupId == null) { return result; } else { return Iterators.filter(result, authorizable -> !groupId.equals(getID(authorizable))); } } else { Iterator<Authorizable> result = findAuthorizables(statement, Long.MAX_VALUE, 0, null); Predicate<Authorizable> filter; if (builder.isDeclaredMembersOnly()) { filter = new DeclaredMembershipPredicate(userManager, groupId); } else { filter = new GroupPredicate(userManager, groupId, false); } return ResultIterator.create(builder.getOffset(), builder.getMaxCount(), Iterators.filter(result, filter)); } } }
UserQueryManager { @NotNull public Iterator<Authorizable> findAuthorizables(@NotNull Query query) throws RepositoryException { XPathQueryBuilder builder = new XPathQueryBuilder(); query.build(builder); if (builder.getMaxCount() == 0) { return Collections.emptyIterator(); } String statement = buildXPathStatement(builder); final String groupId = builder.getGroupID(); if (groupId == null || isEveryone(groupId)) { long offset = builder.getOffset(); Iterator<Authorizable> result = findAuthorizables(statement, builder.getMaxCount(), offset, null); if (groupId == null) { return result; } else { return Iterators.filter(result, authorizable -> !groupId.equals(getID(authorizable))); } } else { Iterator<Authorizable> result = findAuthorizables(statement, Long.MAX_VALUE, 0, null); Predicate<Authorizable> filter; if (builder.isDeclaredMembersOnly()) { filter = new DeclaredMembershipPredicate(userManager, groupId); } else { filter = new GroupPredicate(userManager, groupId, false); } return ResultIterator.create(builder.getOffset(), builder.getMaxCount(), Iterators.filter(result, filter)); } } UserQueryManager(@NotNull UserManagerImpl userManager,
                            @NotNull NamePathMapper namePathMapper,
                            @NotNull ConfigurationParameters config,
                            @NotNull Root root); }
UserQueryManager { @NotNull public Iterator<Authorizable> findAuthorizables(@NotNull Query query) throws RepositoryException { XPathQueryBuilder builder = new XPathQueryBuilder(); query.build(builder); if (builder.getMaxCount() == 0) { return Collections.emptyIterator(); } String statement = buildXPathStatement(builder); final String groupId = builder.getGroupID(); if (groupId == null || isEveryone(groupId)) { long offset = builder.getOffset(); Iterator<Authorizable> result = findAuthorizables(statement, builder.getMaxCount(), offset, null); if (groupId == null) { return result; } else { return Iterators.filter(result, authorizable -> !groupId.equals(getID(authorizable))); } } else { Iterator<Authorizable> result = findAuthorizables(statement, Long.MAX_VALUE, 0, null); Predicate<Authorizable> filter; if (builder.isDeclaredMembersOnly()) { filter = new DeclaredMembershipPredicate(userManager, groupId); } else { filter = new GroupPredicate(userManager, groupId, false); } return ResultIterator.create(builder.getOffset(), builder.getMaxCount(), Iterators.filter(result, filter)); } } UserQueryManager(@NotNull UserManagerImpl userManager,
                            @NotNull NamePathMapper namePathMapper,
                            @NotNull ConfigurationParameters config,
                            @NotNull Root root); @NotNull Iterator<Authorizable> findAuthorizables(@NotNull Query query); @NotNull Iterator<Authorizable> findAuthorizables(@NotNull String relPath,
                                                    @Nullable String value,
                                                    @NotNull AuthorizableType authorizableType); @NotNull Iterator<Authorizable> findAuthorizables(@NotNull String relPath,
                                                    @Nullable String value,
                                                    @NotNull AuthorizableType authorizableType,
                                                    boolean exact); }
UserQueryManager { @NotNull public Iterator<Authorizable> findAuthorizables(@NotNull Query query) throws RepositoryException { XPathQueryBuilder builder = new XPathQueryBuilder(); query.build(builder); if (builder.getMaxCount() == 0) { return Collections.emptyIterator(); } String statement = buildXPathStatement(builder); final String groupId = builder.getGroupID(); if (groupId == null || isEveryone(groupId)) { long offset = builder.getOffset(); Iterator<Authorizable> result = findAuthorizables(statement, builder.getMaxCount(), offset, null); if (groupId == null) { return result; } else { return Iterators.filter(result, authorizable -> !groupId.equals(getID(authorizable))); } } else { Iterator<Authorizable> result = findAuthorizables(statement, Long.MAX_VALUE, 0, null); Predicate<Authorizable> filter; if (builder.isDeclaredMembersOnly()) { filter = new DeclaredMembershipPredicate(userManager, groupId); } else { filter = new GroupPredicate(userManager, groupId, false); } return ResultIterator.create(builder.getOffset(), builder.getMaxCount(), Iterators.filter(result, filter)); } } UserQueryManager(@NotNull UserManagerImpl userManager,
                            @NotNull NamePathMapper namePathMapper,
                            @NotNull ConfigurationParameters config,
                            @NotNull Root root); @NotNull Iterator<Authorizable> findAuthorizables(@NotNull Query query); @NotNull Iterator<Authorizable> findAuthorizables(@NotNull String relPath,
                                                    @Nullable String value,
                                                    @NotNull AuthorizableType authorizableType); @NotNull Iterator<Authorizable> findAuthorizables(@NotNull String relPath,
                                                    @Nullable String value,
                                                    @NotNull AuthorizableType authorizableType,
                                                    boolean exact);  }