Exemplo n.º 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();
   }
 }
Exemplo n.º 2
0
 public static PullRequest createNewPullRequest(
     Project fromProject, Project toProject, String fromBranch, String toBranch) {
   PullRequest pullRequest = new PullRequest();
   pullRequest.toProject = toProject;
   pullRequest.toBranch = toBranch;
   pullRequest.fromProject = fromProject;
   pullRequest.fromBranch = fromBranch;
   return pullRequest;
 }
Exemplo n.º 3
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();
          }
        }
      }
    }
  }