예제 #1
0
  /**
   * 프로젝트 제한을 두지 않고 전체 이슈를 대상으로 검색할 때 사용한다.
   *
   * @return ExpressionList<Issue>
   */
  public ExpressionList<Issue> asExpressionList() {
    ExpressionList<Issue> el = Issue.finder.where();

    if (assigneeId != null) {
      if (assigneeId.equals(User.anonymous.id)) {
        el.isNull("assignee");
      } else {
        el.eq("assignee.user.id", assigneeId);
      }
    }

    if (authorId != null) {
      el.eq("authorId", authorId);
    }

    if (StringUtils.isNotBlank(filter)) {
      Junction<Issue> junction = el.disjunction();
      junction.icontains("title", filter).icontains("body", filter);
      List<Object> ids = Issue.finder.where().icontains("comments.contents", filter).findIds();
      if (!ids.isEmpty()) {
        junction.idIn(ids);
      }
      junction.endJunction();
    }

    if (commentedCheck) {
      el.ge("numOfComments", AbstractPosting.NUMBER_OF_ONE_MORE_COMMENTS);
    }

    State st = State.getValue(state);
    if (st.equals(State.OPEN) || st.equals(State.CLOSED)) {
      el.eq("state", st);
    }

    if (orderBy != null) {
      el.orderBy(orderBy + " " + orderDir);
    }

    return el;
  }
예제 #2
0
파일: SiteApp.java 프로젝트: jasonseok/yobi
 /**
  * 전체 이슈 목록을 state 별로 보여준다.
  *
  * <p>when 관리자 페이지의 이슈 관리
  *
  * <p>최근작성일로 정렬된 {@code pageNum} 에 해당하는 이슈 목록을 가져온다.
  *
  * @param pageNum page number
  * @return the result
  */
 public static Result issueList(int pageNum) {
   String state = StringUtils.defaultIfBlank(request().getQueryString("state"), State.OPEN.name());
   State currentState = State.valueOf(state.toUpperCase());
   Page<Issue> page = Issue.findIssuesByState(ISSUE_COUNT_PER_PAGE, pageNum - 1, currentState);
   return ok(issueList.render("title.siteSetting", page, currentState));
 }
예제 #3
0
 public SearchCondition setState(State state) {
   this.state = state.state();
   return this;
 }
예제 #4
0
  /**
   * 특정 프로젝트를 대상으로 검색 표현식을 만든다.
   *
   * @return ExpressionList<Issue>
   */
  public ExpressionList<Issue> asExpressionList(Project project) {
    ExpressionList<Issue> el = Issue.finder.where();
    if (project != null) {
      el.eq("project.id", project.id);
    }
    if (StringUtils.isNotBlank(filter)) {
      Junction<Issue> junction = el.disjunction();
      junction.icontains("title", filter).icontains("body", filter);
      List<Object> ids = null;
      if (project == null) {
        ids = Issue.finder.where().icontains("comments.contents", filter).findIds();
      } else {
        ids =
            Issue.finder
                .where()
                .eq("project.id", project.id)
                .icontains("comments.contents", filter)
                .findIds();
      }
      if (!ids.isEmpty()) {
        junction.idIn(ids);
      }
      junction.endJunction();
    }

    if (authorId != null) {
      if (authorId.equals(User.anonymous.id)) {
        el.isNull("authorId");
      } else {
        el.eq("authorId", authorId);
      }
    }

    if (assigneeId != null) {
      if (assigneeId.equals(User.anonymous.id)) {
        el.isNull("assignee");
      } else {
        el.eq("assignee.user.id", assigneeId);
        el.eq("assignee.project.id", project.id);
      }
    }

    if (milestoneId != null) {
      if (milestoneId.equals(Milestone.NULL_MILESTONE_ID)) {
        el.isNull("milestone");
      } else {
        el.eq("milestone.id", milestoneId);
      }
    }

    if (commentedCheck) {
      el.ge("numOfComments", AbstractPosting.NUMBER_OF_ONE_MORE_COMMENTS);
    }

    State st = State.getValue(state);
    if (st.equals(State.OPEN) || st.equals(State.CLOSED)) {
      el.eq("state", st);
    }

    if (CollectionUtils.isNotEmpty(labelIds)) {
      el.add(LabelSearchUtil.createLabelSearchExpression(el.query(), labelIds));
    }

    if (orderBy != null) {
      el.orderBy(orderBy + " " + orderDir);
    }

    return el;
  }