示例#1
0
 public static void changeStateToClosed() {
   List<PullRequest> rejectedPullRequests =
       PullRequest.finder.where().eq("state", State.REJECTED).findList();
   for (PullRequest rejectedPullRequest : rejectedPullRequests) {
     rejectedPullRequest.state = State.CLOSED;
     rejectedPullRequest.received = JodaDateUtil.now();
     rejectedPullRequest.update();
   }
 }
示例#2
0
  /**
   * #number가 null인 PullRequest가 있을 때 number 초기화 작업을 진행합니다.
   *
   * <p>when: Global의 onStart가 실행될 때 호출됩니다.
   */
  @Transactional
  public static void regulateNumbers() {
    int nullNumberPullRequestCount = finder.where().eq("number", null).findRowCount();

    if (nullNumberPullRequestCount > 0) {
      List<Project> projects = Project.find.all();
      for (Project project : projects) {
        List<PullRequest> pullRequests = PullRequest.findByToProject(project);
        for (PullRequest pullRequest : pullRequests) {
          if (pullRequest.number == null) {
            pullRequest.number = nextPullRequestNumber(project);
            pullRequest.update();
          }
        }
      }
    }
  }