use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class ExportController method exportAllEntryProteinExistencess.
@RequestMapping(value = "/export/entry/all/protein-existences", method = { RequestMethod.GET }, produces = { NextprotMediaType.TSV_MEDIATYPE_VALUE })
public void exportAllEntryProteinExistencess(HttpServletResponse response) {
try {
EntryProteinExistenceReportWriter writer = new EntryProteinExistenceReportTSVWriter(response.getOutputStream());
masterIdentifierService.findUniqueNames().forEach(entryAccession -> writer.write(entryAccession, overviewService.findOverviewByEntry(entryAccession).getProteinExistences()));
writer.close();
} catch (IOException e) {
throw new NextProtException("cannot export all entries in TSV format", e);
}
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class GitHubServiceImpl method getTree.
@Override
@Cacheable(value = "github-tree")
public GHTree getTree() {
try {
GitHub github = getGitHubConnection();
GHRepository repo = github.getRepository("calipho-sib/nextprot-docs");
return repo.getTreeRecursive(githubDocBranch, 1);
} catch (IOException e) {
e.printStackTrace();
throw new NextProtException("Documentation not available, sorry for the inconvenience");
}
}
use of org.nextprot.api.commons.exception.NextProtException in project nextprot-api by calipho-sib.
the class GitHubServiceImpl method getPage.
@Override
@Cacheable(value = "github-pages")
public String getPage(String folder, String page) {
String finalPage = page;
if ("news".equalsIgnoreCase(folder)) {
finalPage = getCorrespondingPageForNews(page);
}
try {
GitHub github = getGitHubConnection();
GHRepository repo = github.getRepository("calipho-sib/nextprot-docs");
GHContent content = null;
String extension = ".md";
if (folder.contains("json")) {
// if folder contains json
extension = ".json";
}
content = repo.getFileContent(folder + "/" + finalPage + extension, githubDocBranch);
return content.getContent();
} catch (IOException e) {
e.printStackTrace();
throw new NextProtException("Documentation not available, sorry for the inconvenience");
}
}
Aggregations