Search in sources :

Example 1 with GitHubRepositoryList

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

the class GitHubDTOFactory method createRepositoriesList.

/**
     * Create DTO object of GitHub repositories collection from given repository
     * @param ghRepository repository from kohsuke GitHub library
     * @return DTO object
     * @throws IOException
     */
public GitHubRepositoryList createRepositoriesList(GHRepository ghRepository) throws ApiException, IOException {
    GitHubRepositoryList dtoRepositoriesList = DtoFactory.getInstance().createDto(GitHubRepositoryList.class);
    List<GitHubRepository> dtoRepositories = new ArrayList<>();
    dtoRepositories.add(createRepository(ghRepository));
    dtoRepositoriesList.setRepositories(dtoRepositories);
    return dtoRepositoriesList;
}
Also used : GitHubRepositoryList(org.eclipse.che.plugin.github.shared.GitHubRepositoryList) ArrayList(java.util.ArrayList) GitHubRepository(org.eclipse.che.plugin.github.shared.GitHubRepository)

Example 2 with GitHubRepositoryList

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

the class GitHubDTOFactory method createRepositoriesList.

/**
     * Create DTO object of GitHub repositories collection from given repositories list
     * @param ghRepositoriesList collection of repositories from kohsuke GitHub library
     * @return DTO object
     * @throws IOException
     */
public GitHubRepositoryList createRepositoriesList(PagedIterable<GHRepository> ghRepositoriesList) throws ApiException, IOException {
    GitHubRepositoryList dtoRepositoriesList = DtoFactory.getInstance().createDto(GitHubRepositoryList.class);
    List<GitHubRepository> dtoRepositories = new ArrayList<>();
    for (GHRepository ghRepository : ghRepositoriesList) {
        dtoRepositories.add(createRepository(ghRepository));
    }
    dtoRepositoriesList.setRepositories(dtoRepositories);
    return dtoRepositoriesList;
}
Also used : GHRepository(org.kohsuke.github.GHRepository) GitHubRepositoryList(org.eclipse.che.plugin.github.shared.GitHubRepositoryList) ArrayList(java.util.ArrayList) GitHubRepository(org.eclipse.che.plugin.github.shared.GitHubRepository)

Aggregations

ArrayList (java.util.ArrayList)2 GitHubRepository (org.eclipse.che.plugin.github.shared.GitHubRepository)2 GitHubRepositoryList (org.eclipse.che.plugin.github.shared.GitHubRepositoryList)2 GHRepository (org.kohsuke.github.GHRepository)1