示例#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
文件: Global.java 项目: hyuni/yobi
  @Override
  public void onStart(Application app) {
    isSecretInvalid = equalsDefaultSecret();
    insertInitialData();

    PullRequest.onStart();
    NotificationMail.onStart();
    NotificationEvent.onStart();
    Attachment.onStart();
  }
示例#5
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));
     }
   }
 }