@Test @SuppressWarnings("unchecked") public void generateSimpleReport() throws Exception { JAXBContext context = JAXBContext.newInstance(XmlSimpleReport.class.getPackage().getName()); Unmarshaller unmarshaller = context.createUnmarshaller(); Marshaller marshaller = context.createMarshaller(); JAXBElement<XmlSimpleReport> unmarshal = (JAXBElement<XmlSimpleReport>) unmarshaller.unmarshal(new File("src/test/resources/simpleReport.xml")); assertNotNull(unmarshal); XmlSimpleReport simpleReport = unmarshal.getValue(); assertNotNull(simpleReport); StringWriter writer = new StringWriter(); marshaller.marshal(OF_SIMPLE_REPORT.createSimpleReport(simpleReport), writer); FileOutputStream fos = new FileOutputStream("target/simpleReport.pdf"); service.generateSimpleReport(writer.toString(), fos); }
public void generateSimpleReport(String simpleReport, OutputStream os) throws Exception { Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, os); Result result = new SAXResult(fop.getDefaultHandler()); SimpleReportFacade.newFacade().generatePdfReport(simpleReport, result); }
FOPService { public void generateSimpleReport(String simpleReport, OutputStream os) throws Exception { Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, os); Result result = new SAXResult(fop.getDefaultHandler()); SimpleReportFacade.newFacade().generatePdfReport(simpleReport, result); } }
FOPService { public void generateSimpleReport(String simpleReport, OutputStream os) throws Exception { Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, os); Result result = new SAXResult(fop.getDefaultHandler()); SimpleReportFacade.newFacade().generatePdfReport(simpleReport, result); }  }
FOPService { public void generateSimpleReport(String simpleReport, OutputStream os) throws Exception { Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, os); Result result = new SAXResult(fop.getDefaultHandler()); SimpleReportFacade.newFacade().generatePdfReport(simpleReport, result); }  @PostConstruct void init(); void generateSimpleReport(String simpleReport, OutputStream os); void generateDetailedReport(String detailedReport, OutputStream os); }
FOPService { public void generateSimpleReport(String simpleReport, OutputStream os) throws Exception { Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, os); Result result = new SAXResult(fop.getDefaultHandler()); SimpleReportFacade.newFacade().generatePdfReport(simpleReport, result); }  @PostConstruct void init(); void generateSimpleReport(String simpleReport, OutputStream os); void generateDetailedReport(String detailedReport, OutputStream os);  }