• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JRXPathQueryExecuterFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory的典型用法代码示例。如果您正苦于以下问题:Java JRXPathQueryExecuterFactory类的具体用法?Java JRXPathQueryExecuterFactory怎么用?Java JRXPathQueryExecuterFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JRXPathQueryExecuterFactory类属于net.sf.jasperreports.engine.query包,在下文中一共展示了JRXPathQueryExecuterFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configureReport

import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory; //导入依赖的package包/类
@Override
protected void configureReport(JasperReportBuilder rb) {
	try {
		rb.setLocale(Locale.ENGLISH)
			.columns(
				column1 =	col.column("Column1", field("field1", type.stringType()).setDescription("@field1")),
				column2 =	col.column("Column2", field("field2", type.integerType())),
				column3 =	col.column("Column3", field("field3", type.bigDecimalType())))
			.setQuery("/data/row1", QueryLanguage.XPATH)
			.setParameter(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, JRXmlUtils.parse(XmlReportTest.class.getResourceAsStream("data.xml")))
			.summary(cmp.subreport(createSubreport()));
	} catch (JRException e) {
		e.printStackTrace();
		Assert.fail(e.getMessage());
	}
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:17,代码来源:XmlReportTest.java


示例2: fill

import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory; //导入依赖的package包/类
/**
 *
 */
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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:XmlDataSourceApp.java


示例3: readDataFile

import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory; //导入依赖的package包/类
protected Map<String, Object> readDataFile(String xmlDataFile) throws JRException {
    Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream(xmlDataFile));
    Map<String, Object> params = new HashMap<String, Object>();
    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);
    return params;
}
 
开发者ID:stefanorosanelli,项目名称:jasper-service,代码行数:11,代码来源:JasperProcess.java


示例4: contributeParameters

