Package org.wso2.carbon.reporting.api

Examples of org.wso2.carbon.reporting.api.ReportingException


     */
    public ByteArrayOutputStream generateExcelReport(JasperPrint jasperPrint) throws ReportingException, JRException {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        if (jasperPrint == null) {
            throw new ReportingException("jasperPrint null, can't convert to excel report");
        }
        try {
            // Remove the pageHeader from pages except starting page
            jasperPrint.setProperty("net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1", "pageHeader");
            //  Remove the pageFooter from all the pages
View Full Code Here


        OMElement reportJrXmlOmElement;
        try {
            resource = registry.get(jrXmlPath);
            reportDefinitionOmStream = resource.getContentStream();
        } catch (RegistryException e) {
            throw new ReportingException(reportTemplate + " getting  failed from " + componentName, e);
        }
        XMLInputFactory xmlInputFactory;
        XMLStreamReader xmlStreamReader = null;
        xmlInputFactory = XMLInputFactory.newInstance();
        try {
            xmlStreamReader = xmlInputFactory.createXMLStreamReader(reportDefinitionOmStream);
            stAXOMBuilder = new StAXOMBuilder(xmlStreamReader);
            reportJrXmlOmElement = stAXOMBuilder.getDocumentElement();
            return reportJrXmlOmElement.toString();
        } catch (XMLStreamException e) {
            throw new ReportingException(reportTemplate + " getting  failed from " + componentName, e);
        } finally {
            if (xmlStreamReader != null) {
                xmlStreamReader.close();
            }
        }
View Full Code Here

            Resource reportFilesResource = registry.newResource();
            reportFilesResource.setContent(fileContent);
            registry.put(REPORTS_PATH+fileName +".jrxml" ,reportFilesResource);
            status = true;
        } catch (RegistryException e) {
            throw new ReportingException("Failed to update report template "+ fileName ,e);
        }
        return status;
    }
View Full Code Here

            //create the builder
            StAXOMBuilder builder = new StAXOMBuilder(parser);
            //get the root element (in this case the envelope)
             documentElement = builder.getDocumentElement();
        } catch (XMLStreamException e) {
           throw new ReportingException("can not create OMElement from  " +xmlFile);
        }
        return documentElement;

    }
View Full Code Here

                dataSource = repositoryManager.getDataSource(dataSourceName);
                if (dataSource != null) {
                    try {
                        connection = dataSource.getConnection();
                    } catch (SQLException e) {
                        throw new ReportingException("Failed to get data source connection for "
                                                     + "\"" + dataSourceName + "\"", e);
                    }
                }
            }
        }
View Full Code Here

        JRXmlDataSource jrXmlDataSource;
        try {
            InputStream inputStream = new FileInputStream(new File(filePath));
            jrXmlDataSource = new JRXmlDataSource(inputStream);
        } catch (FileNotFoundException e) {
           throw new ReportingException(filePath +" file could not found");
        } catch (JRException e) {
           throw new ReportingException("could not create JRXmlDataSource from "+ filePath);
        }

        return jrXmlDataSource;
    }
View Full Code Here

       byte[] bytes = xmlAsString.getBytes();
        JRXmlDataSource jrXmlDataSourceFromString;
        try {
            jrXmlDataSourceFromString = new JRXmlDataSource(new ByteArrayInputStream(bytes));
        } catch (JRException e) {
            throw new ReportingException("could not create JRXmlDataSource from "+xmlAsString);
        }

        return jrXmlDataSourceFromString;
    }
View Full Code Here

            // generate JasperPrint Object from given JasperReport file and JRDataSource
            // by JasperFillManager
            try {
                map = getParamMap(reportParamMap, template);
            } catch (ReportingException e) {
                throw new ReportingException("Failed to get report param map", e);
            }
            if (dataSource instanceof JRDataSource) {
                jasperPrint = JasperFillManager.fillReport(jasperReport,map ,
                                                           (JRDataSource) dataSource);
View Full Code Here

                    String name = paramOmElement.getAttribute(new QName("name")).getAttributeValue();
                    reportParams.put(name, classValue);

                }
            } catch (ReportingException e) {
                throw new ReportingException("Failed to generate OmElement from template ", e);
            }

            for (ReportParamMap paramMap : reportParamMap) {
                String key = paramMap.getParamKey();
                String value = paramMap.getParamValue();
View Full Code Here

        ReportingResourcesSupplier supplier = new ReportingResourcesSupplier();
        String template;
        try {
            template = supplier.getReportResources(null, templateName);
        } catch (ReportingException e) {
            throw new ReportingException("Failed get template " + templateName, e);
        }
        JasperPrintProvider jasperPrintProvider = new JasperPrintProvider();

        ReportDataSourceManager reportDataSourceManager = new ReportDataSourceManager();
        Connection connection;
        if (template != null) {
            connection = reportDataSourceManager.getJDBCConnection(dataSourceName);
        } else {
            throw new ReportingException("empty report template found :" + templateName);
        }
        JasperPrint jasperPrint;
        if (connection != null) {
            try {
                jasperPrint = jasperPrintProvider.createJasperPrint(connection, template, reportParamMap);
            } catch (JRException e) {
                throw new JRException("Can't create JasperPrint Object from " + templateName, e);
            }
        } else {
            throw new ReportingException("valid data source not found  " + dataSourceName);
        }
        ReportStream reportStream = new ReportStream();
        if (reportType != null) {
            byteArrayOutputStream = reportStream.getReportStream(jasperPrint, reportType);
        } else {
            throw new ReportingException("valid report type not found : " + reportType);
        }

        if (byteArrayOutputStream != null) {
            reportBytes = byteArrayOutputStream.toByteArray();
        }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.reporting.api.ReportingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.