com.jaspersoft.jasperserver.api.engine.scheduling.quartz
Class ReportExecutionJob

java.lang.Object
  extended by com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob
All Implemented Interfaces:
org.quartz.Job

public class ReportExecutionJob
extends java.lang.Object
implements org.quartz.Job

Version:
$Id: ReportExecutionJob.java 9931 2007-09-06 16:31:57Z tdanciu $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)

Nested Class Summary
protected static class ReportExecutionJob.ReportOutput
           
 
Field Summary
protected  org.springframework.context.ApplicationContext applicationContext
           
protected  ExecutionContext executionContext
           
static java.lang.String JOB_DATA_KEY_DETAILS_ID
           
static java.lang.String JOB_DATA_KEY_USERNAME
           
protected  org.quartz.JobExecutionContext jobContext
           
protected  ReportJob jobDetails
           
static java.lang.String LOGGING_COMPONENT
           
static java.lang.String REPORT_PARAMETER_SCHEDULED_TIME
           
static java.lang.String REPOSITORY_FILENAME_SEQUENCE_SEPARATOR
           
static java.lang.String REPOSITORY_FILENAME_TIMESTAMP_SEQUENCE_PATTERN
           
static java.lang.String SCHEDULER_CONTEXT_KEY_APPLICATION_CONTEXT
           
static java.lang.String SCHEDULER_CONTEXT_KEY_ENCODING_PROVIDER
           
static java.lang.String SCHEDULER_CONTEXT_KEY_ENGINE_SERVICE
           
static java.lang.String SCHEDULER_CONTEXT_KEY_EXPORT_PARAMETRES_MAP
           
static java.lang.String SCHEDULER_CONTEXT_KEY_HYPERLINK_PRODUCER_FACTORY
           
static java.lang.String SCHEDULER_CONTEXT_KEY_JOB_PERSISTENCE_SERVICE
           
static java.lang.String SCHEDULER_CONTEXT_KEY_LOGGING_SERVICE
           
static java.lang.String SCHEDULER_CONTEXT_KEY_MAIL_FROM_ADDRESS
           
static java.lang.String SCHEDULER_CONTEXT_KEY_MAIL_SENDER
           
static java.lang.String SCHEDULER_CONTEXT_KEY_REPOSITORY
           
static java.lang.String SCHEDULER_CONTEXT_KEY_SECURITY_CONTEXT_PROVIDER
           
static java.lang.String SCHEDULER_CONTEXT_KEY_VIRTUALIZER_FACTORY
           
protected  org.quartz.SchedulerContext schedulerContext
           
protected  java.lang.String username
           
 
Constructor Summary
ReportExecutionJob()
           
 
Method Summary
protected  void addMailRecipients(ReportJobMailNotification mailNotification, org.springframework.mail.javamail.MimeMessageHelper messageHelper)
           
protected  void attachOutput(org.springframework.mail.javamail.MimeMessageHelper messageHelper, ReportExecutionJob.ReportOutput output)
           
protected  void clear()
           
protected  java.util.Map collectReportParameters()
           
 void execute(org.quartz.JobExecutionContext context)
           
protected  void executeAndSendReport()
           
protected  ReportUnitResult executeReport()
           
protected  java.lang.String getCharacterEncoding()
           
protected  java.lang.String getChildrenFolderName(java.lang.String resourceName)
           
protected  ReportExecutionJob.ReportOutput getCsvOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint, java.lang.String baseFilename)
           
protected  EngineService getEngineService()
           
protected  ExecutionContext getExecutionContext()
           
protected  java.util.Map getExportParametersMap()
           
protected  java.lang.String getFromAddress()
           
protected  ReportExecutionJob.ReportOutput getHtmlOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint, java.lang.String baseFilename)
           
protected  net.sf.jasperreports.engine.export.JRHyperlinkProducerFactory getHyperlinkProducerFactory()
           
protected  ReportJob getJobDetails()
           
protected  java.util.Locale getJobLocale()
           
protected  LoggingService getLoggingService()
           
protected  org.springframework.mail.javamail.JavaMailSender getMailSender()
           
protected  ReportExecutionJob.ReportOutput getPdfOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint, java.lang.String baseFilename)
           
protected  ReportJobsPersistenceService getPersistenceService()
           
protected  ReportExecutionJob.ReportOutput getReportOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint, byte format, java.lang.String baseFilename)
           
protected  java.lang.String getReportUnitURI()
           
protected  RepositoryService getRepository()
           
