/** * @param fileName * @param fileName * @param isXmlReport * @param isXmlReport * @throws net.sf.jasperreports.engine.JRException * @throws JRException */ protected void loadReport(String fileName, boolean isXmlReport) throws JRException { if (isXmlReport) { jasperPrint = JRPrintXmlLoader.load(fileName); } else { jasperPrint = (JasperPrint)JRLoader.loadObjectFromFile(fileName); } type = TYPE_FILE_NAME; this.isXML = isXmlReport; reportFileName = fileName; btnReload.setEnabled(true); setPageIndex(0); }
/** * @param is * @param is * @param isXmlReport * @throws JRException */ protected void loadReport(InputStream is, boolean isXmlReport) throws JRException { if (isXmlReport) { jasperPrint = JRPrintXmlLoader.load(is); } else { jasperPrint = (JasperPrint)JRLoader.loadObject(is); } type = TYPE_INPUT_STREAM; this.isXML = isXmlReport; btnReload.setEnabled(false); setPageIndex(0); }
protected void loadJRPrint(IEditorInput input) throws PartInitException { InputStream in = null; try { IFile file = null; if (input instanceof IFileEditorInput) { file = ((IFileEditorInput) input).getFile(); in = file.getContents(); } else { throw new PartInitException("Invalid Input: Must be IFileEditorInput or FileStoreEditorInput"); //$NON-NLS-1$ } Statistics stats = new Statistics(); if (file.getFileExtension().equals(".jrpxml")) { setJasperPrint(stats, JRPrintXmlLoader.load(in)); } else { Object obj = JRLoader.loadObject(in); if (obj instanceof JasperPrint) setJasperPrint(stats, (JasperPrint) obj); } } catch (Exception e) { throw new PartInitException("Invalid Input", e); } }
/** */ protected void loadReport(InputStream is, boolean isXmlReport) throws JRException { if (isXmlReport) { jasperPrint = JRPrintXmlLoader.load(jasperReportsContext, is); } else { jasperPrint = (JasperPrint)JRLoader.loadObject(is); } type = TYPE_INPUT_STREAM; this.isXML = isXmlReport; btnReload.setEnabled(false); setPageIndex(0); }
/** */ protected void loadReport(String fileName, boolean isXmlReport) throws JRException { if (isXmlReport) { jasperPrint = JRPrintXmlLoader.load(fileName); } else { jasperPrint = (JasperPrint)JRLoader.loadObject(fileName); } type = TYPE_FILE_NAME; this.isXML = isXmlReport; reportFileName = fileName; btnReload.setEnabled(true); setPageIndex(0); }
/** */ protected void loadReport(InputStream is, boolean isXmlReport) throws JRException { if (isXmlReport) { jasperPrint = JRPrintXmlLoader.load(is); } else { jasperPrint = (JasperPrint)JRLoader.loadObject(is); } type = TYPE_INPUT_STREAM; this.isXML = isXmlReport; btnReload.setEnabled(false); setPageIndex(0); }
/** * @param pdfBytes * @param xmlBytes * @param pdfName * @param xmlName * @throws JazzOMRException * @throws FileNotFoundException * @throws IOException */ protected void logExportedFiles(byte[] pdfBytes, byte[] xmlBytes, String pdfName, String xmlName) { if(!log.isDebugEnabled()) return; byte[] pdfFromXML; try { ByteArrayInputStream bais = new ByteArrayInputStream(xmlBytes); JasperPrint jasperPrint = JRPrintXmlLoader.load(bais); JRPdfExporter pdfExporter = new JRPdfExporter(); ByteArrayOutputStream baosPDF = new ByteArrayOutputStream(); pdfExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); pdfExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baosPDF); pdfExporter.exportReport(); pdfFromXML = baosPDF.toByteArray(); } catch (JRException e) { throw new JazzRuntimeException("erro ao tentar montar relatorio resultado do XML!", e); } writeToFile(pdfFromXML, "fromXML_"+pdfName); writeToFile(pdfBytes, pdfName); writeToFile(xmlBytes, xmlName); }
private JasperPrint getJasperPrint(String location) throws JRException { if (location.contains("jrpxml")) { return JRPrintXmlLoader.load(location); } else { return (JasperPrint) JRLoader.loadObject(location); } }
/** * @param pdfBytes * @param xmlBytes * @param pdfName * @param xmlName * @throws JazzOMRException * @throws FileNotFoundException * @throws IOException */ protected void logExportedFiles(byte[] pdfBytes, byte[] xmlBytes, String pdfName, String xmlName) throws JazzOMRException { byte[] pdfFromXML; try { ByteArrayInputStream bais = new ByteArrayInputStream(xmlBytes); JasperPrint jasperPrint = JRPrintXmlLoader.load(bais); JRPdfExporter pdfExporter = new JRPdfExporter(); ByteArrayOutputStream baosPDF = new ByteArrayOutputStream(); pdfExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); pdfExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baosPDF); pdfExporter.exportReport(); pdfFromXML = baosPDF.toByteArray(); } catch (JRException e) { throw new JazzOMRException("erro ao tentar montar relatorio resultado do XML!", e); } writeToFile(pdfFromXML, "fromXML_"+pdfName); writeToFile(pdfBytes, pdfName); writeToFile(xmlBytes, xmlName); }