public void doAction()

in github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/wizard/RepositoriesListController.java [52:88]


  public void doAction(
      IdentifiedUser user,
      GitHubLogin hubLogin,
      HttpServletRequest req,
      HttpServletResponse resp,
      ControllerErrors errors)
      throws ServletException, IOException {
    String organisation = req.getParameter("organisation");

    JsonArray jsonRepos = new JsonArray();
    int numRepos = 0;
    PagedIterator<GHRepository> repoIter = getRepositories(hubLogin, organisation).iterator();

    while (repoIter.hasNext() && numRepos < config.repositoryListLimit) {
      GHRepository ghRepository = repoIter.next();
      if (ghRepository.hasPushAccess() && ghRepository.hasPullAccess()) {
        JsonObject repository = new JsonObject();
        String projectName = organisation + "/" + ghRepository.getName();
        if (!projects.get(Project.NameKey.parse(projectName)).isPresent()) {
          repository.add("name", new JsonPrimitive(ghRepository.getName()));
          repository.add("organisation", new JsonPrimitive(organisation));
          repository.add(
              "description", new JsonPrimitive(Strings.nullToEmpty(ghRepository.getDescription())));
          repository.add("private", new JsonPrimitive(new Boolean(ghRepository.isPrivate())));
          jsonRepos.add(repository);
          numRepos++;
        }
      } else {
        log.warn(
            "Skipping repository {} because user {} has no push/pull access to it",
            ghRepository.getName(),
            user.getUserName());
      }
    }

    resp.getWriter().println(jsonRepos.toString());
  }