use of org.nextprot.api.core.service.export.io.SlimIsoformTSVWriter in project nextprot-api by calipho-sib.
the class EntryController method getListOfIsoformAcMd5Sequence.
@ApiMethod(path = "/isoforms", verb = ApiVerb.GET, description = "Retrieves all isoforms", produces = { MediaType.APPLICATION_JSON_VALUE, NextprotMediaType.TSV_MEDIATYPE_VALUE })
@RequestMapping(value = "/isoforms", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE, NextprotMediaType.TSV_MEDIATYPE_VALUE })
public void getListOfIsoformAcMd5Sequence(HttpServletRequest request, HttpServletResponse response) {
NextprotMediaType mediaType = NextprotMediaType.valueOf(request);
try {
List<SlimIsoform> isoforms = isoformService.findListOfIsoformAcMd5Sequence();
if (mediaType == NextprotMediaType.JSON) {
JSONObjectsWriter<SlimIsoform> writer = new JSONObjectsWriter<>(response.getOutputStream());
writer.write(isoforms);
} else if (mediaType == NextprotMediaType.TSV) {
SlimIsoformTSVWriter writer = new SlimIsoformTSVWriter(response.getOutputStream());
writer.write(isoforms);
writer.close();
}
} catch (IOException e) {
throw new NextProtException("cannot get isoforms in " + mediaType.getExtension() + " format", e);
}
}
Aggregations