Class BaseReportActionHandler
- java.lang.Object
-
- org.openbravo.client.kernel.BaseActionHandler
-
- org.openbravo.client.application.process.BaseProcessActionHandler
-
- org.openbravo.client.application.report.BaseReportActionHandler
-
- All Implemented Interfaces:
ActionHandler
- Direct Known Subclasses:
AgingBalanceReportActionHandler
,CashflowForecastReportActionHandler
public class BaseReportActionHandler extends BaseProcessActionHandler
Action Handler used as base for jasper reports generated from process definition. This handler can be extended to customize its behavior.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
JASPER_REPORT_PARAMETERS
-
Fields inherited from class org.openbravo.client.application.process.BaseProcessActionHandler
PARAM_FILE_CONTENT, PARAM_FILE_NAME, PARAM_FILE_SIZE, PARAM_MULTIPART_VALUES
-
-
Constructor Summary
Constructors Constructor Description BaseReportActionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addAdditionalParameters(ReportDefinition process, org.codehaus.jettison.json.JSONObject jsonContent, Map<String,Object> parameters)
Override this method to put additional parameters to send to the Jasper Report template.protected org.codehaus.jettison.json.JSONObject
doExecute(Map<String,Object> parameters, String content)
protected void
doGenerateReport(org.codehaus.jettison.json.JSONObject result, Map<String,Object> parameters, org.codehaus.jettison.json.JSONObject jsonContent, String action)
Manages the report generation.protected void
doValidations(ReportDefinition report, Map<String,Object> parameters, org.codehaus.jettison.json.JSONObject jsonContent)
Override this method to add validations to the report before it is generated.void
execute()
execute() method overridden to add the logic to download or display the report file stored in the temporary folder.protected ConnectionProvider
getReportConnectionProvider()
Get the connection provider to use in report generation.protected net.sf.jasperreports.engine.JRDataSource
getReportData(Map<String,Object> parameters)
Get the data to pass to the report generation method.protected String
getReportTemplatePath(ReportingUtils.ExportType expType, ReportDefinition report, org.codehaus.jettison.json.JSONObject jsonContent)
Get the PDF, XLS or HTML template path from the Report Definition.protected boolean
isCompilingSubreports()
Deprecated.This method has no effect-
Methods inherited from class org.openbravo.client.application.process.BaseProcessActionHandler
execute, extractParametersFromRequest, extractRequestContent, fixRequestMap, getResponseBuilder, hasAccess
-
Methods inherited from class org.openbravo.client.kernel.BaseActionHandler
fixRequestMap, writeResponse
-
-
-
-
Field Detail
-
JASPER_REPORT_PARAMETERS
protected static final String JASPER_REPORT_PARAMETERS
- See Also:
- Constant Field Values
-
-
Method Detail
-
execute
public void execute()
execute() method overridden to add the logic to download or display the report file stored in the temporary folder.- Specified by:
execute
in interfaceActionHandler
- Overrides:
execute
in classBaseActionHandler
-
doExecute
protected org.codehaus.jettison.json.JSONObject doExecute(Map<String,Object> parameters, String content)
- Specified by:
doExecute
in classBaseProcessActionHandler
-
getReportTemplatePath
protected String getReportTemplatePath(ReportingUtils.ExportType expType, ReportDefinition report, org.codehaus.jettison.json.JSONObject jsonContent) throws org.codehaus.jettison.json.JSONException, OBException
Get the PDF, XLS or HTML template path from the Report Definition. Override this method to add custom logic to get report template paths.- Parameters:
expType
- The export type.report
- The Report Definition.jsonContent
- JSONObject with the values set in the filter parameters, used by the classes extending this one when generating reports which use more than one template. In that case, the selection of the template can be done based on the values of the parameters present in this JSONObject.- Returns:
- The template path.
- Throws:
org.codehaus.jettison.json.JSONException
OBException
-
doGenerateReport
protected void doGenerateReport(org.codehaus.jettison.json.JSONObject result, Map<String,Object> parameters, org.codehaus.jettison.json.JSONObject jsonContent, String action) throws org.codehaus.jettison.json.JSONException, OBException
Manages the report generation. It sets the proper response actions to download the generated file or to open it in a new Openbravo tab.- Parameters:
result
- JSONObject with the response that is returned to the client.parameters
- Map including the parameters of the call.jsonContent
- JSONObject with the values set in the filter parameters.action
- String with the output type of the report.- Throws:
org.codehaus.jettison.json.JSONException
OBException
- Exception thrown when a validation fails.
-
doValidations
protected void doValidations(ReportDefinition report, Map<String,Object> parameters, org.codehaus.jettison.json.JSONObject jsonContent) throws OBException
Override this method to add validations to the report before it is generated.- Parameters:
report
- the Report Definitionparameters
- Map including the parameters of the call.jsonContent
- JSONObject with the values set in the filter parameters.- Throws:
OBException
-
addAdditionalParameters
protected void addAdditionalParameters(ReportDefinition process, org.codehaus.jettison.json.JSONObject jsonContent, Map<String,Object> parameters)
Override this method to put additional parameters to send to the Jasper Report template. Process Definition filter parameters are automatically added.- Parameters:
process
- the Process Definition of the ReportjsonContent
- values set in the filter parametersparameters
- the current Parameter Map that it is send to the Jasper Report.
-
getReportData
protected net.sf.jasperreports.engine.JRDataSource getReportData(Map<String,Object> parameters)
Get the data to pass to the report generation method. Override this method to put logic for getting the data. The map received as argument contains parameters that can be used to create some logic to build the report data- Parameters:
parameters
- map that contains the parameters of the HTTP request and the parameters that will be sent to the jasper report- Returns:
- a JRDataSource object containing the report data
-
getReportConnectionProvider
protected ConnectionProvider getReportConnectionProvider()
Get the connection provider to use in report generation. Override this method to put logic for getting the connection provider- Returns:
- the ConnectionProvider to use during the report generation
-
isCompilingSubreports
@Deprecated protected boolean isCompilingSubreports()
Deprecated.This method has no effectThis method has no effect. Classes extendingBaseReportActionHandler
will always try to compile the sub-reports (if any). Note that the sub-reports to be compiled will be the .jrxml files placed in the same folder as the main report and whose related parameter name starts with SUBREP_.- Returns:
true
-
-