protected  ReportExecutionJob.ReportOutput getRtfOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint, java.lang.String baseFilename)
           
protected  SecurityContextProvider getSecurityContextProvider()
           
protected  java.lang.String getUsername()
           
protected  VirtualizerFactory getVirtualizerFactory()
           
protected  ReportExecutionJob.ReportOutput getXlsOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint, java.lang.String baseFilename)
           
protected  void handleException(java.lang.Throwable exc)
           
protected  void initJobExecution()
           
protected  boolean isEmpty(net.sf.jasperreports.engine.JasperPrint jasperPrint)
           
protected  void logException(java.lang.Throwable e)
           
protected  void putAdditionalParameters(java.util.Map parametersMap)
           
protected  void saveToRepository(ReportExecutionJob.ReportOutput output)
           
protected  void sendMailNotification(java.util.List mailAttachments, ReportJob job)
           
protected  void sendToDestinations(ReportUnitResult result)
           
protected  void throwJobExecutionException(java.lang.Throwable exc)
           
protected  boolean toSendMail(net.sf.jasperreports.engine.JasperPrint jasperPrint)
           
protected  void updateExecutionContextDetails()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REPORT_PARAMETER_SCHEDULED_TIME

public static final java.lang.String REPORT_PARAMETER_SCHEDULED_TIME
See Also:
Constant Field Values

REPOSITORY_FILENAME_SEQUENCE_SEPARATOR

public static final java.lang.String REPOSITORY_FILENAME_SEQUENCE_SEPARATOR
See Also:
Constant Field Values

REPOSITORY_FILENAME_TIMESTAMP_SEQUENCE_PATTERN

public static final java.lang.String REPOSITORY_FILENAME_TIMESTAMP_SEQUENCE_PATTERN
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_APPLICATION_CONTEXT

public static final java.lang.String SCHEDULER_CONTEXT_KEY_APPLICATION_CONTEXT
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_JOB_PERSISTENCE_SERVICE

public static final java.lang.String SCHEDULER_CONTEXT_KEY_JOB_PERSISTENCE_SERVICE
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_ENGINE_SERVICE

public static final java.lang.String SCHEDULER_CONTEXT_KEY_ENGINE_SERVICE
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_VIRTUALIZER_FACTORY

public static final java.lang.String SCHEDULER_CONTEXT_KEY_VIRTUALIZER_FACTORY
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_REPOSITORY

public static final java.lang.String SCHEDULER_CONTEXT_KEY_REPOSITORY
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_MAIL_SENDER

public static final java.lang.String SCHEDULER_CONTEXT_KEY_MAIL_SENDER
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_MAIL_FROM_ADDRESS

public static final java.lang.String SCHEDULER_CONTEXT_KEY_MAIL_FROM_ADDRESS
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_LOGGING_SERVICE

public static final java.lang.String SCHEDULER_CONTEXT_KEY_LOGGING_SERVICE
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_SECURITY_CONTEXT_PROVIDER

public static final java.lang.String SCHEDULER_CONTEXT_KEY_SECURITY_CONTEXT_PROVIDER
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_HYPERLINK_PRODUCER_FACTORY

public static final java.lang.String SCHEDULER_CONTEXT_KEY_HYPERLINK_PRODUCER_FACTORY
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_ENCODING_PROVIDER

public static final java.lang.String SCHEDULER_CONTEXT_KEY_ENCODING_PROVIDER
See Also:
Constant Field Values

SCHEDULER_CONTEXT_KEY_EXPORT_PARAMETRES_MAP

public static final java.lang.String SCHEDULER_CONTEXT_KEY_EXPORT_PARAMETRES_MAP
See Also:
Constant Field Values

JOB_DATA_KEY_DETAILS_ID

public static final java.lang.String JOB_DATA_KEY_DETAILS_ID
See Also:
Constant Field Values

JOB_DATA_KEY_USERNAME

public static final java.lang.String JOB_DATA_KEY_USERNAME
See Also:
Constant Field Values

LOGGING_COMPONENT

public static final java.lang.String LOGGING_COMPONENT
See Also:
Constant Field Values

applicationContext

protected org.springframework.context.ApplicationContext applicationContext

username

protected java.lang.String username

jobDetails

protected ReportJob jobDetails

jobContext

protected org.quartz.JobExecutionContext jobContext

schedulerContext

protected org.quartz.SchedulerContext schedulerContext

executionContext

protected ExecutionContext executionContext
Constructor Detail

ReportExecutionJob

