return new StreamingOutput() {
@Override
public void write(OutputStream stream) throws IOException, WebApplicationException {
final AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterResourceOnly(true);
criteria.fetchGroupAlertDefinition(true);
criteria.fetchResource(true);
// TODO figure out why resourceType is not getting fetched
// The resource type id is needed for the parent url when we have a
// template alert definition. I previously tried accessing the resource