Search in sources :

Example 1 with GitHubPullRequestList

use of org.eclipse.che.plugin.github.shared.GitHubPullRequestList in project che by eclipse.

the class GitHubDTOFactory method createPullRequestsList.

/**
     * Create DTO object of GitHub pull-requests collection from given pull-request
     * @param ghPullRequest pull-request from kohsuke GitHub library
     * @return DTO object
     * @throws IOException
     */
public GitHubPullRequestList createPullRequestsList(GHPullRequest ghPullRequest) throws IOException {
    GitHubPullRequestList gitHubPullRequestList = DtoFactory.getInstance().createDto(GitHubPullRequestList.class);
    List<GitHubPullRequest> dtoPullRequestsList = new ArrayList<>();
    dtoPullRequestsList.add(createPullRequest(ghPullRequest));
    gitHubPullRequestList.setPullRequests(dtoPullRequestsList);
    return gitHubPullRequestList;
}
Also used : ArrayList(java.util.ArrayList) GitHubPullRequestList(org.eclipse.che.plugin.github.shared.GitHubPullRequestList) GitHubPullRequest(org.eclipse.che.plugin.github.shared.GitHubPullRequest)

Example 2 with GitHubPullRequestList

use of org.eclipse.che.plugin.github.shared.GitHubPullRequestList in project che by eclipse.

the class GitHubDTOFactory method createPullRequestsList.

/**
     * Create DTO object of GitHub pull-requests collection from given pull-requests
     * @param ghPullRequestsList collection of pull-requests from kohsuke GitHub library
     * @return DTO object
     * @throws IOException
     */
public GitHubPullRequestList createPullRequestsList(PagedIterable<GHPullRequest> ghPullRequestsList) throws IOException {
    GitHubPullRequestList gitHubPullRequestList = DtoFactory.getInstance().createDto(GitHubPullRequestList.class);
    List<GitHubPullRequest> dtoPullRequestsList = new ArrayList<>();
    for (GHPullRequest ghPullRequest : ghPullRequestsList) {
        dtoPullRequestsList.add(createPullRequest(ghPullRequest));
    }
    gitHubPullRequestList.setPullRequests(dtoPullRequestsList);
    return gitHubPullRequestList;
}
Also used : GHPullRequest(org.kohsuke.github.GHPullRequest) ArrayList(java.util.ArrayList) GitHubPullRequestList(org.eclipse.che.plugin.github.shared.GitHubPullRequestList) GitHubPullRequest(org.eclipse.che.plugin.github.shared.GitHubPullRequest)

Aggregations

ArrayList (java.util.ArrayList)2 GitHubPullRequest (org.eclipse.che.plugin.github.shared.GitHubPullRequest)2 GitHubPullRequestList (org.eclipse.che.plugin.github.shared.GitHubPullRequestList)2 GHPullRequest (org.kohsuke.github.GHPullRequest)1