All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.ureport.UReportConsoleServletActionAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.ureport;

import javax.servlet.Servlet;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.ureport.condition.ConditionalOnUReportEnabled;

//@SpringBootConfiguration
@ConditionalOnUReportEnabled
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass(value = {com.bstek.ureport.CellRenderer.class, org.zodiac.ureport.UReport.class, javax.servlet.Servlet.class})
public class UReportConsoleServletActionAutoConfiguration {

    private final com.bstek.ureport.export.ExportManager exportManager;
    private final com.bstek.ureport.build.ReportBuilder reportBuilder;
    private final com.bstek.ureport.parser.ReportParser reportParser;
    private final com.bstek.ureport.export.ReportRender reportRender;
    private final UReportProperties uReportProperties;
    //private boolean disableHttpSessionReportCache;

    public UReportConsoleServletActionAutoConfiguration(UReportProperties uReportProperties,
        @Autowired @Qualifier(value = org.zodiac.ureport.costants.UReportCoreBeanConstants.EXPORT_MANAGER_NAME) com.bstek.ureport.export.ExportManager exportManager,
        @Autowired @Qualifier(value = org.zodiac.ureport.costants.UReportCoreBeanConstants.REPORT_BUILDER_NAME) com.bstek.ureport.build.ReportBuilder reportBuilder,
        @Autowired @Qualifier(value = org.zodiac.ureport.costants.UReportCoreBeanConstants.REPORT_PARSER_NAME) com.bstek.ureport.parser.ReportParser reportParser,
        @Autowired @Qualifier(value = org.zodiac.ureport.costants.UReportCoreBeanConstants.REPORT_RENDER_NAME) com.bstek.ureport.export.ReportRender reportRender
        /*@Value(value = "${ureport.disableHttpSessionReportCache:false}") boolean disableHttpSessionReportCache*/) {
        this.exportManager = exportManager;
        this.reportBuilder = reportBuilder;
        this.reportParser = reportParser;
        this.reportRender = reportRender;
        this.uReportProperties = uReportProperties;
        //this.disableHttpSessionReportCache = disableHttpSessionReportCache;
    }

    @Bean
    protected ServletRegistrationBean registrationBean() {
        return new ServletRegistrationBean<>(new org.zodiac.ureport.console.servlet.UReportServlet(), org.zodiac.ureport.console.servlet.UReportServlet.URL_PATTERN);
    }

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.HTTP_SESSION_REPORT_CACHE_NAME})
    protected org.zodiac.ureport.console.servlet.cache.HttpSessionReportCache httpSessionReportCache() {
        //return new org.zodiac.ureport.console.servlet.cache.HttpSessionReportCache().setDisabled(disableHttpSessionReportCache);
        return new org.zodiac.ureport.console.servlet.cache.HttpSessionReportCache(uReportProperties);
    }

    /*=============================================================== Data Source ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.DATASOURCE_ACTION_NAME})
    protected org.zodiac.ureport.console.servlet.action.designer.DatasourceServletAction datasourceAction() {
        return new org.zodiac.ureport.console.servlet.action.designer.DatasourceServletAction();
    }

    /*=============================================================== Designer ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.DESIGNER_ACTION})
    protected org.zodiac.ureport.console.servlet.action.designer.DesignerServletAction designerAction() {
        return new org.zodiac.ureport.console.servlet.action.designer.DesignerServletAction()
            .setReportParser(reportParser).setReportRender(reportRender);
    }

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.SEARCH_FORM_DESIGNER_ACTION})
    protected org.zodiac.ureport.console.servlet.action.designer.SearchFormDesignerServletAction searchFormDesignerAction() {
        return new org.zodiac.ureport.console.servlet.action.designer.SearchFormDesignerServletAction();
    }

    /*=============================================================== HTML ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.HTML_PREVIEW_ACTION})
    protected org.zodiac.ureport.console.servlet.action.html.HtmlPreviewServletAction htmlPreviewAction() {
        return new org.zodiac.ureport.console.servlet.action.html.HtmlPreviewServletAction()
            .setExportManager(exportManager).setReportBuilder(reportBuilder).setReportRender(reportRender);
    }

    /*=============================================================== Resource ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.RESOURCE_LOADER_ACTION})
    protected org.zodiac.ureport.console.servlet.action.res.ResourceLoaderServletAction resourceLoaderAction() {
        return new org.zodiac.ureport.console.servlet.action.res.ResourceLoaderServletAction();
    }

    /*=============================================================== Chart Excel ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.CHART_ACTION})
    protected org.zodiac.ureport.console.servlet.action.chart.ChartServletAction chartAction() {
        return new org.zodiac.ureport.console.servlet.action.chart.ChartServletAction();
    }

    /*=============================================================== Image ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.IMAGE_ACTION})
    protected org.zodiac.ureport.console.servlet.action.image.ImageServletAction imageAction() {
        return new org.zodiac.ureport.console.servlet.action.image.ImageServletAction();
    }

    /*=============================================================== Excel ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.EXPORT_EXCEL97_ACTION})
    protected org.zodiac.ureport.console.servlet.action.excel.ExportExcel97ServletAction exportExcel97Action() {
        return new org.zodiac.ureport.console.servlet.action.excel.ExportExcel97ServletAction()
            .setExportManager(exportManager).setReportBuilder(reportBuilder);
    }

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.EXPORT_EXCEL_ACTION})
    protected org.zodiac.ureport.console.servlet.action.excel.ExportExcelServletAction exportExcelAction() {
        return new org.zodiac.ureport.console.servlet.action.excel.ExportExcelServletAction()
            .setExportManager(exportManager).setReportBuilder(reportBuilder);
    }

    /*=============================================================== Import Excel ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.IMPORT_EXCEL_ACTION})
    protected org.zodiac.ureport.console.servlet.action.importexcel.ImportExcelServletAction importExcelAction() {
        return new org.zodiac.ureport.console.servlet.action.importexcel.ImportExcelServletAction();
    }

    /*=============================================================== PDF ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.EXPORT_PDF_ACTION})
    protected org.zodiac.ureport.console.servlet.action.pdf.ExportPdfServletAction exportPdfAction() {
        return new org.zodiac.ureport.console.servlet.action.pdf.ExportPdfServletAction()
            .setExportManager(exportManager).setReportBuilder(reportBuilder).setReportRender(reportRender);
    }

    /*=============================================================== Word ===============================================================*/

    @ConditionalOnMissingBean
    @Bean(value = {org.zodiac.ureport.costants.UReportConsoleBeanConstants.EXPORT_WORD_ACTION})
    protected org.zodiac.ureport.console.servlet.action.word.ExportWordServletAction exportWordAction() {
        return new org.zodiac.ureport.console.servlet.action.word.ExportWordServletAction()
            .setExportManager(exportManager).setReportBuilder(reportBuilder);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy