public JRSubreportRunResult start() { fillThread = new Thread(this, subreportFiller.getJasperReport().getName() + " subreport filler"); if (log.isDebugEnabled()) { log.debug("Fill " + subreportFiller.fillerId + ": starting thread " + fillThread); } fillThread.start(); return waitResult(); }
/** * */ public void afterPageInit() throws JRScriptletException { long ellapsedTime = System.currentTimeMillis() - startTime; if (timeout < ellapsedTime) { throw new TimeoutGovernorException( ((JasperReport)getParameterValue(JRParameter.JASPER_REPORT, false)).getName(), timeout ); } }
/** * Fills the compiled report design loaded from the specified file. * The result of this operation is another file that will contain the serialized * {@link JasperPrint} object representing the generated document, * having the same name as the report design as declared in the source file, * plus the <code>*.jrprint</code> extension, located in the same directory as the source file. * * @param sourceFileName source file containing the compile report design * @param parameters report parameters map * @see JRFiller#fillReport(JasperReport, Map) */ public static String fillReportToFile( String sourceFileName, Map parameters ) throws JRException { File sourceFile = new File(sourceFileName); JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperReport.getName() + ".jrprint"); String destFileName = destFile.toString(); parameters = setFileResolver(sourceFile, parameters); fillReportToFile(jasperReport, destFileName, parameters); return destFileName; }
/** * */ public void afterPageInit() throws JRScriptletException { // cannot use PAGE_NUMBER variable because of timing issues and because of isResetPageNumber flag pages++; if (maxPages < pages) { throw new MaxPagesGovernorException( ((JasperReport)getParameterValue(JRParameter.JASPER_REPORT, false)).getName(), maxPages ); } }
/** * Gets the file name. When set, a header 'Content-Disposition: attachment; * filename="${fileName}"' will be added to the response, resulting in a * download dialog. No magical extensions are added, so you should make sure * the file has the extension you want yourself. * * @return the file name */ public String getFileName() { if (fileName == null) { fileName = getJasperReport().getName() + "." + getExtension(); } return fileName; }
/** * Fills the compiled report design loaded from the specified file. * The result of this operation is another file that will contain the serialized * {@link JasperPrint} object representing the generated document, * having the same name as the report design as declared in the source file, * plus the <code>*.jrprint</code> extension, located in the same directory as the source file. * * @param sourceFileName source file containing the compile report design * @param parameters report parameters map * @param connection JDBC connection object to use for executing the report internal SQL query */ public static String fillReportToFile( String sourceFileName, Map parameters, Connection connection ) throws JRException { File sourceFile = new File(sourceFileName); JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperReport.getName() + ".jrprint"); String destFileName = destFile.toString(); parameters = setFileResolver(sourceFile, parameters); fillReportToFile(jasperReport, destFileName, parameters, connection); return destFileName; }
/** * Fills the compiled report design loaded from the specified file. * The result of this operation is another file that will contain the serialized * {@link JasperPrint} object representing the generated document, * having the same name as the report design as declared in the source file, * plus the <code>*.jrprint</code> extension, located in the same directory as the source file. * * @param sourceFileName source file containing the compile report design * @param parameters report parameters map * @param dataSource data source object */ public static String fillReportToFile( String sourceFileName, Map parameters, JRDataSource dataSource ) throws JRException { File sourceFile = new File(sourceFileName); JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperReport.getName() + ".jrprint"); String destFileName = destFile.toString(); parameters = setFileResolver(sourceFile, parameters); fillReportToFile(jasperReport, destFileName, parameters, dataSource); return destFileName; }
final String outputFileName = new String(baseDir + "/" + jasperReport.getName() + new SimpleDateFormat("-MMddyyyy-HHmm").format(new Date()) + ".jrprint"); LOG.debug("jrprint output file: {}", outputFileName);
final String outputFileName = new String(baseDir + "/" + jasperReport.getName() + new SimpleDateFormat("-MMddyyyy-HHmm").format(new Date()) + ".jrprint"); LOG.debug("jrprint output file: {}", outputFileName);
+ jasperReport.getName() + "\" failed in the current page context " + "(height = " + pageHeight + ", top margin = " + topMargin + ", bottom margin = " + bottomMargin + ") : ", + jasperReport.getName() + "\" succeeded in the current page context " + "(height = " + pageHeight + ", top margin = " + topMargin + ", bottom margin = " + bottomMargin + ")");
private static JRDataset findSubdataset(JRDatasetRun datasetRun, JasperReport report) { JRDataset[] datasets = report.getDatasets(); JRDataset reportDataset = null; if (datasets != null) { for (int i = 0; i < datasets.length; i++) { if (datasetRun.getDatasetName().equals( datasets[i].getName())) { reportDataset = datasets[i]; break; } } } if (reportDataset == null) { throw new JRRuntimeException("Could not find subdataset named \"" + datasetRun.getDatasetName() + "\" in report \"" + report.getName() + "\""); } return reportDataset; }
public void afterGroupInit(String groupName) throws JRScriptletException { super.afterGroupInit(groupName); String currentGroupValue = (String) getFieldValue("state"); logger.debug("afterGroupInit [" + groupName + "] = " + currentGroupValue); JRFillParameter report = parametersMap.get("JASPER_REPORT"); String prefix = ((JasperReport)report.getValue()).getName() + "_"; /* Recover JasperReport variable (the holder for the calculated value) The naming convention used in DJ is: <ReportName>_variable-<[header|footer]>_<grouped column property>_<column with the variable> As an example: XXXX_variable-header_state_quantity stands for: a header variable placed in the group for the column "state" which calculates in the column "quantity" In the example, XXXX is the report name which is obtained from current JasperReport object (from the parameters map) */ JRFillVariable var = variablesMap.get(prefix + "variable-header_state_quantity"); /* Here We get the precalculated value for the current group */ Object precalculatedValue = getPrecalculatedValue("state", currentGroupValue); var.setValue(precalculatedValue); }
String reportName = factory.getFiller().isSubreport() ? factory.getFiller().getJasperReport().getName() : null;
log.debug("Fill " + fillerId + ": created for " + jasperReport.getName()); name = jasperReport.getName(); columnCount = jasperReport.getColumnCount(); printOrder = jasperReport.getPrintOrder(); String reportName = factory.getFiller().isSubreport() ? factory.getFiller().getJasperReport().getName() : null;