try {
template = supplier.getReportResources(null, templateName);
} catch (ReportingException e) {
throw new ReportingException("Failed get template " + templateName, e);
}
JasperPrintProvider jasperPrintProvider = new JasperPrintProvider();
ReportDataSourceManager reportDataSourceManager = new ReportDataSourceManager();
Connection connection;
if (template != null) {
connection = reportDataSourceManager.getJDBCConnection(dataSourceName);
} else {
throw new ReportingException("empty report template found :" + templateName);
}
JasperPrint jasperPrint;
if (connection != null) {
try {
jasperPrint = jasperPrintProvider.createJasperPrint(connection, template, reportParamMap);
} catch (JRException e) {
throw new JRException("Can't create JasperPrint Object from " + templateName, e);
}
} else {
throw new ReportingException("valid data source not found " + dataSourceName);