Opraveno generování sestavy se subreportem.

multitenant
Josef Rokos 10 years ago
parent 0c7c3af472
commit b5ffa6595f

@ -4,6 +4,9 @@ import java.io.File;
import javax.servlet.ServletContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JasperRunManager;
@ -16,6 +19,7 @@ public class PredefinedGenerator implements Generator {
private ReportDefinition definition;
private ServletContext ctx;
private final static Logger logger = LoggerFactory.getLogger(PredefinedGenerator.class);
public PredefinedGenerator(ReportDefinition definition, ServletContext ctx) {
this.definition = definition;
@ -30,8 +34,10 @@ public class PredefinedGenerator implements Generator {
JasperReport report = (JasperReport) JRLoader.loadObject(getReportFile());
JRProperties.setProperty("net.sf.jasperreports.default.pdf.encoding", "Cp1250");
loadLazyData();
definition.setParam("SUBREPORT_DIR", ctx.getRealPath("WEB-INF/reports") + "/");
bytes = JasperRunManager.runReportToPdf(report, definition.getParams(), new JRBeanCollectionDataSource(definition.getDataSet()));;
} catch (JRException e) {
logger.error("Generator error: " + e.getMessage());
throw new ReportException(e);
}

Loading…
Cancel
Save