/** * @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"); }
/** * @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"); }