String templateContent = templateBuilder.buildTemplate();
logger.debug(templateContent);
try {
reportFile = File.createTempFile("report", ".rpt");
} catch (IOException ioe) {
throw new SpagoBIEngineException("Impossible to create a temporary file to store the template generated on the fly", ioe);
}
JasperReportRunner runner = new JasperReportRunner();
JRSpagoBIDataStoreDataSource dataSource = new JRSpagoBIDataStoreDataSource( dataStore );
Locale locale = this.getLocale();
try {
runner.run( templateContent, reportFile, mimeType, dataSource, locale);
} catch (Exception e) {
throw new SpagoBIEngineException("Impossible compile or to export the report", e);
}
writeBackResponseInline = RESPONSE_TYPE_INLINE.equalsIgnoreCase(responseType);
//fileExtension = MimeUtils.getFileExtension( mimeType );
//fileExtension = fileExtension != null? fileExtension: DEFAULT_FILE_EXTENSION;
fileName = "report"; //, + "." + fileExtension;
try {
writeBackToClient(reportFile, null, writeBackResponseInline, fileName, mimeType);
} catch (IOException ioe) {
throw new SpagoBIEngineException("Impossible to write back the responce to the client", ioe);
}
} catch(Throwable t) {
logger.error("Impossible to export doc", t);