net.sf.jasperreports.engine.JasperFillManager Java Examples
The following examples show how to use
net.sf.jasperreports.engine.JasperFillManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdminJasperReport.java From Spring-MVC-Blueprints with MIT License | 7 votes |
@RequestMapping(value = "/hrms/showJasperManagerPDF", method = RequestMethod.GET) public String showJasperManagerPDF(ModelMap model, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, JRException, NamingException { usersList = loginService.getUserList(); AdminJasperBase dsUsers = new AdminJasperBase(usersList); Map<String, Object> params = new HashMap<>(); params.put("users", usersList); JasperReport jasperReport = getCompiledFile("JRUsers", request); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dsUsers); response.setContentType("application/x-pdf"); response.setHeader("Content-disposition", "inline; filename=userList.pdf"); final OutputStream outStream = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint, outStream); return null; }
Example #2
Source File: XlsFeaturesApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ReportTitle", "Customers Report"); parameters.put("Customers", "Customers"); parameters.put("ReportDate", new Date()); parameters.put("DataFile", "CsvDataSource.txt - CSV query executer"); File[] files = getFiles(new File("build/reports"), "jasper"); for(int i = 0; i< files.length; i++) { long start = System.currentTimeMillis(); File sourceFile = files[i]; JasperFillManager.fillReportToFile(sourceFile.getPath(), new HashMap<String, Object>(parameters)); System.err.println("Report : " + sourceFile + ". Filling time : " + (System.currentTimeMillis() - start)); } }
Example #3
Source File: ChartsApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("MaxOrderID", 12500); File[] files = getFiles(new File("build/reports"), "jasper"); for(int i = 0; i < files.length; i++) { File reportFile = files[i]; long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile( reportFile.getAbsolutePath(), new HashMap<String, Object>(parameters), getDemoHsqldbConnection() ); System.err.println("Report : " + reportFile + ". Filling time : " + (System.currentTimeMillis() - start)); } }
Example #4
Source File: Report.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
public JasperReport compileReport() throws JRException, IOException { InputStream jrxmlInput = JRLoader.getResourceInputStream(jrxml); JasperDesign design; try { design = JRXmlLoader.load(jrxmlInput); } finally { jrxmlInput.close(); } report = JasperCompileManager.compileReport(design); //TODO do we need this here? fillManager = JasperFillManager.getInstance(jasperReportsContext); return report; }
Example #5
Source File: AbstractJasperReportsView.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Fill the given report using the given JDBC DataSource and model. */ private JasperPrint doFillReport(JasperReport report, Map<String, Object> model, DataSource ds) throws Exception { // Use the JDBC DataSource. if (logger.isDebugEnabled()) { logger.debug("Filling report using JDBC DataSource [" + ds + "]"); } Connection con = ds.getConnection(); try { return JasperFillManager.fillReport(report, model, con); } finally { try { con.close(); } catch (Throwable ex) { logger.debug("Could not close JDBC Connection", ex); } } }
Example #6
Source File: CrosstabApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { File[] files = getFiles(new File("build/reports"), "jasper"); for(int i = 0; i < files.length; i++) { File reportFile = files[i]; long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile( reportFile.getAbsolutePath(), null, getDemoHsqldbConnection() ); System.err.println("Report : " + reportFile + ". Filling time : " + (System.currentTimeMillis() - start)); } }
Example #7
Source File: I18nApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); Locale locale = chooseLocale(); if (locale != null) { // Object[] aw = new Object[] {1000000.45d, "$", "Ferrari", 20, 88}; Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("number", 1234567 + Math.random()); // parameters.put("array", aw); parameters.put(JRParameter.REPORT_LOCALE, locale); JasperFillManager.fillReportToFile("build/reports/I18nReport.jasper", parameters, new JREmptyDataSource()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); } }
Example #8
Source File: XlsDataSourceApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); //Preparing parameters Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ReportTitle", "Address Report"); parameters.put("DataFile", "XlsDataSource.data.xls - XLS data source"); Set<String> states = new HashSet<String>(); states.add("Active"); states.add("Trial"); parameters.put("IncludedStates", states); JasperFillManager.fillReportToFile("build/reports/XlsDataSourceReport.jasper", parameters, getDataSource()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #9
Source File: SubreportApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JasperReport subreport = (JasperReport)JRLoader.loadObjectFromFile("build/reports/ProductReport.jasper"); //Preparing parameters Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ProductsSubreport", subreport); JasperFillManager.fillReportToFile("build/reports/MasterReport.jasper", parameters, getDemoHsqldbConnection()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #10
Source File: BatchExportApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile( "build/reports/Report1.jasper", null, new JREmptyDataSource(2) ); JasperFillManager.fillReportToFile( "build/reports/Report2.jasper", null, new JREmptyDataSource(2) ); JasperFillManager.fillReportToFile( "build/reports/Report3.jasper", null, new JREmptyDataSource(2) ); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #11
Source File: ChartCustomizersApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("legendWidth", "10"); parameters.put("legendHeight", "10"); File[] files = getFiles(new File("build/reports"), "jasper"); for(int i = 0; i < files.length; i++) { File reportFile = files[i]; long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile( reportFile.getAbsolutePath(), new HashMap<String, Object>(parameters) ); System.err.println("Report : " + reportFile + ". Filling time : " + (System.currentTimeMillis() - start)); } }
Example #12
Source File: SpiderChartApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JRCsvDataSource cds = null; try { String[] columnNames = new String[]{"value", "series", "category"}; cds = new JRCsvDataSource(JRLoader.getLocationInputStream("data/spiderDatasource.csv"), "UTF-8"); cds.setRecordDelimiter("\n"); cds.setUseFirstRowAsHeader(false); cds.setColumnNames(columnNames); } catch (UnsupportedEncodingException e) { throw new JRException(e); } JasperFillManager.fillReportToFile("build/reports/SpiderChart.jasper", null, cds); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #13
Source File: XChartApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); Map<String, Object> parameters = new HashMap<String, Object>(); try { JRCsvDataSource xyds = new JRCsvDataSource(JRLoader.getLocationInputStream("data/xyDatasource.csv"), "UTF-8"); xyds.setRecordDelimiter("\r\n"); xyds.setUseFirstRowAsHeader(true); parameters.put("xyDatasource", xyds); } catch (Exception e) { throw new JRException(e); } JasperFillManager.fillReportToFile("build/reports/XYChart.jasper", new HashMap<String, Object>(parameters), new JREmptyDataSource()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #14
Source File: HttpDataAdapterApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { File[] files = getFiles(new File("build/reports"), "jasper"); for(int i = 0; i < files.length; i++) { File reportFile = files[i]; long start = System.currentTimeMillis(); String fileName = reportFile.getAbsolutePath(); JasperFillManager.fillReportToFile( fileName, fileName.substring(0, fileName.lastIndexOf(".jasper")) + ".jrprint", null ); System.err.println(reportFile.getName() + " filling time : " + (System.currentTimeMillis() - start)); } }
Example #15
Source File: HibernateApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void fill() throws JRException { SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Session session = sessionFactory.openSession(); Transaction transaction = session.beginTransaction(); Map<String, Object> params = getParameters(session); File[] files = new File[]{ new File("build/reports/AddressesReport.jasper"), new File("build/reports/HibernateQueryReport.jasper") }; for(int i = 0; i < files.length; i++) { File reportFile = files[i]; long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile(reportFile.getAbsolutePath(), new HashMap<String, Object>(params)); System.err.println("Report : " + reportFile + ". Filling time : " + (System.currentTimeMillis() - start)); } transaction.rollback(); sessionFactory.close(); }
Example #16
Source File: ParagraphsApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile("build/reports/ParagraphsReport.jasper", null); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #17
Source File: HorizontalApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); //Preparing parameters Image image = Toolkit.getDefaultToolkit().createImage( JRLoader.loadBytesFromResource("dukesign.jpg") ); MediaTracker traker = new MediaTracker(new Panel()); traker.addImage(image, 0); try { traker.waitForID(0); } catch (Exception e) { e.printStackTrace(); } Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ReportTitle", "The Horizontal Report"); parameters.put("MaxOrderID", 10500); parameters.put("SummaryImage", image); JasperFillManager.fillReportToFile("build/reports/HorizontalReport.jasper", parameters, getDemoHsqldbConnection()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #18
Source File: HyperlinkApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile("build/reports/HyperlinkReport.jasper", null); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #19
Source File: StretchApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile("build/reports/StretchReport.jasper", null, new JREmptyDataSource(20)); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #20
Source File: GenericElementApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile("build/reports/GenericElementReport.jasper", null); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #21
Source File: JsonDataSourceApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); Map<String, Object> params = new HashMap<String, Object>(); params.put(JsonQueryExecuterFactory.JSON_DATE_PATTERN, "yyyy-MM-dd"); params.put(JsonQueryExecuterFactory.JSON_NUMBER_PATTERN, "#,##0.##"); params.put(JsonQueryExecuterFactory.JSON_LOCALE, Locale.ENGLISH); params.put(JRParameter.REPORT_LOCALE, Locale.US); JasperFillManager.fillReportToFile("build/reports/JsonCustomersReport.jasper", params); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #22
Source File: NoPageBreakApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); //Preparing parameters Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ReportTitle", "Orders Report"); JasperFillManager.fillReportToFile("build/reports/NoPageBreakReport.jasper", parameters, getDemoHsqldbConnection()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #23
Source File: NoXmlDesignApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); //Preparing parameters Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ReportTitle", "Address Report"); parameters.put("OrderByClause", "ORDER BY City"); JasperFillManager.fillReportToFile("build/reports/NoXmlDesignReport.jasper", parameters, getDemoHsqldbConnection()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #24
Source File: SubreportApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void jsonMetadata() throws JRException { long start = System.currentTimeMillis(); JasperReport subreport = (JasperReport)JRLoader.loadObjectFromFile("build/reports/ProductReport.jasper"); //Preparing parameters Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ProductsSubreport", subreport); parameters.put(JRParameter.IS_IGNORE_PAGINATION, true); JasperPrint jasperPrint = JasperFillManager.fillReport("build/reports/MasterReport.jasper", parameters, getDemoHsqldbConnection()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); start = System.currentTimeMillis(); File destFile = new File(new File("build/reports"), jasperPrint.getName() + ".json"); JsonMetadataExporter exporter = new JsonMetadataExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile)); exporter.exportReport(); System.err.println("JSON creation time : " + (System.currentTimeMillis() - start)); }
Example #25
Source File: XmlDataSourceApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); Map<String, Object> params = new HashMap<String, Object>(); Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream("data/northwind.xml")); params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document); params.put(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, "yyyy-MM-dd"); params.put(JRXPathQueryExecuterFactory.XML_NUMBER_PATTERN, "#,##0.##"); params.put(JRXPathQueryExecuterFactory.XML_LOCALE, Locale.ENGLISH); params.put(JRParameter.REPORT_LOCALE, Locale.US); JasperFillManager.fillReportToFile("build/reports/CustomersReport.jasper", params); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #26
Source File: ShapesApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile("build/reports/ShapesReport.jasper", null, (JRDataSource)null); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #27
Source File: Java5App.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); Map<String,Object> parameters = new HashMap<String,Object>(); parameters.put("greeting", Greeting.bye); JasperFillManager.fillReportToFile("build/reports/Java5Report.jasper", parameters, new JREmptyDataSource()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #28
Source File: LandscapeApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile("build/reports/LandscapeReport.jasper", null, new JREmptyDataSource()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #29
Source File: XlsFormulaApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); JasperFillManager.fillReportToFile("build/reports/XlsFormulaReport.jasper", null, new JREmptyDataSource()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }
Example #30
Source File: ScriptletApp.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ public void fill() throws JRException { long start = System.currentTimeMillis(); //Preparing parameters Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("ReportTitle", "Address Report"); JasperFillManager.fillReportToFile("build/reports/ScriptletReport.jasper", parameters, getDemoHsqldbConnection()); System.err.println("Filling time : " + (System.currentTimeMillis() - start)); }