コード例 #1
0
  /**
   * @param id
   * @param model
   * @return
   */
  @RequestMapping(value = "/{id}/scm/collaborators", method = RequestMethod.GET)
  public String getCollaborators(@PathVariable Long id, Model model) {
    Application app = applicationService.findOne(id);

    // FIXME Currently assuming GitHub.
    GitHubScm scm = (GitHubScm) app.getScm();

    // TODO Would like to put this inside GitHubScm, but don't want to use Spring Social GitHub as
    // the data model
    // here since that is intended more for data transfer. We need to control the OJM/OXM here, and
    // don't want
    // changes to the Spring Social GitHub API to produce changes to our web service API. But I'm
    // not necessarily
    // excited about implementing that entire data model here. Considering options.
    List<GitHubUser> collaborators =
        gitHub.repoOperations().getCollaborators(scm.getUser(), scm.getRepo());
    List<List<GitHubUser>> collaboratorRows = ViewUtil.toRows(collaborators, 3);

    model.addAttribute(app);
    model.addAttribute("entity", app);
    model.addAttribute("collaboratorList", collaborators);
    model.addAttribute("collaboratorRows", collaboratorRows);

    return addNavigation(model, "applicationScmCollaborators");
  }
コード例 #2
0
  /**
   * @param id
   * @param model
   * @return
   */
  @RequestMapping(value = "/{id}/scm/commits", method = RequestMethod.GET)
  public String getCommits(@PathVariable Long id, Model model) {
    Application app = applicationService.findOne(id);

    // FIXME Currently assuming GitHub.
    GitHubScm scm = (GitHubScm) app.getScm();
    List<GitHubCommit> commits = gitHub.repoOperations().getCommits(scm.getUser(), scm.getRepo());

    model.addAttribute(app);
    model.addAttribute("entity", app);
    model.addAttribute("commitList", commits);

    return addNavigation(model, "applicationScmCommits");
  }
コード例 #3
0
  /**
   * @param id
   * @param model
   * @return
   */
  @RequestMapping(value = "/{id}/scm/hooks", method = RequestMethod.GET)
  public String getHooks(@PathVariable Long id, Model model) {
    Application app = applicationService.findOne(id);

    // FIXME Currently assuming GitHub.
    GitHubScm scm = (GitHubScm) app.getScm();
    String user = scm.getUser();
    String repo = scm.getRepo();
    List<GitHubHook> hooks = applicationService.findHooks(user, repo);

    model.addAttribute(app);
    model.addAttribute("hookList", hooks);
    model.addAttribute("entity", app);

    return addNavigation(model, "applicationScmHooks");
  }
コード例 #4
0
  /**
   * @param id
   * @param model
   * @return
   */
  @RequestMapping(value = "/{id}/scm/watchers", method = RequestMethod.GET)
  public String getWatchers(@PathVariable Long id, Model model) {
    Application app = applicationService.findOne(id);

    // FIXME Currently assuming GitHub.
    GitHubScm scm = (GitHubScm) app.getScm();
    String user = scm.getUser();
    String repo = scm.getRepo();
    List<GitHubUser> watchers = gitHub.repoOperations().getWatchers(user, repo);
    List<List<GitHubUser>> watcherRows = ViewUtil.toRows(watchers, 3);

    model.addAttribute(app);
    model.addAttribute("entity", app);
    model.addAttribute("watcherList", watchers);
    model.addAttribute("watcherRows", watcherRows);

    return addNavigation(model, "applicationScmWatchers");
  }