From 7f080a63262e9d31de670fb8866ac9bbfda2b678 Mon Sep 17 00:00:00 2001 From: Carlos Alberto Date: Wed, 6 Apr 2016 13:39:20 -0300 Subject: [PATCH] Implementação dos recursos de relatório --- cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/JasperReportManagerImpl.java | 8 ++++++-- cit-esi-web/src/main/resources/reports/empregado.jrxml | 9 ++++++--- cit-esi-web/src/main/resources/reports/empregado_telefone.jrxml | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/JasperReportManagerImpl.java b/cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/JasperReportManagerImpl.java index e939f36..bec5e25 100644 --- a/cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/JasperReportManagerImpl.java +++ b/cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/JasperReportManagerImpl.java @@ -5,6 +5,7 @@ import java.io.FileOutputStream; import java.sql.Connection; import java.util.HashMap; import java.util.List; +import java.util.Map; import net.sf.jasperreports.engine.JRDataSource; import net.sf.jasperreports.engine.JRException; @@ -52,12 +53,15 @@ public class JasperReportManagerImpl extends ReportManagerImpl implements Jasper throw new EsiExecutionException(e1); } + Map params = this.buildParams(report, inputMap); + params.put("SUBREPORT_DIR", servletContext.getRealPath(path)+"/"); + switch (report.getDataSource().getType()) { case CONNECTION: Connection connection = dataSourceService.connect(report.getDataSource().getConnection()); try { - print = JasperFillManager.fillReport(pathReportJasper, this.buildParams(report, inputMap), connection); + print = JasperFillManager.fillReport(pathReportJasper, params, connection); } catch (JRException e) { e.printStackTrace(); try { @@ -71,7 +75,7 @@ public class JasperReportManagerImpl extends ReportManagerImpl implements Jasper default: try { - print = JasperFillManager.fillReport(pathReportJasper, this.buildParams(report, inputMap), this.buildDataSource(report, inputMap)); + print = JasperFillManager.fillReport(pathReportJasper, params, this.buildDataSource(report, inputMap)); } catch (JRException e) { throw new EsiExecutionException(e); } diff --git a/cit-esi-web/src/main/resources/reports/empregado.jrxml b/cit-esi-web/src/main/resources/reports/empregado.jrxml index 0494b95..40a8513 100644 --- a/cit-esi-web/src/main/resources/reports/empregado.jrxml +++ b/cit-esi-web/src/main/resources/reports/empregado.jrxml @@ -4,8 +4,11 @@ - + + + + @@ -55,8 +58,8 @@ - - + + diff --git a/cit-esi-web/src/main/resources/reports/empregado_telefone.jrxml b/cit-esi-web/src/main/resources/reports/empregado_telefone.jrxml index e50f151..6c5cef3 100644 --- a/cit-esi-web/src/main/resources/reports/empregado_telefone.jrxml +++ b/cit-esi-web/src/main/resources/reports/empregado_telefone.jrxml @@ -10,9 +10,9 @@ - + - + -- libgit2 0.21.2