org.openxava.actions
Class JasperReportBaseAction

java.lang.Object
  extended by org.openxava.actions.BaseAction
      extended by org.openxava.actions.JasperReportBaseAction
All Implemented Interfaces:
IAction, IForwardAction, IModelAction, IRequestAction

public abstract class JasperReportBaseAction
extends BaseAction
implements IForwardAction, IModelAction

To generate your custom Jasper Report.

You only need to overwrite the abstract methods.

Author:
Javier Paniza, Daniel García Salas

Field Summary
static java.lang.String EXCEL
           
static java.lang.String ODT
           
static java.lang.String PDF
           
static java.lang.String RTF
           
 
Constructor Summary
JasperReportBaseAction()
           
 
Method Summary
 void execute()
           
protected abstract  JRDataSource getDataSource()
          Data to print.
 java.lang.String getFormat()
          Output report format, it can be 'pdf' or 'excel'.
 java.lang.String getForwardURI()
           
protected abstract  java.lang.String getJRXML()
          The name of the XML with the JasperReports design.
protected abstract  java.util.Map getParameters()
          Parameters to send to report.
 View getView()
           
 boolean inNewWindow()
           
 void setFormat(java.lang.String format)
          Output report format, it can be 'pdf', 'excel' or 'rtf'.
 void setModel(java.lang.String modelName)
           
 void setRequest(HttpServletRequest request)
           
 void setView(View view)
           
 
Methods inherited from class org.openxava.actions.BaseAction
addError, addError, addError, addError, addError, addError, addError, addError, addErrors, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, addMessages, executeAfter, executeBefore, getEnvironment, getErrors, getLocale, getMessages, resetDescriptionsCache, setEnvironment, setErrors, setMessages
 
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
 

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

JasperReportBaseAction

public JasperReportBaseAction()
Method Detail

getDataSource

protected abstract JRDataSource getDataSource()
                                       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

getJRXML

protected abstract java.lang.String getJRXML()
                                      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

getForwardURI

public java.lang.String getForwardURI()
Specified by:
getForwardURI in interface IForwardAction

inNewWindow

public boolean inNewWindow()
Specified by:
inNewWindow in interface IForwardAction

setRequest

public void setRequest(HttpServletRequest request)
Specified by:
setRequest in interface IRequestAction
Overrides:
setRequest in class BaseAction

getView

public View getView()

setView

public void setView(View view)

setModel

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