public void process(Exchange exchange) throws Exception { Integer pullRequestNumber = exchange.getIn().getHeader(GitHubConstants.GITHUB_PULLREQUEST, Integer.class); java.util.List<CommitFile> response = pullRequestService.getFiles(getRepository(), pullRequestNumber); // copy the header of in message to the out message exchange.getOut().copyFrom(exchange.getIn()); exchange.getOut().setBody(response); }
@Override public List<ChangedFile> getFiles() { final List<ChangedFile> changedFiles = new ArrayList<>(); try { final List<CommitFile> files = pullRequestService.getFiles(repository, violationCommentsToGitHubApi.getPullRequestId()); for (final CommitFile commitFile : files) { final List<String> list = new ArrayList<>(); list.add(commitFile.getPatch()); changedFiles.add(new ChangedFile(commitFile.getFilename(), list)); } } catch (final IOException e) { violationsLogger.log(SEVERE, e.getMessage(), e); } return changedFiles; }