/** * @deprecated Replaced by {@link JasperCompileManager#compileReport(JasperDesign)}. */ public JasperReport compileReport(JasperDesign jasperDesign) throws JRException { return JasperCompileManager.compileReport(jasperDesign); }
/** * @deprecated Replaced by {@link JasperCompileManager#compileReport(String)}. */ public static JasperReport compileReport(String sourceFileName) throws JRException { return JasperCompileManager.compileReport(sourceFileName); }
/** * @deprecated Replaced by {@link JasperCompileManager#compileReport(InputStream)}. */ public static JasperReport compileReport(InputStream inputStream) throws JRException { return JasperCompileManager.compileReport(inputStream); }
/** * @deprecated Replaced by {@link JasperCompileManager#compileReport(JasperDesign)}. */ public static JasperReport compileReport(JasperDesign jasperDesign) throws JRException { return JasperCompileManager.compileReport(jasperDesign); }
private JasperReport getJasperReport(String reportResource) throws JRException { InputStream defaultReportInputStream = ClassLoader.class.getResourceAsStream(reportResource); return JasperCompileManager.compileReport(defaultReportInputStream); }
private JasperReport createStaticSubreport() throws JRException { InputStream is = JasperTemplateDesignReport2.class.getResourceAsStream("subreport.jrxml"); return JasperCompileManager.compileReport(is); }
private JasperReport getJasperSubreport() throws JRException { InputStream is = DetailJasperSubreport.class.getResourceAsStream("subreport.jrxml"); return JasperCompileManager.compileReport(is); }
private JasperReport getJasperTitleSubreport() throws JRException { InputStream is = JasperSubreport.class.getResourceAsStream("titlesubreport.jrxml"); return JasperCompileManager.compileReport(is); }
/** * Compiles the XML report design file received as parameter, and returns * the compiled report design object. * * @param sourceFileName XML source file name * @return compiled report design object */ public static JasperReport compileReport(String sourceFileName) throws JRException { JasperDesign jasperDesign = JRXmlLoader.load(sourceFileName); return compileReport(jasperDesign); }
/** * Compiles the serialized report design object read from the supplied input stream and * returns the generated compiled report design object. * * @param inputStream XML source input stream * @return compiled report design object */ public static JasperReport compileReport(InputStream inputStream) throws JRException { JasperDesign jasperDesign = JRXmlLoader.load(inputStream); return compileReport(jasperDesign); }
/** * Compiles the report design object represented by the first parameter and * writes the generated compiled report design object to the output stream specified * by the second parameter. * * @param jasperDesign source report design object * @param outputStream output stream to write the compiled report design to */ public static void compileReportToStream( JasperDesign jasperDesign, OutputStream outputStream ) throws JRException { JasperReport jasperReport = compileReport(jasperDesign); JRSaver.saveObject(jasperReport, outputStream); }
private JasperReport loadFromDisk(Report report) throws JRException { String template = resolver.getPathFor(report); if(template.endsWith(".jrxml")) return JasperCompileManager.compileReport(template); else return (JasperReport) JRLoader.loadObjectFromFile(template); } }
@Override public JasperPrint getSummaryReport(String title, String info) throws JRException { InputStream inputStream = IREvalResult.class.getResourceAsStream("IREvalSummaryReport.jrxml"); ArrayList<IREvalResult> list = new ArrayList<IREvalResult>(); list.add(this); JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(list); Map<String, Object> parameters = new HashMap<String, Object>(); JasperDesign jasperDesign = JRXmlLoader.load(inputStream); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, beanColDataSource); return jasperPrint; }
@Override public JasperPrint getSummaryReport(String title, String info) throws JRException { InputStream inputStream = IREvalResult.class.getResourceAsStream("IREvalSummaryReport.jrxml"); ArrayList<IREvalResult> list = new ArrayList<IREvalResult>(); list.add(this); JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(list); Map<String, Object> parameters = new HashMap<String, Object>(); JasperDesign jasperDesign = JRXmlLoader.load(inputStream); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, beanColDataSource); return jasperPrint; }
/** * Writes a Jasper Reports representation of the given Grid to the given OutputStream. */ public static void toJasperReport( Grid grid, Map<String, Object> params, OutputStream out ) throws Exception { if ( grid == null ) { return; } final StringWriter writer = new StringWriter(); render( grid, params, writer, JASPER_TEMPLATE ); String report = writer.toString(); JasperReport jasperReport = JasperCompileManager.compileReport( IOUtils.toInputStream( report, StandardCharsets.UTF_8 ) ); JasperPrint print = JasperFillManager.fillReport( jasperReport, params, grid ); JasperExportManager.exportReportToPdfStream( print, out ); }
public JasperReport getReport(String location) { try { return JasperCompileManager.compileReport( new ReportInputStream(resourceLoader.getResource(getPath(location)).getInputStream(), removeFrame)); } catch (JRException e) { throw new TechnicalException(e); } catch (IOException e) { throw new TechnicalException(e); } }
/** * <p>toJasperReport.</p> * * @return a {@link net.sf.jasperreports.engine.JasperReport} object. * @throws net.sf.dynamicreports.report.exception.DRException if any. */ public JasperReport toJasperReport() throws DRException { if (jasperReport == null) { try { jasperReport = JasperCompileManager.compileReport(toJasperDesign()); } catch (JRException e) { throw new DRException(e); } } return jasperReport; }
/** * Build report and set data to export * * @return SpecificTemplateDataBuilderService * @throws FileNotFoundException FileNotFoundException exception * @throws JRException JRException exception */ public SpecificTemplateDataBuilderService build() throws FileNotFoundException, JRException { JasperDesign jasperPrint = JasperFileUtil.loadFromJRXMLFile(getFile()); JasperReport compiledReport = JasperCompileManager.compileReport(jasperPrint); return specificTemplateDataBuilderService.initialize(compiledReport, null); }
@Override public void renderDocument() { try { switch (getExtension(reportTemplate)) { case JASPER_EXT: printReport((JasperReport) JRLoader.loadObject(reportTemplate.getDocumentContent())); break; case JRXML_EXT: JasperDesign design = JRXmlLoader.load(reportTemplate.getDocumentContent()); if (!design.getParametersMap().containsKey(CUBA_PARAM)) design.addParameter(createJRParameter()); printReport(JasperCompileManager.compileReport(design)); break; default: throw new ReportFormattingException("Error handling template extension"); } } catch (JRException e) { throw new ReportFormattingException("Error formatting jasper report: " + e.getMessage(), e); } }
@Override public void renderDocument() { try { switch (getExtension(reportTemplate)) { case JASPER_EXT: printReport((JasperReport) JRLoader.loadObject(reportTemplate.getDocumentContent())); break; case JRXML_EXT: JasperDesign design = JRXmlLoader.load(reportTemplate.getDocumentContent()); if (!design.getParametersMap().containsKey(CUBA_PARAM)) design.addParameter(createJRParameter()); printReport(JasperCompileManager.compileReport(design)); break; default: throw new ReportFormattingException("Error handling template extension"); } } catch (JRException e) { throw new ReportFormattingException("Error formatting jasper report: " + e.getMessage(), e); } }