class MergeRequestRest {

    @GET
    @Path("{requestId}/comments")
    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed("user")
    @ApiOperation("Retrieves all Comment threads on a MergeRequest")
    public Response getComments(@PathParam("requestId") String requestId) {
        Resource requestIdResource = createIRI(requestId, vf);
        try {
            List<List<JSONObject>> commentsJson = manager.getComments(requestIdResource).stream().map(
                    commentChain -> commentChain.stream()
                            .map(comment -> getObjectFromJsonld(groupedModelToString(comment.getModel(),
                                    getRDFFormat("jsonld"), transformer)))
                            .collect(Collectors.toList())).collect(Collectors.toList());
            return Response.ok(commentsJson).build();
        } catch (IllegalArgumentException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.BAD_REQUEST);
        } catch (IllegalStateException | MobiException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
        }
    }

}