Search in sources :

Example 1 with ChangeQueryBuilder

use of com.google.gerrit.server.query.change.ChangeQueryBuilder in project gerrit by GerritCodeReview.

the class ProjectWatch method filterMatch.

private boolean filterMatch(CurrentUser user, String filter) throws QueryParseException {
    ChangeQueryBuilder qb;
    Predicate<ChangeData> p = null;
    if (user == null) {
        qb = args.queryBuilder.get().asUser(args.anonymousUser.get());
    } else {
        qb = args.queryBuilder.get().asUser(user);
        p = qb.isVisible();
    }
    if (filter != null) {
        Predicate<ChangeData> filterPredicate = qb.parse(filter);
        if (p == null) {
            p = filterPredicate;
        } else {
            p = Predicate.and(filterPredicate, p);
        }
    }
    return p == null || p.asMatchable().match(changeData);
}
Also used : ChangeQueryBuilder(com.google.gerrit.server.query.change.ChangeQueryBuilder) ChangeData(com.google.gerrit.server.query.change.ChangeData)

Aggregations

ChangeData (com.google.gerrit.server.query.change.ChangeData)1 ChangeQueryBuilder (com.google.gerrit.server.query.change.ChangeQueryBuilder)1