public void addToLeaders(Scoring scoring, List<Leader> Leaders, PullRequest pullRequest) { PageRequest pageRequest = new PageRequestImpl(0, 100); while (pageRequest != null) { Page<? extends PullRequestActivity> activityPage = null; Iterator<? extends PullRequestActivity> activityPageI = null; try { activityPage = pullRequestService.getActivities( pullRequest.getToRef().getRepository().getId(), pullRequest.getId(), pageRequest); activityPageI = activityPage.getValues().iterator(); while (activityPageI.hasNext()) { PullRequestActivity prActivity = activityPageI.next(); ApplicationUser user = prActivity.getUser(); addNewLeader( scoring, Leaders, pullRequest, user.getSlug(), user.getDisplayName(), prActivity.getAction(), prActivity.getCreatedDate()); } pageRequest = activityPage.getNextPageRequest(); } catch (NoSuchEntityException e) { pageRequest = null; } } }
public long getPullRequestCount(Repository repository) { return pullRequestService.count( new PullRequestSearchRequest.Builder() .fromRepositoryId(repository.getId()) .state(PullRequestState.DECLINED) .build()) + pullRequestService.count( new PullRequestSearchRequest.Builder() .fromRepositoryId(repository.getId()) .state(PullRequestState.MERGED) .build()) + pullRequestService.count( new PullRequestSearchRequest.Builder() .fromRepositoryId(repository.getId()) .state(PullRequestState.OPEN) .build()); }
public PageRequest getAllPullRequests( Scoring scoring, List<Leader> Leaders, Repository repository, PageRequest pageRequest) { Page<PullRequest> prPage = pullRequestService.search( new PullRequestSearchRequest.Builder().toRepositoryId(repository.getId()).build(), pageRequest); Iterator<PullRequest> prPageI = prPage.getValues().iterator(); while (prPageI.hasNext()) { PullRequest pr = prPageI.next(); addToLeaders(scoring, Leaders, pr); } return prPage.getNextPageRequest(); }