當前位置: 首頁>>代碼示例>>Java>>正文


Java JRException.getMessage方法代碼示例

本文整理匯總了Java中net.sf.jasperreports.engine.JRException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java JRException.getMessage方法的具體用法?Java JRException.getMessage怎麽用?Java JRException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.sf.jasperreports.engine.JRException的用法示例。


在下文中一共展示了JRException.getMessage方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: printPagePartePDF

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
private void printPagePartePDF(HttpServletResponse response, VariablesSecureApp vars,
    String strcOrderId) throws IOException, ServletException {
  if (log4j.isDebugEnabled())
    log4j.debug("Output: pdf");
  String strLanguage = vars.getLanguage();
  String strBaseDesign = getBaseDesignPath(strLanguage);

  HashMap<String, Object> parameters = new HashMap<String, Object>();
  JasperReport jasperReportLines;
  try {
    jasperReportLines = ReportingUtils.compileReport(strBaseDesign
        + "/org/openbravo/erpReports/RptC_OrderPO_Lines.jrxml");
  } catch (JRException e) {
    e.printStackTrace();
    throw new ServletException(e.getMessage());
  }
  parameters.put("SR_LINES", jasperReportLines);
  parameters.put("ORDER_ID", strcOrderId);
  renderJR(vars, response, null, "pdf", parameters, null, null);
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:21,代碼來源:RptC_OrderPO.java

示例2: printPagePartePDF

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
private void printPagePartePDF(HttpServletResponse response, VariablesSecureApp vars,
    String strmRequisitionId) throws IOException, ServletException {
  if (log4j.isDebugEnabled())
    log4j.debug("Output: pdf");
  String strBaseDesign = getBaseDesignPath(vars.getLanguage());

  HashMap<String, Object> parameters = new HashMap<String, Object>();
  JasperReport jasperReportLines;
  try {
    jasperReportLines = ReportingUtils.compileReport(strBaseDesign
        + "/org/openbravo/erpReports/RptM_Requisition_Lines.jrxml");
  } catch (JRException e) {
    e.printStackTrace();
    throw new ServletException(e.getMessage());
  }

  parameters.put("SR_LINES", jasperReportLines);
  parameters.put("REQUISITION_ID", strmRequisitionId);
  renderJR(vars, response, null, "pdf", parameters, null, null);
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:21,代碼來源:RptM_Requisition.java

示例3: printPagePartePDF

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
private void printPagePartePDF(HttpServletResponse response, VariablesSecureApp vars,
    String strClave) throws IOException, ServletException {
  if (log4j.isDebugEnabled())
    log4j.debug("Output: pdf - ID:" + strClave);
  RptCProposalJrData[] data = RptCProposalJrData.select(this, strClave,
      Utility.getContext(this, vars, "#User_Client", "RptC_ProposalJr"),
      Utility.getContext(this, vars, "#AccessibleOrgTree", "RptC_ProposalJr"));
  String strLanguage = vars.getLanguage();
  String strBaseDesign = getBaseDesignPath(strLanguage);

  JasperReport jasperReportLines;
  try {
    jasperReportLines = ReportingUtils.compileReport(strBaseDesign
        + "/org/openbravo/erpReports/SubreportLines.jrxml");
  } catch (JRException e) {
    e.printStackTrace();
    throw new ServletException(e.getMessage());
  }
  HashMap<String, Object> parameters = new HashMap<String, Object>();
  parameters.put("SR_LINES", jasperReportLines);

  String strOutput = "pdf";
  String strReportName = "@[email protected]/org/openbravo/erpReports/RptC_ProposalJr.jrxml";
  renderJR(vars, response, strReportName, strOutput, parameters, data, null);
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:26,代碼來源:RptC_ProposalJr.java

示例4: print

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
/**
 *
 */
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
	if (Thread.currentThread().isInterrupted())
	{
		throw new PrinterException("Current thread interrupted.");
	}

	pageIndex += pageOffset;

	if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
	{
		return Printable.NO_SUCH_PAGE;
	}

	try
	{
		JRGraphics2DExporter exporter = new JRGraphics2DExporter();
		exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
		exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
		exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
		exporter.exportReport();
	}
	catch (JRException e)
	{
		e.printStackTrace();
		throw new PrinterException(e.getMessage());
	}

	return Printable.PAGE_EXISTS;
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:34,代碼來源:JRPrinterAWT300.java

示例5: printPagePDF

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
private void printPagePDF(HttpServletResponse response, VariablesSecureApp vars,
    String strcRemittanceId, String language) throws IOException, ServletException {
  if (log4j.isDebugEnabled())
    log4j.debug("Output: pdf");

  String strBaseDesign = getBaseDesignPath(language);

  String strOutput = new String("pdf");

  String strReportName = "@[email protected]/org/openbravo/erpReports/RptC_Remittance.jrxml";

  if (strOutput.equals("pdf"))
    response.setHeader("Content-disposition", "inline; filename=RptC_Remittance.pdf");

  RptCRemittanceData[] data = RptCRemittanceData
      .select(this, Utility.getContext(this, vars, "#User_Client", "RptC_RemittanceJR"),
          Utility.getContext(this, vars, "#AccessibleOrgTree", "RptC_RemittanceJR"),
          strcRemittanceId);

  JasperReport jasperReportLines;
  try {
    jasperReportLines = ReportingUtils.getTranslatedJasperReport(this, strBaseDesign
        + "/org/openbravo/erpReports/RptC_Remittance_Lines.jrxml", vars.getLanguage(),
        strBaseDesign);
  } catch (JRException e) {
    e.printStackTrace();
    throw new ServletException(e.getMessage());
  }

  HashMap<String, Object> parameters = new HashMap<String, Object>();
  parameters.put("LANGUAGE", language);
  parameters.put("SR_LINES", jasperReportLines);

  renderJR(vars, response, strReportName, strOutput, parameters, data, null);
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:36,代碼來源:RptC_Remittance.java

示例6: print

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
	if (Thread.interrupted())
	{
		throw new PrinterException("Current thread interrupted.");
	}

	pageIndex += pageOffset;

	if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
	{
		return Printable.NO_SUCH_PAGE;
	}

	try
	{
		JRGraphics2DExporter exporter = new JRGraphics2DExporter(jasperReportsContext);
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		SimpleGraphics2DExporterOutput output = new SimpleGraphics2DExporterOutput();
		output.setGraphics2D((Graphics2D)graphics);
		exporter.setExporterOutput(output);
		SimpleGraphics2DReportConfiguration configuration = new SimpleGraphics2DReportConfiguration();
		configuration.setPageIndex(pageIndex);
		exporter.setConfiguration(configuration);
		exporter.exportReport();
	}
	catch (JRException e)
	{
		if (log.isDebugEnabled())
		{
			log.debug("Print failed.", e);
		}

		throw new PrinterException(e.getMessage()); //NOPMD
	}

	return Printable.PAGE_EXISTS;
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:40,代碼來源:JRPrinterAWT.java

示例7: print

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
	if (Thread.interrupted())
	{
		throw new PrinterException("Current thread interrupted.");
	}

	if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
	{
		return Printable.NO_SUCH_PAGE;
	}
	
	SimpleGraphics2DExporterOutput output = new SimpleGraphics2DExporterOutput();
	output.setGraphics2D((Graphics2D)graphics);
	exporter.setExporterOutput(output);

	grxConfiguration.setPageIndex(pageIndex);
	exporter.setConfiguration(grxConfiguration);
	
	try
	{
		exporter.exportReport();
	}
	catch (JRException e)
	{
		throw new PrinterException(e.getMessage()); //NOPMD
	}

	return Printable.PAGE_EXISTS;
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:32,代碼來源:JRPrintServiceExporter.java

示例8: loadJasperDesign

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
public static JasperDesign loadJasperDesign(byte[] template) throws SchemaException{
	    	try	 {
	    	byte[] reportTemplate = Base64.decodeBase64(template);
		 	
		 	InputStream inputStreamJRXML = new ByteArrayInputStream(reportTemplate);
		 	JasperDesign jasperDesign = JRXmlLoader.load(inputStreamJRXML);
//		 	LOGGER.trace("load jasper design : {}", jasperDesign);
		 	return jasperDesign;
	    	} catch (JRException ex){
	    		throw new SchemaException(ex.getMessage(), ex.getCause());
	    	}
	    }
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:13,代碼來源:ReportTypeUtil.java

示例9: processSubReports

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
/**
 * Generates sub-reports and adds them into the parameter map.
 * 
 * @param templateFile
 *          The path to the JR template of the report.
 * @param parameters
 *          The parameters to be sent to Jasper Report.
 * @param baseDesignPath
 *          Base design path.
 * @param connectionProvider
 *          A connection provider in case the report needs it.
 * @param language
 *          Language to be used when generating the sub-report.
 * @throws OBException
 *           In case there is any error generating the sub-reports an exception is thrown with the
 *           error message.
 */
private static void processSubReports(String templateFile, Map<String, Object> parameters,
    String baseDesignPath, ConnectionProvider connectionProvider, String language)
    throws OBException {
  try {
    JasperDesign jasperDesign = JRXmlLoader.load(templateFile);

    Object[] parameterList = jasperDesign.getParametersList().toArray();
    String parameterName = "";
    String subReportName = "";
    Collection<String> subreportList = new ArrayList<String>();
    File template = new File(templateFile);
    String templateLocation = template.getParent() + "/";

    /*
     * TODO: At present this process assumes the subreport is a .jrxml file. Need to handle the
     * possibility that this subreport file could be a .jasper file.
     */
    for (int i = 0; i < parameterList.length; i++) {
      final JRDesignParameter parameter = (JRDesignParameter) parameterList[i];
      if (parameter.getName().startsWith("SUBREP_")) {
        parameterName = parameter.getName();
        subreportList.add(parameterName);
        subReportName = Replace.replace(parameterName, "SUBREP_", "") + ".jrxml";
        JasperReport jasperReportLines = createSubReport(templateLocation, subReportName,
            baseDesignPath, connectionProvider, language);
        parameters.put(parameterName, jasperReportLines);
      }
    }

  } catch (final JRException e) {
    log.error("Error processing subreports for template: " + templateFile, e);
    throw new OBException(e.getMessage(), e);
  }
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:52,代碼來源:ReportingUtils.java

示例10: doPost

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException,
    ServletException {
  VariablesSecureApp vars = new VariablesSecureApp(request);
  String strTabId = vars.getRequiredStringParameter("inpTabId");
  String strWindowId = vars.getRequiredStringParameter("inpWindowId");
  String strAccessLevel = vars.getRequiredStringParameter("inpAccessLevel");
  if (log4j.isDebugEnabled())
    log4j.debug("Export grid, tabID: " + strTabId);
  ServletOutputStream os = null;
  InputStream is = null;

  String strLanguage = vars.getLanguage();
  String strBaseDesign = getBaseDesignPath(strLanguage);
  String fileName = "";
  if (log4j.isDebugEnabled())
    log4j.debug("*********************Base design path: " + strBaseDesign);

  try {
    GridReportVO gridReportVO = createGridReport(vars, strTabId, strWindowId, strAccessLevel,
        vars.commandIn("EXCEL"));
    os = response.getOutputStream();
    is = getInputStream(strBaseDesign + "/org/openbravo/erpCommon/utility/"
        + gridReportVO.getJrxmlTemplate());

    if (log4j.isDebugEnabled())
      log4j.debug("Create report, type: " + vars.getCommand());
    UUID reportId = UUID.randomUUID();
    String strOutputType = vars.getCommand().toLowerCase();
    if (strOutputType.equals("excel")) {
      strOutputType = "xls";
    }
    fileName = "ExportGrid-" + (reportId) + "." + strOutputType;
    if (vars.commandIn("HTML"))
      GridBO.createHTMLReport(is, gridReportVO, globalParameters.strFTPDirectory, fileName);
    else if (vars.commandIn("PDF")) {
      GridBO.createPDFReport(is, gridReportVO, globalParameters.strFTPDirectory, fileName);
    } else if (vars.commandIn("EXCEL")) {
      GridBO.createXLSReport(is, gridReportVO, globalParameters.strFTPDirectory, fileName);
    } else if (vars.commandIn("CSV")) {
      GridBO.createCSVReport(is, gridReportVO, globalParameters.strFTPDirectory, fileName);
    }
    printPagePopUpDownload(os, fileName);
  } catch (JRException e) {
    e.printStackTrace();
    throw new ServletException(e.getMessage());
  } catch (IOException ioe) {
    try {
      FileUtility f = new FileUtility(globalParameters.strFTPDirectory, fileName, false, true);
      if (f.exists())
        f.deleteFile();
    } catch (IOException ioex) {
      log4j.error("Error trying to delete temporary report file " + fileName + " : "
          + ioex.getMessage());
    }
  } finally {
    is.close();
    os.close();
  }
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:60,代碼來源:ExportGrid.java

示例11: printPagePDF

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
private void printPagePDF(HttpServletResponse response, VariablesSecureApp vars,
    String strDateFrom, String strDateTo, String strRawMaterial) throws IOException,
    ServletException {

  if (log4j.isDebugEnabled())
    log4j.debug("Output: Jasper Report : Production Report");

  String strReportName = "@[email protected]/org/openbravo/erpCommon/ad_reports/productionReport.jrxml";
  response.setHeader("Content-disposition", "inline; filename=ProductionReportJR.pdf");

  String strTitle = "Production Report";
  String strSubTitle = Utility.messageBD(this, "From", vars.getLanguage()) + " " + strDateFrom
      + " " + Utility.messageBD(this, "To", vars.getLanguage()) + " " + strDateTo;

  // String strSubTitle = (!strDateFrom.equals("")?"From "+strDateFrom:"")
  // + (!strDateTo.equals("")?" to "+strDateTo:"");

  if (!strRawMaterial.equals("Y"))
    strRawMaterial = "N";

  ReportProductionData[] data = ReportProductionData.select(this, strRawMaterial,
      Utility.getContext(this, vars, "#User_Client", "ReportProductionJR"),
      Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportProductionJR"), strDateFrom,
      DateTimeData.nDaysAfter(this, strDateTo, "1"));

  if (data == null || data.length == 0) {
    data = ReportProductionData.set();
  }

  HashMap<String, Object> parameters = new HashMap<String, Object>();

  if (log4j.isDebugEnabled())
    log4j.debug("inpDateFrom:"
        + vars.getRequestGlobalVariable("inpDateFrom", "ReportProductionJR|DateFrom"));
  if (log4j.isDebugEnabled())
    log4j.debug("inpDateTo:"
        + vars.getRequestGlobalVariable("inpDateTo", "ReportProductionJR|DateFrom"));

  String strLanguage = vars.getLanguage();
  String strBaseDesign = getBaseDesignPath(strLanguage);

  JasperReport jasperReportLines;
  try {
    jasperReportLines = ReportingUtils.compileReport(strBaseDesign
        + "/org/openbravo/erpCommon/ad_reports/productionSubReport.jrxml");
  } catch (JRException e) {
    e.printStackTrace();
    throw new ServletException(e.getMessage());
  }
  parameters.put("SR_LINES", jasperReportLines);

  parameters.put("REPORT_TITLE", strTitle);
  parameters.put("REPORT_SUBTITLE", strSubTitle);

  try {
    if (!strDateFrom.equals(""))
      parameters.put("DATE_FROM", new SimpleDateFormat("dd-MM-yyyy").parse(strDateFrom));
    if (!strDateTo.equals(""))
      parameters.put("DATE_TO", new SimpleDateFormat("dd-MM-yyyy").parse(strDateTo));
  } catch (Exception ex) {
    throw new ServletException(ex);
  }

  if (log4j.isDebugEnabled())
    log4j.debug("parameters: " + parameters.toString());
  if (log4j.isDebugEnabled())
    log4j.debug("data: " + data);

  renderJR(vars, response, strReportName, "pdf", parameters, data, null);

}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:72,代碼來源:ReportProductionJR.java

示例12: printPagePartePDF

import net.sf.jasperreports.engine.JRException; //導入方法依賴的package包/類
private void printPagePartePDF(HttpServletResponse response, VariablesSecureApp vars,
    String strcOrderId) throws IOException, ServletException {

  if (log4j.isDebugEnabled())
    log4j.debug("Output: RptC_Order - pdf");
  RptCOrderHeaderData[] data = RptCOrderHeaderData.select(this, strcOrderId);
  if (log4j.isDebugEnabled())
    log4j.debug("data: " + (data == null ? "null" : "not null"));
  if (data == null || data.length == 0)
    data = RptCOrderHeaderData.set();

  String strLanguage = vars.getLanguage();
  String strBaseDesign = getBaseDesignPath(strLanguage);

  JasperReport jasperReportLines;
  try {
    jasperReportLines = ReportingUtils.compileReport(strBaseDesign
        + "/org/openbravo/erpReports/C_OrderLinesJR.jrxml");
  } catch (JRException e) {
    e.printStackTrace();
    throw new ServletException(e.getMessage());
  }

  HashMap<String, Object> parameters = new HashMap<String, Object>();
  parameters.put("SR_LINES", jasperReportLines);

  response.setHeader("Content-disposition", "inline; filename=SalesOrderJR.pdf");
  String strReportName = "@[email protected]/org/openbravo/erpReports/C_OrderJR.jrxml";
  renderJR(vars, response, strReportName, "pdf", parameters, data, null);
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:31,代碼來源:RptC_Order.java


注:本文中的net.sf.jasperreports.engine.JRException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。