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

Java JRXmlDataSource类代码示例

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

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



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

示例1: gerarDanfeNfse

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
private static void gerarDanfeNfse(String url, List<String> emit, List<String> dest, List<String> ser, List<String> nota, String xml, String logo) {
    try {
        // Teste
        //String compilado = System.getProperty("user.dir") + "/danfe_nfce_80.jasper";;
        String output = "danfe.pdf"; 
        map.put("emit", emit);
        map.put("dest", dest);
        map.put("ser", ser);
        map.put("nota", nota);
        map.put("logo", logo);
        // brasao
        String brasao = Paths.get(System.getProperty("user.dir"), "danfe","brasao.png").toAbsolutePath().toString();
        map.put("brasao", brasao);
        // JrDataSource
        JRDataSource jr = new JRXmlDataSource(xml);
        // Relatório compilado
        JasperReport report = (JasperReport) JRLoader.loadObjectFromFile(url);
        JasperPrint print = JasperFillManager.fillReport(report, map, jr);
        JasperExportManager.exportReportToPdfFile(print, output);
    } catch (JRException e) {
        System.out.println("erro: "+e.getMessage());
    }
}
 
开发者ID:juniortada,项目名称:Java-Danfe,代码行数:24,代码来源:DanfeNfe.java


示例2: execute

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public static JasperPrint execute(int[] hits, String query) {
	itemMap = new HashMap<String, Item>();

	for (int i = 0; i < hits.length; i++) {
		process(BisisApp.getRecordManager().getRecord(hits[i]));
	}
	StringBuffer buff = new StringBuffer();
	buff.append("<report>\n");
	List keys = new ArrayList();
	keys.addAll(itemMap.keySet());
	Collections.sort(keys);
	Iterator branchIDs = keys.iterator();
	while (branchIDs.hasNext()) {
		String key = (String) branchIDs.next();
		Item item = (Item) itemMap.get(key);
		buff.append(item.toString());
	}
	buff.append("</report>\n");
	try {
		JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
				.getDocumentFromString(buff.toString()), "/report/item");
		Map param = new HashMap();
		param.put("query", query);
		JasperPrint jp = JasperFillManager
				.fillReport(
						NabavkaPoNacinu.class
								.getResource(
										"/com/gint/app/bisis4/client/hitlist/groupview/NabavkaPoNacinu.jasper")
								.openStream(), param, dataSource);
		return jp;

	} catch (Exception ex) {
		return null;
	}
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:36,代码来源:NabavkaPoNacinu.java


示例3: execute

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public static JasperPrint execute(int[] hits, String query) {
	itemMap = new HashMap<String, Item>();
	for (int i = 0; i < hits.length; i++) {
		process(BisisApp.getRecordManager().getRecord(hits[i]));
	}
	StringBuffer buff = new StringBuffer();
	buff.append("<report>\n");
	List keys = new ArrayList();
	keys.addAll(itemMap.keySet());
	Collections.sort(keys);
	Iterator branchIDs = keys.iterator();
	while (branchIDs.hasNext()) {
		String key = (String) branchIDs.next();
		Item item = (Item) itemMap.get(key);
		buff.append(item.toString());
	}
	buff.append("</report>\n");
	try {
		JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils.getDocumentFromString(buff.toString()), "/report/item");
		Map param = new HashMap();
		param.put("query", query);
		JasperPrint jp = JasperFillManager
				.fillReport(
						PogodciPoPeriodu.class
								.getResource(
										"/com/gint/app/bisis4/client/hitlist/groupview/PogodciPoPeriodu.jasper")
								.openStream(), param, dataSource);
		return jp;

	} catch (Exception ex) {
		return null;
	}
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:34,代码来源:PogodciPoPeriodu.java


