List<ReportItem> reportItems = ((ReportQuery) dbQuery).getItems();
List<Object[]> queryResults = query.getResultList();
if ((queryResults != null) && (!queryResults.isEmpty())) {
Object list = responseBuilder.buildReportQueryResponse(context, queryParams, queryResults, reportItems, uriInfo);
if (list != null) {
return Response.ok(new StreamingOutputMarshaller(context, list, headers.getAcceptableMediaTypes())).build();
} else {
// something is wrong with the descriptors
throw JPARSException.responseCouldNotBeBuiltForNamedQueryRequest(queryName, context.getName());
}
}
return Response.ok(new StreamingOutputMarshaller(context, queryResults, headers.getAcceptableMediaTypes())).build();
}
List<Object> results = query.getResultList();
if ((results != null) && (!results.isEmpty())) {
Object list = responseBuilder.buildReadAllQueryResponse(context, queryParams, results, uriInfo);
return Response.ok(new StreamingOutputMarshaller(context, list, headers.getAcceptableMediaTypes())).build();
}
return Response.ok(new StreamingOutputMarshaller(context, results, headers.getAcceptableMediaTypes())).build();
}