use of org.eclipse.che.plugin.github.shared.GitHubPullRequest 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;
}
use of org.eclipse.che.plugin.github.shared.GitHubPullRequest in project che by eclipse.
the class GitHubDTOFactory method createPullRequest.
/**
* Create DTO object of GitHub pull-request from given pull-request
* @param ghPullRequest pull-request from kohsuke GitHub library
* @return DTO object
* @throws IOException
*/
public GitHubPullRequest createPullRequest(GHPullRequest ghPullRequest) throws IOException {
GitHubPullRequest dtoPullRequest = DtoFactory.getInstance().createDto(GitHubPullRequest.class);
dtoPullRequest.setId(String.valueOf(ghPullRequest.getId()));
dtoPullRequest.setUrl(String.valueOf(ghPullRequest.getUrl()));
dtoPullRequest.setHtmlUrl(String.valueOf(ghPullRequest.getHtmlUrl()));
dtoPullRequest.setNumber(String.valueOf(ghPullRequest.getNumber()));
dtoPullRequest.setState(ghPullRequest.getState().toString());
dtoPullRequest.setHead(createPullRequestHead(ghPullRequest.getHead()));
dtoPullRequest.setMerged(ghPullRequest.isMerged());
dtoPullRequest.setBody(ghPullRequest.getBody());
dtoPullRequest.setTitle(ghPullRequest.getTitle());
if (ghPullRequest.getMergedBy() != null) {
dtoPullRequest.setMergedBy(createUser(ghPullRequest.getMergedBy()));
}
if (ghPullRequest.getMergeable() != null) {
dtoPullRequest.setMergeable(ghPullRequest.getMergeable());
}
return dtoPullRequest;
}
use of org.eclipse.che.plugin.github.shared.GitHubPullRequest 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;
}
Aggregations