Example usage for javax.transaction SystemException printStackTrace

List of usage examples for javax.transaction SystemException printStackTrace

Introduction

In this page you can find the example usage for javax.transaction SystemException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.alfresco.reporting.action.executer.ReportExecuter.java

/**
 * processReport executes a JasperReports/iReport Report
 * @param jrxmlNodeRef the noderef containing the report definition
 * @param outputNodeRef the noderef containing the resulting report (pdf, doc...)
 * @param outputType the type of report to generate [pdf, html, doc, xls]
 *///from   w w w .ja va 2  s.co  m
public void processReport(NodeRef inputNodeRef, NodeRef outputNodeRef, String outputType, Action action) {
    logger.debug("starting ProcessReport generating a " + outputType);
    try {
        jndiName = globalProperties.getProperty("reporting.db.jndiName", "");
        if (isExecutionEnabled()) {
            String name = serviceRegistry.getNodeService().getProperty(inputNodeRef, ContentModel.PROP_NAME)
                    .toString();
            Reportable reportable = null;
            if (name.toLowerCase().endsWith(".jrxml") || name.toLowerCase().endsWith(".jasper")) {
                logger.debug("It is a Jasper thingy!");
                reportable = new JasperReporting();
            }
            if (name.endsWith(PentahoReporting.EXTENSION)) {
                logger.debug("It is a Pentaho thingy!");
                reportable = new PentahoReporting();
            }
            if (reportable != null) {
                reportable.setGlobalProperties(globalProperties);
                reportable.setDatabaseHelper(dbhb);
                //reportable.setUsername(dbhb.getUsername());
                //reportable.setPassword(dbhb.getPassword());
                //reportable.setDriver(dbhb.getJdbcDriver());
                //reportable.setUrl(dbhb.getDatabase()); 
                //reportable.setConnection(dbhb.getConnection()); // NEVER set this connection. We need no conn!
                reportable.setServiceRegistry(serviceRegistry);
                reportable.setReportDefinition(inputNodeRef);
                reportable.setOutputFormat(outputType);
                reportable.setResultObject(outputNodeRef);
                reportable.setMimetype(outputType);

                String separator = (String) action.getParameterValue(SEPARATOR);

                if ((separator != null) && !separator.equals("")) {
                    String param1 = (String) action.getParameterValue(PARAM_1);
                    String param2 = (String) action.getParameterValue(PARAM_2);
                    String param3 = (String) action.getParameterValue(PARAM_3);
                    String param4 = (String) action.getParameterValue(PARAM_4);
                    String key = "";
                    String value = "";
                    if ((param1 != null) && !param1.equals("")) {
                        if (param1.indexOf(separator) > 1) {
                            key = param1.split(separator)[0];
                            value = param1.split(separator)[1];
                            reportable.setParameter(key, value);
                            logger.debug("1Setting: " + key + "=" + value);
                        }
                    }
                    if ((param2 != null) && !param2.equals("")) {
                        if (param2.indexOf(separator) > 1) {
                            key = param2.split(separator)[0];
                            value = param2.split(separator)[1];
                            reportable.setParameter(key, value);
                            logger.debug("2Setting: " + key + "=" + value);
                        }
                    }
                    if ((param3 != null) && !param3.equals("")) {
                        if (param3.indexOf(separator) > 1) {
                            key = param3.split(separator)[0];
                            value = param3.split(separator)[1];
                            reportable.setParameter(key, value);
                            logger.debug("3Setting: " + key + "=" + value);
                        }
                    }
                    if ((param4 != null) && !param4.equals("")) {
                        if (param4.indexOf(separator) > 1) {
                            key = param4.split(separator)[0];
                            value = param4.split(separator)[1];
                            reportable.setParameter(key, value);
                            logger.debug("4Setting: " + key + "=" + value);
                        }
                    }
                }

                logger.debug("Lets go processReport!");
                reportable.processReport();
            } else {
                logger.error(name + " is not a valid report definition");
            }
        } else {
            logger.warn("Alfresco Business Reporting is NOT enabled...");
        }
    } catch (SystemException se) {
        se.printStackTrace();
    }
}