class MergeRequestRest {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed("user")
    @ApiOperation("Retrieves all MergeRequests in the application")
    public Response getMergeRequests(@QueryParam("sort") String sort,
                              @DefaultValue("false") @QueryParam("ascending") boolean asc,
                              @DefaultValue("false") @QueryParam("accepted") boolean accepted) {
        MergeRequestFilterParams.Builder builder = new MergeRequestFilterParams.Builder();
        if (!StringUtils.isEmpty(sort)) {
            builder.setSortBy(createIRI(sort, vf));
        }
        builder.setAscending(asc).setAccepted(accepted);
        try {
            JSONArray result = JSONArray.fromObject(manager.getMergeRequests(builder.build()).stream()
                    .map(request -> modelToJsonld(request.getModel(), transformer))
                    .map(RestUtils::getObjectFromJsonld)
                    .collect(Collectors.toList()));
            return Response.ok(result).build();
        } catch (IllegalStateException | MobiException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
        }
    }

}