import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory; //导入依赖的package包/类
@Override
public void contributeParameters(Map<String, Object> parameters) throws JRException 
{
	RemoteXmlDataAdapter remoteXmlDataAdapter = getRemoteXmlDataAdapter();
	if (remoteXmlDataAdapter != null)
	{
		if (remoteXmlDataAdapter.isUseConnection()) 
		{
			String fileName = remoteXmlDataAdapter.getFileName();
			if (fileName.toLowerCase().startsWith("https://") ||
				fileName.toLowerCase().startsWith("http://") ||
				fileName.toLowerCase().startsWith("file:")) {
				
				// JRXPathQueryExecuterFactory.XML_URL not available.
				// Once this is available, remove XML_URL from this class.
				parameters.put(XML_URL, fileName);
			}
			else 
			{
				InputStream dataStream = RepositoryUtil.getInstance(getJasperReportsContext()).getInputStreamFromLocation(remoteXmlDataAdapter.getFileName());
				try
				{
					Document document = JRXmlUtils.parse(dataStream, remoteXmlDataAdapter.isNamespaceAware());
					parameters.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
				}
				finally
				{
					try
					{
						dataStream.close();
					}
					catch (IOException e)
					{
						log.warn("Failed to close input stream for " + remoteXmlDataAdapter.getFileName());
					}
				}
			}
			
			Locale locale = remoteXmlDataAdapter.getLocale();
			if (locale != null) {
				parameters.put(JRXPathQueryExecuterFactory.XML_LOCALE, locale);
			}

			TimeZone timeZone = remoteXmlDataAdapter.getTimeZone();
			if (timeZone != null) {
				parameters.put(JRXPathQueryExecuterFactory.XML_TIME_ZONE, timeZone);
			}
			
			String datePattern = remoteXmlDataAdapter.getDatePattern();
			if (datePattern != null && datePattern.trim().length()>0) {
				parameters.put(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, datePattern);
			}

			String numberPattern = remoteXmlDataAdapter.getNumberPattern();
			if (numberPattern != null && numberPattern.trim().length()>0) {
				parameters.put(JRXPathQueryExecuterFactory.XML_NUMBER_PATTERN, numberPattern);
			}
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:61,代码来源:RemoteXmlDataAdapterService.java


示例5: fillReport

import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory; //导入依赖的package包/类
public JasperPrint fillReport(ReportEngineInput input) throws ProviderException
{
    Connection conn = null;

    Report report = input.getReport();
    Map<String,Object> parameters = input.getParameters();

    ReportDataSource dataSource = report.getDataSource();

    try
    {
        JasperReport jr = null;

        if (report.isQueryReport()) return fillQueryReport(report, parameters, input.getExportType());

        jr = (JasperReport) JRLoader
                .loadObject(directoryProvider.getReportDirectory() + report.getFile());

        List<ReportParameterMap> subReports = report.getSubReportParameters();
        if (subReports != null && subReports.size() > 0)
        {
            Iterator<ReportParameterMap> iterator = report.getSubReportParameters().iterator();
            while (iterator.hasNext())
            {
                ReportParameterMap rpMap = iterator.next();

                JasperReport subReport = (JasperReport) JRLoader.loadObject(directoryProvider
                        .getReportDirectory()
                        + rpMap.getReportParameter().getData());

                parameters.put(rpMap.getReportParameter().getName(), subReport);
            }
        }

        JasperPrint jp = null;

        // create new HashMap to send to JasperReports in order to
        // fix serialization problems
        Map<String,Object> jasperReportMap = new HashMap<String,Object>(parameters);

        if (input.getXmlInput() != null)
        {
            ByteArrayInputStream stream = new ByteArrayInputStream(input.getXmlInput().getBytes());
            Document document = JRXmlUtils.parse(stream);

            jasperReportMap.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);

            jp = JasperFillManager.fillReport(jr, jasperReportMap);
        }
        else if (dataSource == null)
        {
            jp = JasperFillManager.fillReport(jr, jasperReportMap, new JREmptyDataSource());
        }
        else
        {
            conn = dataSourceProvider.getConnection(dataSource.getId());
            jp = JasperFillManager.fillReport(jr, jasperReportMap, conn);
        }

        if (jp == null || jp.getPages().size() < 1) throw new ProviderException(LocalStrings.ERROR_REPORT_EMPTY);

        return jp;
    }
    catch (Exception e)
    {
        if (!e.getMessage().equals(LocalStrings.ERROR_REPORT_EMPTY)) log.error("JasperReportEngine.fillReport", e);
        throw new ProviderException(e.getMessage());
    }
    finally
    {
        try
        {
            if (conn != null) conn.close();
        }
        catch (Exception ex)
        {
            log.error("Error closing connection: " + ex.getMessage());
        }
    }
}
 
开发者ID:mtpettyp,项目名称:openreports,代码行数:81,代码来源:JasperReportEngine.java


示例6: getSpecialParameters

import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory; //导入依赖的package包/类
/**
 * This method is call before the datasource is used and permit to add special parameters to the map
 *
 */
@SuppressWarnings("unchecked")
@Override
public java.util.Map getSpecialParameters(java.util.Map map) throws net.sf.jasperreports.engine.JRException
{
    if (isUseConnection())
    {
        
        /*
        if (this.getFilename().toLowerCase().startsWith("https://") ||
            this.getFilename().toLowerCase().startsWith("http://") ||
            this.getFilename().toLowerCase().startsWith("file:"))
        {
            map.put(JRXPathQueryExecuterFactory.XML_URL, this.getFilename());
        }
        else
        {
        */
            Document document = JRXmlUtils.parse(new File( this.getFilename()));
            map.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
        //}
        
        
        if (getLocale()!=null)
       {
           map.put(JRXPathQueryExecuterFactory.XML_LOCALE, getLocale());
       }
       
       if (getTimeZone() != null)
       {
           map.put(JRXPathQueryExecuterFactory.XML_TIME_ZONE, getTimeZone());
       }
       
       if (getDatePattern() != null && getDatePattern().trim().length()>0)
       {
           map.put(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, getDatePattern());
       }
       
       if (getNumberPattern() != null && getNumberPattern().trim().length()>0)
       {
           map.put(JRXPathQueryExecuterFactory.XML_NUMBER_PATTERN, getNumberPattern());
       }
        
    }
    return map;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:50,代码来源:JRXMLDataSourceConnection.java


示例7: fillReport

import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory; //导入依赖的package包/类
public JasperPrint fillReport(ReportEngineInput input) throws ProviderException
{
	Connection conn = null;

	Report report = input.getReport();
	Map<String,Object> parameters = input.getParameters();
	
	ReportDataSource dataSource = report.getDataSource();

	try
	{
		JasperReport jr = null;

		if (report.isQueryReport()) return fillQueryReport(report, parameters, input.getExportType());

		jr = (JasperReport) JRLoader
				.loadObject(directoryProvider.getReportDirectory() + report.getFile());

		List<ReportParameterMap> subReports = report.getSubReportParameters();
		if (subReports != null && subReports.size() > 0)
		{
			Iterator<ReportParameterMap> iterator = report.getSubReportParameters().iterator();
			while (iterator.hasNext())
			{
				ReportParameterMap rpMap = iterator.next();

				JasperReport subReport = (JasperReport) JRLoader.loadObject(directoryProvider
						.getReportDirectory()
						+ rpMap.getReportParameter().getData());

				parameters.put(rpMap.getReportParameter().getName(), subReport);
			}
		}

		JasperPrint jp = null;

		// create new HashMap to send to JasperReports in order to
		// fix serialization problems
		Map<String,Object> jasperReportMap = new HashMap<String,Object>(parameters);
           
           if (input.getXmlInput() != null)
           {
               ByteArrayInputStream stream = new ByteArrayInputStream(input.getXmlInput().getBytes());
               Document document = JRXmlUtils.parse(stream);
               
               jasperReportMap.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
                              
               jp = JasperFillManager.fillReport(jr, jasperReportMap);               
           }
           else if (dataSource == null)
		{		    
			jp = JasperFillManager.fillReport(jr, jasperReportMap, new JREmptyDataSource());
		}
		else
		{
			conn = dataSourceProvider.getConnection(dataSource.getId());
			jp = JasperFillManager.fillReport(jr, jasperReportMap, conn);
		}

		if (jp == null || jp.getPages().size() < 1) throw new ProviderException(LocalStrings.ERROR_REPORT_EMPTY);

		return jp;
	}
	catch (Exception e)
	{
           if (!e.getMessage().equals(LocalStrings.ERROR_REPORT_EMPTY)) log.error("JasperReportEngine.fillReport", e);
		throw new ProviderException(e.getMessage());
	}
	finally
	{
		try
		{
			if (conn != null) conn.close();
		}
		catch (Exception ex)
		{
			log.error("Error closing connection: " + ex.getMessage());
		}
	}
}
 
开发者ID:caherrerapa,项目名称:openreportsv2,代码行数:81,代码来源:JasperReportEngine.java



注:本文中的net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Util类代码示例发布时间:2022-05-23
下一篇:
Java HepPlanner类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap