Examples of JRXmlDataSource


Examples of net.sf.jasperreports.engine.data.JRXmlDataSource

    return String.valueOf(getParameterValue(parameterName));
  }

  public JRDataSource createDatasource() throws JRException
  {
    JRXmlDataSource datasource = null;
   
    String xPath = getQueryString();
   
    if (log.isDebugEnabled())
    {
      log.debug("XPath query: " + xPath);
    }
   
    if (document != null && xPath != null)
    {
      datasource = new JRXmlDataSource(document, xPath);
      datasource.setLocale((Locale)getParameterValue(JRXPathQueryExecuterFactory.XML_LOCALE, true));
      datasource.setDatePattern((String)getParameterValue(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, true));
      datasource.setNumberPattern((String)getParameterValue(JRXPathQueryExecuterFactory.XML_NUMBER_PATTERN, true));
      datasource.setTimeZone((TimeZone)getParameterValue(JRXPathQueryExecuterFactory.XML_TIME_ZONE, true));
    }
   
    return datasource;
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.data.JRXmlDataSource

* used to create JRDataSource  from given xml data file by user
*/
public class XmlDataSource {

    public JRDataSource getJRDataSourceFromXml(String filePath) throws ReportingException {
        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);
        }
View Full Code Here

Examples of net.sf.jasperreports.engine.data.JRXmlDataSource

        return jrXmlDataSource;
    }

    public  JRDataSource getJRDataSourceFromString(String xmlAsString) throws ReportingException {
       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

Examples of net.sf.jasperreports.engine.data.JRXmlDataSource

          xs.omitField(ProcessInstance.class, "processLogs");
          String s = xs.toXML(processInstance);

          jasperPrint = JasperFillManager.fillReport(jasperReport,
                                                     parameters,
                                                     new JRXmlDataSource(
                                                         new ByteArrayInputStream(s.getBytes())
                                                     ));
        } else if (jasperReport.getQuery() != null && hasText(jasperReport.getQuery().getText())) {
          parameters.put(PROCESS_INSTANCE_ID_KEY, String.valueOf(processInstance.getId()));
          jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ctx.getHibernateSession().connection());
View Full Code Here

Examples of net.sf.jasperreports.engine.data.JRXmlDataSource

                    jrXlsxDataSource.setUseFirstRowAsHeader(Boolean.parseBoolean(useFirstRowAsHeader));
                }
                return jrXlsxDataSource;
            }
            if (res.endsWith(".xml")) {
                final JRXmlDataSource jrXmlDataSource = new JRXmlDataSource(resourceInputStream);
                setCommonJRDataSourceProperties(jrXmlDataSource);
                return jrXmlDataSource;
            }
            if (res.endsWith(".json")) {
                final JsonDataSource jsonDataSource = new JsonDataSource(resourceInputStream);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.