/** * @deprecated Replaced by {@link JasperCompileManager#compileReport(JasperDesign)}. */ public JasperReport compileReport(JasperDesign jasperDesign) throws JRException { return JasperCompileManager.compileReport(jasperDesign); }
/** * @deprecated Replaced by {@link JasperCompileManager#compileReportToFile(JasperDesign, String)}. */ public static void compileReportToFile( JasperDesign jasperDesign, String destFileName ) throws JRException { JasperCompileManager.compileReportToFile( jasperDesign, destFileName ); }
/** * @deprecated Replaced by {@link JasperCompileManager#compileReportToStream(JasperDesign, OutputStream)}. */ public static void compileReportToStream( JasperDesign jasperDesign, OutputStream outputStream ) throws JRException { JasperCompileManager.compileReportToStream( jasperDesign, outputStream ); }
JasperReportsContext reportsContext = new SimpleJasperReportsContext(); JRPropertiesUtil.getInstance(reportsContext).setProperty(JRCompiler.COMPILER_PREFIX + JRReport.LANGUAGE_JAVA, CustomJRJdtCompiler.class.getCanonicalName()); JasperCompileManager jasperCompilerManager = JasperCompileManager.getInstance(reportsContext); report = jasperCompilerManager.compile(jasperDesign); } else { report = JasperCompileManager.compileReport(jasperDesign);
JasperReportsContext reportsContext = new SimpleJasperReportsContext(); JRPropertiesUtil.getInstance(reportsContext).setProperty(JRCompiler.COMPILER_PREFIX + JRReport.LANGUAGE_JAVA, CustomJRJdtCompiler.class.getCanonicalName()); JasperCompileManager jasperCompilerManager = JasperCompileManager.getInstance(reportsContext); report = jasperCompilerManager.compile(jasperDesign); } else { report = 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#compileReportToFile(String)}. */ public static String compileReportToFile(String sourceFileName) throws JRException { return JasperCompileManager.compileReportToFile(sourceFileName); }
/** * @deprecated Replaced by {@link JasperCompileManager#compileReportToStream(InputStream, OutputStream)}. */ public static void compileReportToStream( InputStream inputStream, OutputStream outputStream ) throws JRException { JasperCompileManager.compileReportToStream( inputStream, outputStream ); }
/** * @deprecated Replaced by {@link JasperCompileManager#compileReport(InputStream)}. */ public static JasperReport compileReport(InputStream inputStream) throws JRException { return JasperCompileManager.compileReport(inputStream); }
/** * @deprecated Replaced by {@link JasperCompileManager#compileReportToFile(String, String)}. */ public static void compileReportToFile( String sourceFileName, String destFileName ) throws JRException { JasperCompileManager.compileReportToFile( sourceFileName, destFileName ); }
/** * Export file to .jasper file * * @param report report builder * @param out ile output stream * @throws JRException JRException exception * @throws DRException DRException exception */ public static void exportReportToJasperFile(JasperReportBuilder report, OutputStream out) throws JRException, DRException { JasperCompileManager.compileReportToStream(report.toJasperDesign(), out); }
/** * @deprecated Replaced by {@link JasperCompileManager#compileReport(JasperDesign)}. */ public static JasperReport compileReport(JasperDesign jasperDesign) throws JRException { return JasperCompileManager.compileReport(jasperDesign); }
/** * Export file to .jrxml file * * @param jasperDesign jasper design * @param out path * @throws JRException JRException exception */ public static void exportReportToJRXMLFile(JasperDesign jasperDesign, Path out) throws JRException { JasperCompileManager.compileReportToFile(jasperDesign, out.toFile().getAbsolutePath()); }
/** * Compiles the XML representation of the report design read from the supplied input stream and * writes the generated compiled report design object to the output stream specified * by the second parameter. * * @param inputStream XML source input stream * @param outputStream output stream to write the compiled report design to */ public static void compileReportToStream( InputStream inputStream, OutputStream outputStream ) throws JRException { JasperDesign jasperDesign = JRXmlLoader.load(inputStream); compileReportToStream(jasperDesign, outputStream); }
private JasperReport createStaticSubreport() throws JRException { InputStream is = JasperTemplateDesignReport2.class.getResourceAsStream("subreport.jrxml"); return JasperCompileManager.compileReport(is); }
/** * complie the report template xml file into a Jasper report file if the compiled file does not exist or is out of update * * @param designTemplate the full name of the report template xml file * @param jasperReport the full name of the compiled report file */ protected void compileReportTemplate(String designTemplate, String jasperReport) throws JRException { File jasperFile = new File(jasperReport); File designFile = new File(designTemplate); if (!jasperFile.exists() && !designFile.exists()) { throw new RuntimeException("Both the design template file and jasper report file don't exist: (" + designTemplate + ", " + jasperReport + ")"); } if (!jasperFile.exists() && designFile.exists()) { JasperCompileManager.compileReportToFile(designTemplate, jasperReport); } else if (jasperFile.exists() && designFile.exists()) { if (jasperFile.lastModified() < designFile.lastModified()) { JasperCompileManager.compileReportToFile(designTemplate, jasperReport); } } }
/** * Compile the source file. If the source file doesn't have the right * extension, it is skipped. * * @return Debug output of the compile action. * @throws Exception when anything goes wrong while compiling. */ @Override public Void call() throws Exception { OutputStream out = null; InputStream in = null; try { out = new FileOutputStream(destination); in = new FileInputStream(source); JasperCompileManager.compileReportToStream(in, out); if (verbose) { log.info("Compiling " + source.getName()); } } catch (Exception e) { cleanUpAndThrowError(destination, e); } finally { if (out != null) { out.close(); } if (in != null) { in.close(); } } return null; }
private JasperReport getJasperReport(String reportResource) throws JRException { InputStream defaultReportInputStream = ClassLoader.class.getResourceAsStream(reportResource); return JasperCompileManager.compileReport(defaultReportInputStream); }
public static void main(String[] args) { if (args.length < 1) { System.out.println("Please supply the name of the report(s) source to compile."); System.exit(-1); } try { for (int i = 0; i < args.length; i++) { System.out.println("JasperReports Compiling: " + args[i]); JasperCompileManager.compileReportToFile(args[i]); } } catch (JRException e) { e.printStackTrace(); System.exit(-1); } System.exit(0); } }
private JasperReport getJasperSubreport() throws JRException { InputStream is = DetailJasperSubreport.class.getResourceAsStream("subreport.jrxml"); return JasperCompileManager.compileReport(is); }