Package com.google.gerrit.server.query.change

Examples of com.google.gerrit.server.query.change.ChangeQueryBuilder


            "Project %s cannot use group %s of type %s in notify section %s",
            project.get(), ref.getName(), group.getType(), nc.getName()));
        continue;
      }

      ChangeQueryBuilder qb = args.queryBuilder.create(new SingleGroupUser(
          args.capabilityControlFactory,
          ref.getUUID()));
      qb.setAllowFile(true);
      Predicate<ChangeData> p = qb.is_visible();
      if (nc.getFilter() != null) {
        p = Predicate.and(qb.parse(nc.getFilter()), p);
        p = args.queryRewriter.get().rewrite(p);
      }
      if (p.match(changeData)) {
        recursivelyAddAllAccounts(matching, group);
      }
    }

    if (!nc.getAddresses().isEmpty()) {
      if (nc.getFilter() != null) {
        ChangeQueryBuilder qb = args.queryBuilder.create(args.anonymousUser);
        qb.setAllowFile(true);
        Predicate<ChangeData> p = qb.parse(nc.getFilter());
        p = args.queryRewriter.get().rewrite(p);
        if (p.match(changeData)) {
          matching.emails.addAll(nc.getAddresses());
        }
      } else {
View Full Code Here


  @SuppressWarnings("unchecked")
  private void add(Watchers matching, AccountProjectWatch w)
      throws OrmException {
    IdentifiedUser user =
        args.identifiedUserFactory.create(args.db, w.getAccountId());
    ChangeQueryBuilder qb = args.queryBuilder.create(user);
    Predicate<ChangeData> p = qb.is_visible();
    if (w.getFilter() != null) {
      try {
        qb.setAllowFile(true);
        p = Predicate.and(qb.parse(w.getFilter()), p);
        p = args.queryRewriter.get().rewrite(p);
        if (p.match(changeData)) {
          matching.accounts.add(w.getAccountId());
        }
      } catch (QueryParseException e) {
View Full Code Here

  protected void doGet(final HttpServletRequest req,
      final HttpServletResponse rsp) throws IOException {
    String query = req.getPathInfo();
    HashSet<Change.Id> ids = new HashSet<Change.Id>();
    try {
      ChangeQueryBuilder builder = queryBuilder.create(currentUser.get());
      Predicate<ChangeData> visibleToMe = builder.is_visible();
      Predicate<ChangeData> q = builder.parse(query);
      q = Predicate.and(q, builder.sortkey_before("z"), builder.limit(2), visibleToMe);

      ChangeQueryRewriter rewriter = queryRewriter.get();
      Predicate<ChangeData> s = rewriter.rewrite(q);
      if (!(s instanceof ChangeDataSource)) {
        s = rewriter.rewrite(Predicate.and(builder.status_open(), q));
      }

      if (s instanceof ChangeDataSource) {
        for (ChangeData d : ((ChangeDataSource) s).read()) {
          ids.add(d.getId());
View Full Code Here

        final Project.NameKey nameKey = new Project.NameKey(projectName);
        final ProjectControl ctl = projectControlFactory.validateFor(nameKey);

        if (filter != null) {
          try {
            ChangeQueryBuilder builder = queryBuilder.create(currentUser.get());
            builder.setAllowFile(true);
            builder.parse(filter);
          } catch (QueryParseException badFilter) {
            throw new InvalidQueryException(badFilter.getMessage(), filter);
          }
        }
View Full Code Here

TOP

Related Classes of com.google.gerrit.server.query.change.ChangeQueryBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.