Class JasperReportService

  • All Implemented Interfaces:
    ReportService

    public class JasperReportService
    extends java.lang.Object
    implements ReportService

    JasperReportService class.

    Version:
    $Id: $
    Author:
    jonathan@opennms.org
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean apply​(java.util.List<ParameterFilter> parameterFilters, net.sf.jasperreports.engine.JRParameter reportParm)  
      static java.lang.String evaluateToString​(net.sf.jasperreports.engine.JasperReport report, net.sf.jasperreports.engine.JRExpression expression)  
      java.util.List<ReportFormat> getFormats​(java.lang.String reportId)
      This method provides a list of formats supported by the report
      protected java.util.List<ParameterFilter> getParameterFilters()  
      ReportParameters getParameters​(java.lang.String reportId)
      This method retrieves the runtime parameters taken by the report
      void render​(java.lang.String reportId, java.lang.String location, ReportFormat format, java.io.OutputStream outputStream)
      This method renders the report into a given output stream.
      java.lang.String run​(java.util.Map<java.lang.String,​java.lang.Object> reportParms, java.lang.String reportId)
      This method runs the report
      void runAndRender​(java.util.Map<java.lang.String,​java.lang.Object> reportParms, java.lang.String reportId, ReportFormat format, java.io.OutputStream outputStream)
      This method runs the report and renders in into the given output stream with no intermediate steps
      void setGlobalReportRepository​(GlobalReportRepository globalReportRepository)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JasperReportService

        public JasperReportService()
    • Method Detail

      • getFormats

        public java.util.List<ReportFormat> getFormats​(java.lang.String reportId)
        This method provides a list of formats supported by the report
        Specified by:
        getFormats in interface ReportService
        Parameters:
        reportId - reportId as defined in database-reports.xml
        Returns:
        a list of supported formats
      • getParameters

        public ReportParameters getParameters​(java.lang.String reportId)
                                       throws ReportException
        This method retrieves the runtime parameters taken by the report
        Specified by:
        getParameters in interface ReportService
        Parameters:
        reportId - a String object.
        Returns:
        a ReportParameters object containing the parameters taken by the report
        Throws:
        ReportException
      • render

        public void render​(java.lang.String reportId,
                           java.lang.String location,
                           ReportFormat format,
                           java.io.OutputStream outputStream)
                    throws ReportException
        This method renders the report into a given output stream.
        Specified by:
        render in interface ReportService
        Parameters:
        reportId - reportId as defined in database-reports.xml
        location - location of the report on disk
        format - format to render the report
        outputStream - stream to render the resulting report
        Throws:
        ReportException - if any.
      • run

        public java.lang.String run​(java.util.Map<java.lang.String,​java.lang.Object> reportParms,
                                    java.lang.String reportId)
                             throws ReportException
        This method runs the report
        Specified by:
        run in interface ReportService
        Parameters:
        reportParms - hashmap of parameters to be provided at runtime
        reportId - reportId as defined in database-reports.xml
        Returns:
        a String object.
        Throws:
        ReportException - if any.
      • runAndRender

        public void runAndRender​(java.util.Map<java.lang.String,​java.lang.Object> reportParms,
                                 java.lang.String reportId,
                                 ReportFormat format,
                                 java.io.OutputStream outputStream)
                          throws ReportException
        This method runs the report and renders in into the given output stream with no intermediate steps
        Specified by:
        runAndRender in interface ReportService
        Parameters:
        reportParms - a HashMap object.
        reportId - reportId as defined in database-reports.xml
        format - format to render the report
        outputStream - stream to render the resulting report
        Throws:
        ReportException - if any.
      • setGlobalReportRepository

        public void setGlobalReportRepository​(GlobalReportRepository globalReportRepository)
      • apply

        protected boolean apply​(java.util.List<ParameterFilter> parameterFilters,
                                net.sf.jasperreports.engine.JRParameter reportParm)
      • getParameterFilters

        protected java.util.List<ParameterFilter> getParameterFilters()
      • evaluateToString

        public static java.lang.String evaluateToString​(net.sf.jasperreports.engine.JasperReport report,
                                                        net.sf.jasperreports.engine.JRExpression expression)