public class ReportGenerationServiceImpl extends Object implements ReportGenerationService
Modifier and Type | Field and Description |
---|---|
protected org.kuali.rice.core.api.datetime.DateTimeService |
dateTimeService |
static String |
DESIGN_FILE_EXTENSION |
static String |
JASPER_REPORT_EXTENSION |
static String |
PARAMETER_NAME_SUBREPORT_DIR |
static String |
PARAMETER_NAME_SUBREPORT_TEMPLATE_NAME |
static String |
PDF_FILE_EXTENSION |
static String |
SEPARATOR |
Constructor and Description |
---|
ReportGenerationServiceImpl() |
Modifier and Type | Method and Description |
---|---|
String |
buildFullFileName(Date runDate,
String directory,
String fileName,
String extension)
build a full file name with the given information.
|
protected void |
compileReportTemplate(String designTemplate,
String jasperReport)
complie the report template xml file into a Jasper report file if the compiled file does not exist or is out of update
|
protected void |
compileSubReports(Map<String,String> subReports,
String subReportDirectory)
compile the given sub reports
|
void |
generateReportToOutputStream(Map<String,Object> reportData,
Object dataSource,
String template,
ByteArrayOutputStream baos)
generate a report as PDF file and outputs to stream
|
void |
generateReportToPdfFile(Map<String,Object> reportData,
Object dataSource,
String template,
String reportFileName)
The dataSource can be an instance of JRDataSource, java.util.Collection or object array.
|
void |
generateReportToPdfFile(Map<String,Object> reportData,
String template,
String reportFileName)
generate a report as PDF file with the given file name
|
protected org.springframework.core.io.ClassPathResource |
getReportTemplateClassPathResource(String reportTemplateName)
get a class path resource that references to the given report template
|
protected String |
removeTemplateExtension(org.springframework.core.io.ClassPathResource template)
remove the file extension of the given template if any
|
void |
setDateTimeService(org.kuali.rice.core.api.datetime.DateTimeService dateTimeService)
Sets the DateTimeService
|
protected org.kuali.rice.core.api.datetime.DateTimeService dateTimeService
public static final String PARAMETER_NAME_SUBREPORT_DIR
public static final String PARAMETER_NAME_SUBREPORT_TEMPLATE_NAME
public static final String DESIGN_FILE_EXTENSION
public static final String JASPER_REPORT_EXTENSION
public static final String PDF_FILE_EXTENSION
public static final String SEPARATOR
public ReportGenerationServiceImpl()
public void generateReportToPdfFile(Map<String,Object> reportData, String template, String reportFileName)
ReportGenerationService
generateReportToPdfFile
in interface ReportGenerationService
reportData
- the data being written into the PDF report filetemplate
- the report template full file namereportFileName
- the full name of the generated PDF fileorg.kuali.ole.sys.batch.service.ReportGenerationService#generateReportToPdfFile(java.util.Map, java.lang.String, java.lang.String)
public void generateReportToPdfFile(Map<String,Object> reportData, Object dataSource, String template, String reportFileName)
generateReportToPdfFile
in interface ReportGenerationService
reportData
- the data being written into the PDF report filedataSource
- the data source being used for the PDF reporttemplate
- the report template full file namereportFileName
- the full name of the generated PDF fileorg.kuali.ole.sys.batch.service.ReportGenerationService#generateReportToPdfFile(java.util.Map, java.lang.Object, java.lang.String,
java.lang.String)
public void generateReportToOutputStream(Map<String,Object> reportData, Object dataSource, String template, ByteArrayOutputStream baos)
ReportGenerationService
generateReportToOutputStream
in interface ReportGenerationService
reportData
- the data being written into the PDF report filedataSource
- the data source being used for the PDF reporttemplate
- the report template full file nameorg.kuali.ole.sys.batch.service.ReportGenerationService#generateReportToOutputStream(java.util.Map, java.lang.Object,
java.lang.String, java.io.ByteArrayOutputStream)
public String buildFullFileName(Date runDate, String directory, String fileName, String extension)
ReportGenerationService
buildFullFileName
in interface ReportGenerationService
runDate
- the run date which is used to generate a timestampdirectory
- the directory where the file would be locatedfileName
- the given file name without file extensionextension
- the given file extensionorg.kuali.ole.sys.batch.service.ReportGenerationService#buildFullFileName(java.util.Date, java.lang.String, java.lang.String,
java.lang.String)
protected org.springframework.core.io.ClassPathResource getReportTemplateClassPathResource(String reportTemplateName)
reportTemplateName
- the given report template name with its full-qualified package name. It may not include extension.
If an extension is included in the name, it should be prefixed ".jasper" or '.jrxml".protected void compileReportTemplate(String designTemplate, String jasperReport) throws net.sf.jasperreports.engine.JRException
designTemplate
- the full name of the report template xml filejasperReport
- the full name of the compiled report filenet.sf.jasperreports.engine.JRException
protected void compileSubReports(Map<String,String> subReports, String subReportDirectory) throws Exception
subReports
- the sub report Map that hold the sub report templete names indexed with keyssubReportDirectory
- the directory where sub report templates are locatedException
protected String removeTemplateExtension(org.springframework.core.io.ClassPathResource template) throws IOException
template
- the given templateIOException
public void setDateTimeService(org.kuali.rice.core.api.datetime.DateTimeService dateTimeService)
dateTimeService
- The dateTimeService to set.Copyright © 2004–2015 The Kuali Foundation. All rights reserved.