예제 #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
 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;
 }
예제 #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();
          }
        }
      }
    }
  }
예제 #4
0
파일: UserApp.java 프로젝트: bluemir/hive
 private static void collectDatum(
     List<Project> projects,
     List<Posting> postings,
     List<Issue> issues,
     List<PullRequest> pullRequests,
     List<Milestone> milestones,
     int daysAgo) {
   // collect all postings, issues, pullrequests and milesotnes that are contained in the projects.
   for (Project project : projects) {
     if (AccessControl.isAllowed(UserApp.currentUser(), project.asResource(), Operation.READ)) {
       postings.addAll(Posting.findRecentlyCreatedByDaysAgo(project, daysAgo));
       issues.addAll(Issue.findRecentlyOpendIssuesByDaysAgo(project, daysAgo));
       pullRequests.addAll(PullRequest.findOpendPullRequestsByDaysAgo(project, daysAgo));
       milestones.addAll(Milestone.findOpenMilestones(project.id));
     }
   }
 }