public ReportExecutionJob()
Method Detail

execute

public void execute(org.quartz.JobExecutionContext context)
             throws org.quartz.JobExecutionException
Specified by:
execute in interface org.quartz.Job
Throws:
org.quartz.JobExecutionException

initJobExecution

protected void initJobExecution()

clear

protected void clear()

getUsername

protected java.lang.String getUsername()

getExecutionContext

protected ExecutionContext getExecutionContext()

updateExecutionContextDetails

protected void updateExecutionContextDetails()

getJobLocale

protected java.util.Locale getJobLocale()

handleException

protected void handleException(java.lang.Throwable exc)
                        throws org.quartz.JobExecutionException
Throws:
org.quartz.JobExecutionException

throwJobExecutionException

protected void throwJobExecutionException(java.lang.Throwable exc)
                                   throws org.quartz.JobExecutionException
Throws:
org.quartz.JobExecutionException

logException

protected void logException(java.lang.Throwable e)

getSecurityContextProvider

protected SecurityContextProvider getSecurityContextProvider()

getLoggingService

protected LoggingService getLoggingService()

getJobDetails

protected ReportJob getJobDetails()

getPersistenceService

protected ReportJobsPersistenceService getPersistenceService()

getEngineService

protected EngineService getEngineService()

getVirtualizerFactory

protected VirtualizerFactory getVirtualizerFactory()

executeAndSendReport

protected void executeAndSendReport()
                             throws org.quartz.JobExecutionException
Throws:
org.quartz.JobExecutionException

executeReport

protected ReportUnitResult executeReport()

collectReportParameters

protected java.util.Map collectReportParameters()

putAdditionalParameters

protected void putAdditionalParameters(java.util.Map parametersMap)

sendToDestinations

protected void sendToDestinations(ReportUnitResult result)
                           throws org.quartz.JobExecutionException
Throws:
org.quartz.JobExecutionException

toSendMail

protected boolean toSendMail(net.sf.jasperreports.engine.JasperPrint jasperPrint)

isEmpty

protected boolean isEmpty(net.sf.jasperreports.engine.JasperPrint jasperPrint)

getReportOutput

protected ReportExecutionJob.ReportOutput getReportOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint,
                                                          byte format,
                                                          java.lang.String baseFilename)

getChildrenFolderName

protected java.lang.String getChildrenFolderName(java.lang.String resourceName)

getPdfOutput

protected ReportExecutionJob.ReportOutput getPdfOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint,
                                                       java.lang.String baseFilename)

getReportUnitURI

protected java.lang.String getReportUnitURI()

getHtmlOutput

protected ReportExecutionJob.ReportOutput getHtmlOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint,
                                                        java.lang.String baseFilename)

getHyperlinkProducerFactory

protected net.sf.jasperreports.engine.export.JRHyperlinkProducerFactory getHyperlinkProducerFactory()

getXlsOutput

protected ReportExecutionJob.ReportOutput getXlsOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint,
                                                       java.lang.String baseFilename)

getRtfOutput

protected ReportExecutionJob.ReportOutput getRtfOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint,
                                                       java.lang.String baseFilename)

getCsvOutput

protected ReportExecutionJob.ReportOutput getCsvOutput(net.sf.jasperreports.engine.JasperPrint jasperPrint,
                                                       java.lang.String baseFilename)

saveToRepository

protected void saveToRepository(ReportExecutionJob.ReportOutput output)

getRepository

protected RepositoryService getRepository()

sendMailNotification

protected void sendMailNotification(java.util.List mailAttachments,
                                    ReportJob job)
                             throws org.quartz.JobExecutionException
Throws:
org.quartz.JobExecutionException

getCharacterEncoding

protected java.lang.String getCharacterEncoding()

addMailRecipients

protected void addMailRecipients(ReportJobMailNotification mailNotification,
                                 org.springframework.mail.javamail.MimeMessageHelper messageHelper)
                          throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

attachOutput

protected void attachOutput(org.springframework.mail.javamail.MimeMessageHelper messageHelper,
                            ReportExecutionJob.ReportOutput output)
                     throws javax.mail.MessagingException,
                            org.quartz.JobExecutionException
Throws:
javax.mail.MessagingException
org.quartz.JobExecutionException

getFromAddress

protected java.lang.String getFromAddress()

getMailSender

protected org.springframework.mail.javamail.JavaMailSender getMailSender()

getExportParametersMap

protected java.util.Map getExportParametersMap()


Copyright © 2007. All Rights Reserved.