Package com.gitblit.tickets

Examples of com.gitblit.tickets.QueryBuilder


    } else {
      activeQuery = queryParam;
    }

    // build Lucene query from defaults and request parameters
    QueryBuilder qb = new QueryBuilder(queryParam);
    if (!qb.containsField(Lucene.rid.name())) {
      // specify the repository
      qb.and(Lucene.rid.matches(getRepositoryModel().getRID()));
    }
    if (!qb.containsField(Lucene.responsible.name())) {
      // specify the responsible
      qb.and(Lucene.responsible.matches(assignedToParam));
    }
    if (!qb.containsField(Lucene.milestone.name())) {
      // specify the milestone
      qb.and(Lucene.milestone.matches(milestoneParam));
    }
    if (!qb.containsField(Lucene.status.name()) && !ArrayUtils.isEmpty(statiiParam)) {
      // specify the states
      boolean not = false;
      QueryBuilder q = new QueryBuilder();
      for (String state : statiiParam) {
        if (state.charAt(0) == '!') {
          not = true;
          q.and(Lucene.status.doesNotMatch(state.substring(1)));
        } else {
          q.or(Lucene.status.matches(state));
        }
      }
      if (not) {
        qb.and(q.toString());
      } else {
        qb.and(q.toSubquery().toString());
      }
    }
    final String luceneQuery = qb.build();

    // open milestones
View Full Code Here


    } else {
      activeQuery = queryParam;
    }

    // build Lucene query from defaults and request parameters
    QueryBuilder qb = new QueryBuilder(queryParam);
    if (!qb.containsField(Lucene.rid.name())) {
      // specify the repository
      qb.and(Lucene.rid.matches(getRepositoryModel().getRID()));
    }
    if (!qb.containsField(Lucene.responsible.name())) {
      // specify the responsible
      qb.and(Lucene.responsible.matches(assignedToParam));
    }
    if (!qb.containsField(Lucene.milestone.name())) {
      // specify the milestone
      qb.and(Lucene.milestone.matches(milestoneParam));
    }
    if (!qb.containsField(Lucene.status.name()) && !ArrayUtils.isEmpty(statiiParam)) {
      // specify the states
      boolean not = false;
      QueryBuilder q = new QueryBuilder();
      for (String state : statiiParam) {
        if (state.charAt(0) == '!') {
          not = true;
          q.and(Lucene.status.doesNotMatch(state.substring(1)));
        } else {
          q.or(Lucene.status.matches(state));
        }
      }
      if (not) {
        qb.and(q.toString());
      } else {
        qb.and(q.toSubquery().toString());
      }
    }
    final String luceneQuery = qb.build();

    // open milestones
View Full Code Here

      }
    };
    add(sortMenu);

    // Build Query here
    QueryBuilder qb = new QueryBuilder(queryParam);
    if (!qb.containsField(Lucene.status.name()) && !ArrayUtils.isEmpty(statiiParam)) {
      // specify the states
      boolean not = false;
      QueryBuilder q = new QueryBuilder();
      for (String state : statiiParam) {
        if (state.charAt(0) == '!') {
          not = true;
          q.and(Lucene.status.doesNotMatch(state.substring(1)));
        } else {
          q.or(Lucene.status.matches(state));
        }
      }
      if (not) {
        qb.and(q.toString());
      } else {
        qb.and(q.toSubquery().toString());
      }
    }

    final String luceneQuery;
    if (qb.containsField(Lucene.createdby.name())
        || qb.containsField(Lucene.responsible.name())
        || qb.containsField(Lucene.watchedby.name())) {
      // focused "my tickets" query
      luceneQuery = qb.build();
    } else {
      // general "my tickets" query
      QueryBuilder myQuery = new QueryBuilder();
      myQuery.or(Lucene.createdby.matches(username));
      myQuery.or(Lucene.responsible.matches(username));
      myQuery.or(Lucene.watchedby.matches(username));
      myQuery.and(qb.toSubquery().toString());
      luceneQuery = myQuery.build();
    }

    // paging links
    int page = (params != null) ? Math.max(1, WicketUtils.getPage(params)) : 1;
    int pageSize = app().settings().getInteger(Keys.tickets.perPage, 25);
View Full Code Here

TOP

Related Classes of com.gitblit.tickets.QueryBuilder

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.