示例4: execute

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public static JasperPrint execute(int[] hits, String query) {
	itemMap = new HashMap<String, Item>();	
	for (int i = 0; i < hits.length; i++) {
		process(BisisApp.getRecordManager().getRecord(hits[i]));
	}
	StringBuffer buff = new StringBuffer();
	buff.append("<report>\n");
	List keys = new ArrayList();
	keys.addAll(itemMap.keySet());
	Collections.sort(keys);
	Iterator branchIDs = keys.iterator();
	while (branchIDs.hasNext()) {
		String key = (String) branchIDs.next();
		Item item = (Item) itemMap.get(key);
		buff.append(item.toString());
	}
	buff.append("</report>\n");
	try {
		JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
				.getDocumentFromString(buff.toString()), "/report/item");
		Map param = new HashMap();	
		param.put("query", query);
		JasperPrint jp = JasperFillManager
				.fillReport(
						PogodciPoPovezu.class
								.getResource(
										"/com/gint/app/bisis4/client/hitlist/groupview/PogodciPoPovezu.jasper")
								.openStream(), param, dataSource);
		return jp;

	} catch (Exception ex) {
		return null;
	}
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:35,代码来源:PogodciPoPovezu.java


示例5: execute

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public static JasperPrint execute(int[] hits, String query) {
	itemMap = new HashMap<String, Item>();
	for (int i = 0; i < hits.length; i++) {
		process(BisisApp.getRecordManager().getRecord(hits[i]));
	}
	StringBuffer buff = new StringBuffer();
	buff.append("<report>\n");
	List keys = new ArrayList();
	keys.addAll(itemMap.keySet());
	Collections.sort(keys);
	Iterator branchIDs = keys.iterator();
	while (branchIDs.hasNext()) {
		String key = (String) branchIDs.next();
		Item item = (Item) itemMap.get(key);
		buff.append(item.toString());
	}
	buff.append("</report>\n");
	try {
		JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
				.getDocumentFromString(buff.toString()), "/report/item");
		Map param = new HashMap();
		param.put("query", query);
		JasperPrint jp = JasperFillManager
				.fillReport(
						NabavkaPoNacinu.class
								.getResource(
										"/com/gint/app/bisis4/client/hitlist/groupview/JeziciPoOgrancima.jasper")
								.openStream(), param, dataSource);
		return jp;

	} catch (Exception ex) {
		return null;
	}
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:35,代码来源:PogodciPoJezicima.java


示例6: execute

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public static JasperPrint execute(int[] hits, String query,String fields) {
	itemMap = new HashMap<String, Item>();
    fieldList=fields.split(",");
	for (int i = 0; i < hits.length; i++) {
		process(BisisApp.getRecordManager().getRecord(hits[i]));
	}
	StringBuffer buff = new StringBuffer();
	buff.append("<report>\n");
	List keys = new ArrayList();
	keys.addAll(itemMap.keySet());
	Collections.sort(keys);
	Iterator fieldIDs = keys.iterator();
	while (fieldIDs.hasNext()) {
		String key = (String) fieldIDs.next();
		Item item = (Item) itemMap.get(key);
		buff.append(item.toString());
	}
	buff.append("\n</report>\n");
	try {
		JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
				.getDocumentFromString(buff.toString()), "/report/item");
		Map param = new HashMap();
		param.put("query", query);
		JasperPrint jp = JasperFillManager
				.fillReport(
						CountFields.class
								.getResource(
										"/com/gint/app/bisis4/client/hitlist/groupview/CountFields.jasper")
								.openStream(), param, dataSource);
		return jp;

	} catch (Exception ex) {
		return null;
	}
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:36,代码来源:CountFields.java


示例7: showReport

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
/**
 *  Prikazuje ucitani izvestaj.
 */
public static void showReport(String xml,String fileName, Report report) {
  HashMap<String, Object> params = new HashMap<String, Object>();
  try {
  for (ReportParam p : report.getReportSettings().getParams()){
    if(p.getName().compareToIgnoreCase("subjasper")==0){
  		JasperReport subreport = (JasperReport) JRLoader.loadObject(ReportUtils.class
			.getResource(p.getValue()).openStream());
  		params.put("subjasper", subreport);
  	}else{
       params.put(p.getName(), p.getValue());
  	}
  }

  DefaultJasperReportsContext context = DefaultJasperReportsContext.getInstance(); //dodato zbog jaxena
  JRPropertiesUtil.getInstance(context).setProperty("net.sf.jasperreports.xpath.executer.factory", "net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory");   
    
  params.put("period", getPeriod(fileName));
    JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
        .getDocumentFromString(xml), "/report/item");
    JasperPrint jp = JasperFillManager.fillReport(Report.class.getResource(
        report.getJasper()).openStream(), params, dataSource);
    BisisApp.getMainFrame().addReportFrame(report.getName(), jp);
  } catch (Exception ex) {
    ex.printStackTrace();
  }
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:30,代码来源:ReportUtils.java


