use of org.jsondoc.core.annotation.ApiMethod in project nextprot-api by calipho-sib.
the class ChromosomeReportController method exportChromosomeEntryWithUnconfirmedMsData.
@ApiMethod(path = "/chromosome-report/export/hpp/unconfirmed-ms-data-entries", verb = ApiVerb.GET, description = "Export list of unconfirmed MS data protein entries", produces = { MediaType.TEXT_PLAIN_VALUE })
@RequestMapping(value = "/chromosome-report/export/hpp/unconfirmed-ms-data-entries", method = { RequestMethod.GET })
public void exportChromosomeEntryWithUnconfirmedMsData(HttpServletResponse response) {
try (OutputStream os = response.getOutputStream()) {
response.setHeader("Content-Disposition", "attachment; filename=\"HPP_entries_with_unconfirmed_MS_data.txt\"");
chromosomeReportExportService.exportUnconfirmedMsEntries(os);
} catch (IOException e) {
throw new NextProtException(e.getMessage() + ": cannot export unconfirmed MS data protein entries");
}
}
use of org.jsondoc.core.annotation.ApiMethod in project nextprot-api by calipho-sib.
the class ChromosomeReportController method exportChromosomeEntryWithNAcetyl.
@ApiMethod(path = "/chromosome-report/export/hpp/nacetylated-entries", verb = ApiVerb.GET, description = "Export list of N-acetylated protein entries", produces = { NextprotMediaType.TSV_MEDIATYPE_VALUE })
@RequestMapping(value = "/chromosome-report/export/hpp/nacetylated-entries", method = { RequestMethod.GET })
public void exportChromosomeEntryWithNAcetyl(HttpServletResponse response) {
try (OutputStream os = response.getOutputStream()) {
response.setHeader("Content-Disposition", "attachment; filename=\"HPP_entries_with_nacetyl_by_chromosome.tsv\"");
chromosomeReportExportService.exportNAcetylatedEntries(os);
} catch (IOException e) {
throw new NextProtException(e.getMessage() + ": cannot export N-acetylated protein entries");
}
}
use of org.jsondoc.core.annotation.ApiMethod in project nextprot-api by calipho-sib.
the class ChromosomeReportController method exportChromosomeEntryWithPhospho.
@ApiMethod(path = "/chromosome-report/export/hpp/phosphorylated-entries", verb = ApiVerb.GET, description = "Export list of phosphorylated protein entries", produces = { NextprotMediaType.TSV_MEDIATYPE_VALUE })
@RequestMapping(value = "/chromosome-report/export/hpp/phosphorylated-entries", method = { RequestMethod.GET })
public void exportChromosomeEntryWithPhospho(HttpServletResponse response) {
try (OutputStream os = response.getOutputStream()) {
response.setHeader("Content-Disposition", "attachment; filename=\"HPP_entries_with_phospho_by_chromosome.tsv\"");
chromosomeReportExportService.exportPhosphorylatedEntries(os);
} catch (IOException e) {
throw new NextProtException(e.getMessage() + ": cannot export phosphorylated protein entries");
}
}
use of org.jsondoc.core.annotation.ApiMethod in project nextprot-api by calipho-sib.
the class ChromosomeReportController method exportChromosomeEntriesReportFile.
@ApiMethod(path = "/chromosome-report/export/{chromosome}", verb = ApiVerb.GET, description = "Export informations of neXtProt entries located on a given chromosome", produces = { MediaType.TEXT_PLAIN_VALUE, NextprotMediaType.TSV_MEDIATYPE_VALUE })
@RequestMapping(value = "/chromosome-report/export/{chromosome}", method = { RequestMethod.GET })
public void exportChromosomeEntriesReportFile(@ApiPathParam(name = "chromosome", description = "The chromosome number or name (X,Y..)", allowedvalues = { "Y" }) @PathVariable("chromosome") String chromosome, HttpServletRequest request, HttpServletResponse response) {
NextprotMediaType mediaType = NextprotMediaType.valueOf(request);
try (OutputStream os = response.getOutputStream()) {
String filename = "nextprot_chromosome_" + chromosome + "." + mediaType.getExtension();
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
chromosomeReportExportService.exportChromosomeEntryReport(chromosome, NextprotMediaType.valueOf(request), os);
} catch (IOException e) {
throw new NextProtException(e.getMessage() + ": cannot export chromosome " + chromosome + " as " + mediaType);
}
}
use of org.jsondoc.core.annotation.ApiMethod in project nextprot-api by calipho-sib.
the class UserQueryController method updateAdvancedQuery.
// UPDATE
@ApiMethod(path = "/user/me/queries/{id}", verb = ApiVerb.PUT, description = "Updates an advanced query for the current logged user", produces = { MediaType.APPLICATION_JSON_VALUE }, consumes = { MediaType.APPLICATION_JSON_VALUE })
@RequestMapping(value = "/user/me/queries/{id}", method = { RequestMethod.PUT })
@ResponseBody
public UserQuery updateAdvancedQuery(@PathVariable("id") String id, @RequestBody UserQuery advancedUserQuery, Model model) {
// Never trust what the users sends to you! Set the correct username, so it will be verified by the service,
// TODO Is this done on the aspect
UserQuery q = userQueryService.getUserQueryById(advancedUserQuery.getUserQueryId());
advancedUserQuery.setOwner(q.getOwner());
advancedUserQuery.setOwnerId(q.getOwnerId());
return userQueryService.updateUserQuery(advancedUserQuery);
}
Aggregations