Package org.openxava.actions
Class JasperConcatReportBaseAction
- java.lang.Object
-
- org.openxava.actions.BaseAction
-
- org.openxava.actions.ViewBaseAction
-
- org.openxava.actions.JasperMultipleReportBaseAction
-
- org.openxava.actions.JasperConcatReportBaseAction
-
- All Implemented Interfaces:
IAction
,IChangeModeAction
,IModelAction
,IModuleContextAction
,IMultipleForwardAction
,IRequestAction
public abstract class JasperConcatReportBaseAction extends JasperMultipleReportBaseAction
To generate a custom report concatenating simple reports.You only need to overwrite the abstract methods.
To send parameters to the simple reports you have 3 options.- If all the reports use the same parameters just overwrite getParameters().
- If each report has different parameter overwrite getParameters(int i), or well
- overwrite execute() and before calling to super.execute() call to addParameters() method.
Option 1 for parameters
@Override public Map getParameters() throws Exception { Map parameters = new HashMap(); parameters.put("param1", value1); parameters.put("param2", value2); return parameters; }
Option 2 for parameters
@Override protected Map getParameters(int index) throws Exception { Map parameters = new HashMap(); switch (index) { case 0: parameters.put("param1", value1); parameters.put("param2", value2); return parameters; case 1: parameters.put("param3", value3); parameters.put("param4", value4); return parameters; } return null; }
Option 3 for parameters
@Override public void execute() throws Exception { Map parameters1 = new HashMap(); parameters1.put("param1", value1); parameters1.put("param2", value2); addParameters(parameters1); Map parameters2 = new HashMap(); parameters1.put("param3", value3); parameters1.put("param4", value4); addParameters(parameters2); super.execute(); }
- Author:
- Jeromy Altuna
-
-
Field Summary
-
Fields inherited from class org.openxava.actions.JasperMultipleReportBaseAction
EXCEL, ODT, PDF, RTF
-
Fields inherited from interface org.openxava.actions.IChangeModeAction
DETAIL, LIST, PREVIOUS_MODE, SPLIT
-
-
Constructor Summary
Constructors Constructor Description JasperConcatReportBaseAction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
execute()
protected abstract net.sf.jasperreports.engine.JRDataSource[]
getDataSources()
Data to print.java.lang.String
getFilename()
java.lang.String[]
getForwardURIs()
The URIs to go.protected abstract java.lang.String[]
getJRXMLs()
XML list JasperReports designed that will be concatenated into a single reportvoid
setFilename(java.lang.String filename)
-
Methods inherited from class org.openxava.actions.JasperMultipleReportBaseAction
addParameters, addParameters, getFormat, getParameters, getParameters, getParametersList, inNewWindow, setFormat, setModel, setParametersList
-
Methods inherited from class org.openxava.actions.ViewBaseAction
changeThisPropertyByViewValue, closeDialog, getModelName, getPreviousView, getPreviousViews, getView, resetDescriptionsCache, returnToPreviousView, setControllers, setPreviousViews, setView, showDialog, showDialog, showNewView, showView, validateViewValues
-
Methods inherited from class org.openxava.actions.BaseAction
addActions, addError, addErrors, addInfo, addMessage, addMessages, addWarning, clearActions, commit, executeAction, executeAfter, executeBefore, getContext, getEnvironment, getErrors, getLocale, getManager, getMessages, getNextMode, getQualifiedActionIfAvailable, getRequest, removeActions, returnToPreviousControllers, rollback, setContext, setDefaultControllers, setEnvironment, setErrors, setMessages, setNextMode, setRequest
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openxava.actions.IAction
getErrors, getMessages, setEnvironment, setErrors, setMessages
-
-
-
-
Method Detail
-
getDataSources
protected abstract net.sf.jasperreports.engine.JRDataSource[] getDataSources() throws java.lang.Exception
Description copied from class:JasperMultipleReportBaseAction
Data to print.If return null then a JDBC connection is sent to JasperReport, this is for the case of a SQL inside JasperReport design.
- Specified by:
getDataSources
in classJasperMultipleReportBaseAction
- Throws:
java.lang.Exception
-
getJRXMLs
protected abstract java.lang.String[] getJRXMLs() throws java.lang.Exception
XML list JasperReports designed that will be concatenated into a single report- Specified by:
getJRXMLs
in classJasperMultipleReportBaseAction
- Returns:
- String[] jrxml list
- Throws:
java.lang.Exception
-
execute
public void execute() throws java.lang.Exception
- Specified by:
execute
in interfaceIAction
- Overrides:
execute
in classJasperMultipleReportBaseAction
- Throws:
java.lang.Exception
-
getForwardURIs
public java.lang.String[] getForwardURIs()
Description copied from interface:IMultipleForwardAction
The URIs to go.If it starts with "http://" or "http://" the action will forward to the absolute URL in internet, if it starts with "javascript:" the corresponding code will executed by the browser, otherwise it will forward to a resource inside this application.
- Specified by:
getForwardURIs
in interfaceIMultipleForwardAction
- Overrides:
getForwardURIs
in classJasperMultipleReportBaseAction
-
getFilename
public java.lang.String getFilename()
-
setFilename
public void setFilename(java.lang.String filename)
-
-