org.openxava.actions
Class JasperMultipleReportBaseAction

java.lang.Object
  extended by org.openxava.actions.BaseAction
      extended by org.openxava.actions.ViewBaseAction
          extended by org.openxava.actions.JasperMultipleReportBaseAction
All Implemented Interfaces:
IAction, IChangeModeAction, IModelAction, IModuleContextAction, IMultipleForwardAction, IRequestAction

public abstract class JasperMultipleReportBaseAction
extends ViewBaseAction
implements IMultipleForwardAction, IModelAction

To generate several custom Jasper Reports with the same action.

You only need to overwrite the abstract methods.

Author:
Oscar Caro

Field Summary
static java.lang.String EXCEL
           
static java.lang.String ODT
           
static java.lang.String PDF
           
static java.lang.String RTF
           
 
Fields inherited from interface org.openxava.actions.IChangeModeAction
DETAIL, LIST, PREVIOUS_MODE, SPLIT
 
Constructor Summary
JasperMultipleReportBaseAction()
           
 
Method Summary
 void execute()
           
protected abstract  net.sf.jasperreports.engine.JRDataSource[] getDataSources()
          Data to print.
 java.lang.String getFormat()
          Output report format, it can be 'pdf' or 'excel'.
 java.lang.String[] getForwardURIs()
          The URIs to go.
protected abstract  java.lang.String[] getJRXMLs()
          The name of the XML with the JasperReports design.
protected abstract  java.util.Map getParameters()
          Parameters to send to report.
 boolean inNewWindow()
           
 void setFormat(java.lang.String format)
          Output report format, it can be 'pdf', 'excel' or 'rtf'.
 void setModel(java.lang.String modelName)
           
 
Methods inherited from class org.openxava.actions.ViewBaseAction
closeDialog, getModelName, getPreviousView, getPreviousViews, getView, resetDescriptionsCache, returnToPreviousView, setControllers, setPreviousViews, setView, showDialog, showDialog, showNewView, showView
 
Methods inherited from class org.openxava.actions.BaseAction
addActions, addError, addErrors, addInfo, addMessage, addMessages, addWarning, clearActions, executeAfter, executeBefore, getContext, getEnvironment, getErrors, getLocale, getManager, getMessages, getNextMode, getRequest, removeActions, returnToPreviousControllers, 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
 
Methods inherited from interface org.openxava.actions.IAction
getErrors, getMessages, setEnvironment, setErrors, setMessages
 

Field Detail

PDF

public static java.lang.String PDF

EXCEL

public static java.lang.String EXCEL

RTF

public static java.lang.String RTF

ODT

public static java.lang.String ODT
Constructor Detail

JasperMultipleReportBaseAction

public JasperMultipleReportBaseAction()
Method Detail

getDataSources

protected abstract net.sf.jasperreports.engine.JRDataSource[] getDataSources()
                                                                      throws java.lang.Exception
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.

Throws:
java.lang.Exception

getJRXMLs

protected abstract java.lang.String[] getJRXMLs()
                                         throws java.lang.Exception
The name of the XML with the JasperReports design.

If it is a relative path (as reports/myreport.jrxml has to be in classpath. If it is a absolute path (as /home/java/reports/myreport.xml or C:\\JAVA\\REPORTS\MYREPORT.JRXML then it look at the file system.

Throws:
java.lang.Exception

getParameters

protected abstract java.util.Map getParameters()
                                        throws java.lang.Exception
Parameters to send to report.

Throws:
java.lang.Exception

getFormat

public java.lang.String getFormat()
                           throws java.lang.Exception
Output report format, it can be 'pdf' or 'excel'.

Throws:
java.lang.Exception

setFormat

public void setFormat(java.lang.String format)
               throws java.lang.Exception
Output report format, it can be 'pdf', 'excel' or 'rtf'.

Throws:
java.lang.Exception

execute

public void execute()
             throws java.lang.Exception
Specified by:
execute in interface IAction
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 interface IMultipleForwardAction

inNewWindow

public boolean inNewWindow()

setModel

public void setModel(java.lang.String modelName)
Specified by:
setModel in interface IModelAction