/** * @deprecated Replaced by {@link JasperCompileManager#compileReportToFile(String)}. */ public static String compileReportToFile(String sourceFileName) throws JRException { return JasperCompileManager.compileReportToFile(sourceFileName); }
/** * @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#compileReportToFile(String, String)}. */ public static void compileReportToFile( String sourceFileName, String destFileName ) throws JRException { JasperCompileManager.compileReportToFile( sourceFileName, destFileName ); }
/** * 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()); }
/** * 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); } } }
/** * Compiles the XML report design file received as the first parameter, placing the result * in the file specified by the second parameter. * The resulting file will contain a serialized instance of a * {@link net.sf.jasperreports.engine.JasperReport} object representing * the compiled report design. * * @param sourceFileName XML source file name * @param destFileName file name to place the result into */ public static void compileReportToFile( String sourceFileName, String destFileName ) throws JRException { JasperDesign jasperDesign = JRXmlLoader.load(sourceFileName); compileReportToFile(jasperDesign, destFileName); }
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); } }
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); } }
/** * Compiles the XML report design file specified by the parameter. * The result of this operation is another file that will contain the serialized * {@link net.sf.jasperreports.engine.JasperReport} object representing the compiled report design, * having the same name as the report design as declared in the XML plus the <code>*.jasper</code> extension, * located in the same directory as the XML source file. * * @param sourceFileName XML source file name * @return resulting file name containing a serialized {@link net.sf.jasperreports.engine.JasperReport} object */ public static String compileReportToFile(String sourceFileName) throws JRException { File sourceFile = new File(sourceFileName); JasperDesign jasperDesign = JRXmlLoader.load(sourceFileName); File destFile = new File(sourceFile.getParent(), jasperDesign.getName() + ".jasper"); String destFileName = destFile.toString(); compileReportToFile(jasperDesign, destFileName); return destFileName; }
JasperCompileManager.compileReportToFile(srcFileName, destFileName); System.out.println("OK.");
/** * The main method. * * @param args the arguments */ public static void main(String[] args) { if (args.length > 1 && new File(args[0]).exists()) { System.setProperty("opennms.home", args[0]); } initializeSingleInstanceDatabase(); BeanUtils.getBeanFactory("jasperReportContext"); // To trigger Spring Initialization File reportsDirectory = new File(ConfigFileConstants.getFilePathString(), "report-templates"); System.out.printf("Analyzing jasper reports located at %s\n", reportsDirectory); for (File report : FileUtils.listFiles(reportsDirectory, new String[] { "jrxml" }, true)) { System.out.printf("Compiling report template %s\n", report.getAbsolutePath()); try { JasperCompileManager.compileReportToFile(report.getAbsolutePath()); } catch (JRException e) { System.err.println("Error: cannot compile report because: " + e.getMessage()); e.printStackTrace(); } } }
/** * The main method. * * @param args the arguments */ public static void main(String[] args) { if (args.length > 1 && new File(args[0]).exists()) { System.setProperty("opennms.home", args[0]); } initializeSingleInstanceDatabase(); BeanUtils.getBeanFactory("jasperReportContext"); // To trigger Spring Initialization File reportsDirectory = new File(ConfigFileConstants.getFilePathString(), "report-templates"); System.out.printf("Analyzing jasper reports located at %s\n", reportsDirectory); for (File report : FileUtils.listFiles(reportsDirectory, new String[] { "jrxml" }, true)) { System.out.printf("Compiling report template %s\n", report.getAbsolutePath()); try { JasperCompileManager.compileReportToFile(report.getAbsolutePath()); } catch (JRException e) { System.err.println("Error: cannot compile report because: " + e.getMessage()); e.printStackTrace(); } } }
JasperCompileManager.compileReportToFile( src.getAbsolutePath(), dest.getAbsolutePath() );