示例8: runJasperReport

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public static JasperPrint runJasperReport(File aModelXMLFile, File aJRXMLFile) throws JRException,
		FileNotFoundException {

	String theFileName = aJRXMLFile.getAbsolutePath();
	int p = theFileName.indexOf(".jrxml");
	String theTemplateName = theFileName.substring(0, p) + ".jasper";

	File theTemplateFile = new File(theTemplateName);

	JasperDesign theDesign = JRXmlLoader.load(new FileInputStream(aJRXMLFile));
	JRQuery theQuery = theDesign.getQuery();
	String theQueryText = null;

	if (theQuery != null) {
		theQueryText = theQuery.getText();
	}
	if (StringUtils.isEmpty(theQueryText)) {
		throw new RuntimeException("Cannot extract query from Jasper template");
	}

	Map<String, Object> theParams = new HashMap<>();
	theParams.put(JRParameter.REPORT_LOCALE, Locale.getDefault());

	String theSubreportDir = theTemplateFile.getParent();
	if (!theSubreportDir.endsWith(File.separator)) {
		theSubreportDir += File.separator;
	}
	theParams.put("SUBREPORT_DIR", theSubreportDir);

	JRXmlDataSource theDataSource = new JRXmlDataSource(aModelXMLFile, theQueryText);
	return JasperFillManager.fillReport(new FileInputStream(theTemplateFile), theParams,
			theDataSource);
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:34,代码来源:JasperUtils.java


示例9: testGetXmlDataSource

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
/**
 * Test of getXmlDataSource method, of class Db.
 */
@Test
public void testGetXmlDataSource() throws Exception {
	System.out.println("getxmlDataSource");
	Config config = new Config();
	config.dbType = DsType.xml;
	config.dataFile = new File("target/test-classes/CancelAck.xml");
	config.xmlXpath = "/CancelResponse/CancelResult/ID";
	Db instance = new Db();
	JRXmlDataSource jRXmlDataSource = instance.getXmlDataSource(config);
	jRXmlDataSource.next();
	// ToDo: don't know jet how to get any value out of it here. 
	// So just checking if object exists:
	assertEquals(jRXmlDataSource.getClass().getCanonicalName(), "net.sf.jasperreports.engine.data.JRXmlDataSource");
}
 
开发者ID:vosskaem,项目名称:jasperstarter,代码行数:18,代码来源:DbNGTest.java


示例10: GenerateByXML

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
private void GenerateByXML() throws Exception {
    if (this.m_strRootXPath.isEmpty()) {
        throw new Exception("Root XPath is required.");
    }

    Map<String, Object> hm = new HashMap<String, Object>();
    File file = new File(m_strDataSourceFile);

    if (!file.canRead()) {
        throw new Exception("Unable to read XML data source file.");
    }

    JRXmlDataSource jrxmlds = new JRXmlDataSource(file, m_strRootXPath);
    exportOutputFile(JasperFillManager.fillReport(m_strJasperCompiledFile, hm, jrxmlds));
}
 
开发者ID:CoEIA,项目名称:DEM,代码行数:16,代码来源:DisclosureReport.java


示例11: createSubreport

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
private JasperReportBuilder createSubreport() throws JRException {
	JasperReportBuilder report = report();
	report.setLocale(Locale.ENGLISH)
		.columns(
			column4 =	col.column("Column4", field("field4", type.stringType()).setDescription("@field4")),
			column5 =	col.column("Column5", field("field5", type.integerType()).setDescription("field5")),
			column6 =	col.column("Column6", field("field6", type.bigDecimalType())))
		.setUseFieldNameAsDescription(false)
		.setDataSource(new JRXmlDataSource(XmlReportTest.class.getResourceAsStream("data.xml"), "/data/row2"));
	return report;
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:12,代码来源:XmlReportTest.java


示例12: execute

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public static JasperPrint execute(int[]hits, String query) {
  HashMap branchMap = new HashMap();
  for (int i = 0; i < hits.length; i++) {
    process(BisisApp.getRecordManager().getRecord(hits[i]), branchMap);
  }
  
  StringBuffer buff = new StringBuffer();
  buff.append("<report>\n");
  List keys = new ArrayList();
  keys.addAll(branchMap.keySet());
  Collections.sort(keys);
  Iterator branchIDs = keys.iterator();
  int sum = 0;
  while (branchIDs.hasNext()) {
    String key = (String)branchIDs.next();
    Integer value = (Integer)branchMap.get(key);
    buff.append("  <row><branch>");
    buff.append(key);
/*    buff.append(" - ");
    buff.append(HoldingsDataCoders.getValue(HoldingsDataCoders.ODELJENJE_CODER, key));*/
    buff.append("</branch><count>");
    buff.append(value);
    buff.append("</count></row>\n");
    sum += value.intValue();
  }
  buff.append("  <row><branch>Ukupno primeraka</branch><count>");
  buff.append(sum);
  buff.append("</count></row>\n");
  buff.append(" <row><branch>Ukupno zapisa</branch><count>");
  buff.append(hits.length);
  buff.append("</count></row>\n");
  buff.append("</report>\n");
  try {
   JRXmlDataSource dataSource = new JRXmlDataSource(
      XMLUtils.getDocumentFromString(buff.toString()), "/report/row");
Map param=new HashMap();
param.put("query", query);
    JasperPrint jp = JasperFillManager.fillReport(
        PogodciPoOgrancima.class.getResource(
          "/com/gint/app/bisis4/client/hitlist/groupview/PogodciPoOgrancima.jasper")
        .openStream(),param, dataSource);
      return jp;

  } catch (Exception ex) {
     return null;
  }
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:48,代码来源:PogodciPoOgrancima.java


示例13: execute

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public static JasperPrint execute(int[] hits, String query) {
	itemMap = new HashMap<String, Item>();
	oldQuery = query;
	int indexBI = query.indexOf("BI:");
	int indexAP = query.indexOf("AP:");
	if (indexAP != -1) {
		odeljenjeQuery = oldQuery.substring(indexAP);
		if (odeljenjeQuery.indexOf(" ")!= -1){
		odeljenjeQuery = odeljenjeQuery.substring(3,odeljenjeQuery.indexOf(" ") );
	    }else{
		   odeljenjeQuery = odeljenjeQuery.substring(3);
	    }
	}
	if(!query.contains("BI:"))
		return null;
	query = query.substring(indexBI);
	int indexS = query.indexOf(" ");
	if (indexS != -1)
		query = query.substring(0, indexS);
	if (query.contains("*")) {
		datefromQuery = query.substring(3).replace("*", ".*");
	} else if (query.contains("?")) {
		datefromQuery = query.substring(3).replace("?", ".*");
	} else {
		datefromQuery = query.substring(3);
	}
	datefromQuery=".*"+datefromQuery+".*";
	for (int i = 0; i < hits.length; i++) {
		process(BisisApp.getRecordManager().getRecord(hits[i]));	
	}
	StringBuffer buff = new StringBuffer();
	buff.append("<report>\n");
	List keys = new ArrayList();
	keys.addAll(itemMap.keySet());
	Collections.sort(keys);
	Iterator branchIDs = keys.iterator();
	while (branchIDs.hasNext()) {
		String key = (String) branchIDs.next();
		Item item = (Item) itemMap.get(key);
		buff.append(item.toString());
	}
	buff.append("</report>\n");
	try {
		JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
				.getDocumentFromString(buff.toString()), "/report/item");
		Map param = new HashMap();
		param.put("query", oldQuery);
		JasperPrint jp = JasperFillManager
				.fillReport(
						PogodciPoInvNapomeni.class
								.getResource(
										"/com/gint/app/bisis4/client/hitlist/groupview/PogodciPoInvNapomeni.jasper")
								.openStream(), param, dataSource);
		return jp;

	} catch (Exception ex) {
		ex.printStackTrace();
		return null;
	}
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:61,代码来源:PogodciPoInvNapomeni.java


示例14: execute

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public static JasperPrint execute(int[] hits, String query) {
	itemMap = new HashMap<String, Item>();
	if(query.startsWith("DA:")){
		if(query.contains("*")){
			datefromQuery=query.substring(3).replace("*", "");
		}else if(query.contains("?")){
			datefromQuery=query.substring(3).replace("?", "");
		}else{
		datefromQuery=query.substring(3);
		}
		
	}
	for (int i = 0; i < hits.length; i++) {
		process(BisisApp.getRecordManager().getRecord(hits[i]));
	}

	StringBuffer buff = new StringBuffer();
	buff.append("<report>\n");
	List keys = new ArrayList();
	keys.addAll(itemMap.keySet());
	Collections.sort(keys);
	Iterator branchIDs = keys.iterator();
	while (branchIDs.hasNext()) {
		String key = (String) branchIDs.next();
		Item item = (Item) itemMap.get(key);
		buff.append(item.toString());
	}
	buff.append("</report>\n");
	try {
		JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
				.getDocumentFromString(buff.toString()), "/report/item");
		Map param = new HashMap();
		param.put("query", query);
		param.put("datum", datefromQuery);
		if(query.startsWith("DA:")){
			param.put("query", datefromQuery);
		}
		JasperPrint jp = JasperFillManager
				.fillReport(
						PogodciPoDatumuInventara.class
								.getResource(
										"/com/gint/app/bisis4/client/hitlist/groupview/BranchesPoDatumu.jasper")
								.openStream(), param, dataSource);
		return jp;

	} catch (Exception ex) {
		ex.printStackTrace();
		return null;
	}
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:51,代码来源:PogodciPoDatumuInventara.java


示例15: getReport

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
private void getReport(){
		try{
      doc = makeDoc(getTfBegDate().getDate(), getTfEndDate().getDate());
      if (doc != null){
        if (getChbSave().isSelected()){
          getManager().saveWarnings(warn_to_save, counters);
        }
  			boolean cyr = false;
  			if (doc.getRoot().getCirilica() == 1){
  				cyr = true;
  			}
  			
  			StringWriter sw = new StringWriter();
  			XmlOptions xmlOptions = new XmlOptions();
        xmlOptions.setSavePrettyPrint();
        doc.save(sw,xmlOptions);
        JasperReport subreport = (JasperReport)JRLoader.loadObject(
            WarningsFrame.class.getResource(
              "/com/gint/app/bisis4/client/circ/warnings/jaspers/details.jasper").openStream());
         JasperReport warning = (JasperReport)JRLoader.loadObject(
              WarningsFrame.class.getResource(
                "/com/gint/app/bisis4/client/circ/warnings/jaspers/warning.jasper").openStream());
  		   Map params = new HashMap(2);
  		   params.put("sub", subreport);
  		   params.put("warning", warning);
  	   
//             JRXmlDataSource ds = new JRXmlDataSource(XMLUtils
//                     .getDocumentFromString(sw.toString()), "/root/opomena");
             //JRXmlDataSource ds = new JRXmlDataSource(new ByteArrayInputStream((sw.toString().getBytes())), "/root/opomena");
             JRXmlDataSource ds = new JRXmlDataSource(doc.newInputStream(), "/root/opomena");
             JasperPrint jp = JasperFillManager.fillReport(
                     WarningsFrame.class.getResource(
                         "/com/gint/app/bisis4/client/circ/warnings/jaspers/all.jasper").openStream(), 
                         params, ds);   
             JRViewer jr = new JRViewer(jp);
             getReportPanel().add(jr, java.awt.BorderLayout.CENTER);
             
             
             String naslov = Utils.convert("Spisak " + ((WarningTypes)getCmbType().getSelectedItem()).getName() + " posaltih na dan " + new SimpleDateFormat("dd.MM.yyyy.").format(new Date()), cyr);
             String rbr = Utils.convert("R.br.", cyr);
             String bropomene = Utils.convert("Br.opomene", cyr);
             String brclana = Utils.convert("Br.\u010dlana", cyr);
             String ime = Utils.convert("Prezime i ime", cyr);
             String datum = Utils.convert("Rok vra\u0107anja", cyr);
             //String napomena = Utils.convert("Napomena", cyr);
             Map paramslist = new HashMap(7);
      	   paramslist.put("naslov", naslov);
      	   paramslist.put("rbr", rbr);
      	   paramslist.put("bropomene", bropomene);
      	   paramslist.put("brclana", brclana);
      	   paramslist.put("ime", ime);
      	   paramslist.put("datum", datum);
      	   //paramslist.put("napomena", napomena);
      	   
      	   JRXmlDataSource dslist = new JRXmlDataSource(XMLUtils
                     .getDocumentFromString(sw.toString()), "/root/opomena");
           JasperPrint jplist = JasperFillManager.fillReport(
                   WarningsFrame.class.getResource(
                       "/com/gint/app/bisis4/client/circ/warnings/jaspers/list.jasper").openStream(), 
                       paramslist, dslist);           
           JRViewer jrlist = new JRViewer(jplist);
           getReportListPanel().add(jrlist, java.awt.BorderLayout.CENTER);
      }    
		}catch(Exception e){
			e.printStackTrace();
		}
	}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:68,代码来源:WarningsFrame.java


示例16: run

import net.sf.jasperreports.engine.data.JRXmlDataSource; //导入依赖的package包/类
public JasperPrint run(String odInvBr, String doInvBr, String reportName) {
	JasperPrint jp = null;
	try {
		List<String> listaInventarnih = new ArrayList<String>();
		int odBr = Integer.parseInt(odInvBr.substring(4));
		String odeljenje = odInvBr.substring(0, 2);
		String tippubl = odInvBr.substring(2, 4);
		int doBr = Integer.parseInt(doInvBr.substring(4));
		for (int brojac = odBr; brojac <= doBr; brojac++) {
			String brojStr = String.valueOf(brojac);
			brojStr = "00000000000".substring(0, 7 - brojStr.length())
					+ brojStr;
			listaInventarnih.add(odeljenje + tippubl + brojStr);
		}
		CachingWrapperFilter filter = new CachingWrapperFilter(
				new BisisFilter(listaInventarnih));
		Result result = BisisApp.getRecordManager().selectAll3x(
				SerializationUtils.serialize(new MatchAllDocsQuery()),
				SerializationUtils.serialize(filter), null);
		Record[] records = BisisApp.getRecordManager().getRecords(result.getRecords());
		StringBuffer buff = new StringBuffer();
		
		for (Report r : reportCollection.getReports()) {
			
			if (!r.getReportSettings().getParam("menuitem").equalsIgnoreCase(reportName)) 
				continue;
			    buff.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
			    buff.append("<report>");
				r.init();
				for (Record rec : records) {
					r.handleRecord(rec);					
				}
				r.finishOnline(buff);
				buff.append("</report>");
				JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
						.getDocumentFromString(buff.toString()),
						"/report/item");
				Map param = new HashMap();
				if (r.getReportSettings().getParam("subjasper") != null) {
					JasperReport subreport = (JasperReport) JRLoader
							.loadObject(ReportRunner.class.getResource(
									r.getReportSettings().getParam(
											"subjasper")).openStream());
					param.put("subjasper", subreport);
				}
				jp = JasperFillManager.fillReport(ReportRunner.class
						.getResource(
								r.getReportSettings().getParam("jasper"))
						.openStream(), param, dataSource);
			}
		

	} catch (Exception e) {
		e.printStackTrace();
	}
	return jp;
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:58,代码来源:ReportRunner.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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