use of com.adobe.acs.commons.mcp.model.GenericReport in project acs-aem-commons by Adobe-Consulting-Services.
the class PageRelocator method storeReport.
@Override
public void storeReport(ProcessInstance instance, ResourceResolver rr) throws RepositoryException, PersistenceException {
GenericReport report = new GenericReport();
report.setRows(reportData, "Source", Report.class);
report.persist(rr, instance.getPath() + "/jcr:content/report");
}
use of com.adobe.acs.commons.mcp.model.GenericReport in project acs-aem-commons by Adobe-Consulting-Services.
the class GenericReportExcelServlet method doGet.
@Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
GenericReport report = request.getResource().adaptTo(GenericReport.class);
if (report != null) {
String title = report.getName();
String fileName = JcrUtil.createValidName(title) + ".xlsx";
Workbook workbook = createSpreadsheet(report);
response.setContentType("application/vnd.ms-excel");
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma", "public");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
try (ServletOutputStream out = response.getOutputStream()) {
workbook.write(out);
out.flush();
} catch (Exception ex) {
LOG.error("Error generating excel export for " + request.getResource().getPath(), ex);
throw ex;
}
} else {
LOG.error("Unable to process report stored at " + request.getResource().getPath());
throw new ServletException("Unable to process report stored at " + request.getResource().getPath());
}
}
use of com.adobe.acs.commons.mcp.model.GenericReport in project acs-aem-commons by Adobe-Consulting-Services.
the class BrokenLinksReport method storeReport.
@Override
public void storeReport(ProcessInstance instance, ResourceResolver rr) throws RepositoryException, PersistenceException {
GenericReport genericReport = new GenericReport();
genericReport.setRows(reportData, "Source", Report.class);
genericReport.persist(rr, instance.getPath() + "/jcr:content/report");
}
Aggregations