Package org.pentaho.reporting.engine.classic.core.cache

Examples of org.pentaho.reporting.engine.classic.core.cache.CachingDataFactory


        this.resourceManager = report.getResourceManager();
        this.contentBase = report.getContentBase();
        final Object dataCacheEnabledRaw =
            report.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.DATA_CACHE);
        final boolean dataCacheEnabled = Boolean.FALSE.equals(dataCacheEnabledRaw) == false;
        this.dataFactory = new CachingDataFactory(report.getDataFactory().derive(), dataCacheEnabled);
        this.resourceBundleFactory = MasterReport.computeAndInitResourceBundleFactory
            (report.getResourceBundleFactory(), report.getReportEnvironment());
        this.reportEnvironment = report.getReportEnvironment();
        this.configuration = report.getConfiguration();
        final ReportEnvironmentDataRow envDataRow = new ReportEnvironmentDataRow(reportEnvironment);
View Full Code Here


    final DataSchemaCompiler dataSchemaCompiler =
        new DataSchemaCompiler(dataSchemaDefinition, dataAttributeContext, masterReportElement.getResourceManager());

    try
    {
      final CachingDataFactory dataFactory = new CachingDataFactory(createDataFactory(parent), true);
      final MasterReport masterReport = masterReportElement;

      dataFactory.initialize(masterReport.getConfiguration(), masterReport.getResourceManager(),
          masterReport.getContentBase(), MasterReport.computeAndInitResourceBundleFactory
              (masterReport.getResourceBundleFactory(), masterReport.getReportEnvironment()));

      dataFactory.open();
      try
      {
        final TableModel reportData = queryReportData(parent.getQuery(), parent.getQueryTimeout(), dataFactory);
        final DataSchema dataSchema = dataSchemaCompiler.compile
            (reportData, expressions, parameterRow, parameterDefinitions, masterReport.getReportEnvironment());
        this.columnNames = collectColumnNames(reportData, parameterRow, expressions);
        if (reportData instanceof CloseableTableModel)
        {
          final CloseableTableModel ctm = (CloseableTableModel) reportData;
          ctm.close();
        }
        return dataSchema;
      }
      finally
      {
        dataFactory.close();
      }
    }
    catch (final ReportDataFactoryException rdfe)
    {
      final TableModel reportData = new DefaultTableModel();
View Full Code Here

    this.resourceManager = report.getResourceManager();
    this.reportEnvironment = report.getReportEnvironment();
    final Object dataCacheEnabledRaw =
        report.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.DATA_CACHE);
    final boolean dataCacheEnabled = Boolean.FALSE.equals(dataCacheEnabledRaw) == false;
    this.dataFactory = new CachingDataFactory(report.getDataFactory(), dataCacheEnabled);

    final DocumentBundle bundle = report.getBundle();
    if (bundle != null)
    {
      this.documentMetaData = bundle.getMetaData();
View Full Code Here

    this.configuration = configuration;
    this.resourceBundleFactory = resourceBundleFactory;
    this.resourceManager = resourceManager;
    this.contentBase = resourceKey;
    this.reportEnvironment = reportEnvironment;
    this.dataFactory = new CachingDataFactory(dataFactory, false);
    this.dataFactory.initialize(configuration, resourceManager, resourceKey, resourceBundleFactory);

    this.envDataRow = new ReportEnvironmentDataRow(reportEnvironment);
    this.parameterValues = new CompoundDataRow(envDataRow, parameterValues);
  }
View Full Code Here

    }

    final DataSchemaDefinition definition = report.getDataSchemaDefinition();
    final DefaultFlowController flowController = new DefaultFlowController(processingContext,
        definition, StateUtilities.computeParameterValueSet(report), null, false);
    final CachingDataFactory dataFactory = new CachingDataFactory(report.getDataFactory(), isCacheEnabled(report));
    dataFactory.initialize(processingContext.getConfiguration(), processingContext.getResourceManager(),
        DesignTimeUtil.getContextKey(report), processingContext.getResourceBundleFactory());
    dataFactory.open();

    try
    {
      final DefaultFlowController postQueryFlowController = flowController.performQuery
          (dataFactory, report.getQuery(), report.getQueryLimit(),
              report.getQueryTimeout(), flowController.getMasterRow().getResourceBundleFactory());

      final Object originalEnable =
          report.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE);
      report.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, Boolean.TRUE);
      final SubReport subReport = processor.performPreProcessing(report, postQueryFlowController);
      subReport.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, originalEnable);
      return subReport;
    }
    finally
    {
      dataFactory.close();
    }
  }
View Full Code Here

    final DefaultProcessingContext processingContext = new DefaultProcessingContext(report);
    final DataSchemaDefinition definition = report.getDataSchemaDefinition();
    final DefaultFlowController flowController = new DefaultFlowController(processingContext,
        definition, StateUtilities.computeParameterValueSet(report),
        report.getParameterDefinition().getParameterDefinitions(), false);
    final CachingDataFactory dataFactory = new CachingDataFactory(report.getDataFactory(), isCacheEnabled(report));
    dataFactory.initialize(processingContext.getConfiguration(), processingContext.getResourceManager(),
        processingContext.getContentBase(), processingContext.getResourceBundleFactory());
    dataFactory.open();

    try
    {
      final DefaultFlowController postQueryFlowController = flowController.performQuery
          (dataFactory, report.getQuery(), report.getQueryLimit(),
              report.getQueryTimeout(), flowController.getMasterRow().getResourceBundleFactory());

      final Object originalEnable =
          report.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE);
      report.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, Boolean.TRUE);
      final MasterReport masterReport = processor.performPreProcessing(report, postQueryFlowController);
      masterReport.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, originalEnable);

      masterReport.setName(null);
      resetDocumentMetaData(masterReport);
      return masterReport;
    }
    finally
    {
      dataFactory.close();
    }
  }
View Full Code Here

    if (key == null)
    {
      throw new NullPointerException();
    }

    final CachingDataFactory expressions = (CachingDataFactory) storage.get(key);
    if (expressions == null)
    {
      return null;
    }
View Full Code Here

        report.getParameterDefinition().getParameterDefinitions(), structuralPreprocessingNeeded);

    final Object dataCacheEnabledRaw =
        report.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.DATA_CACHE);
    final boolean dataCacheEnabled = Boolean.FALSE.equals(dataCacheEnabledRaw) == false;
    final CachingDataFactory dataFactory = new CachingDataFactory(report.getDataFactory(), dataCacheEnabled);
    dataFactory.initialize(processingContext.getConfiguration(), processingContext.getResourceManager(),
        processingContext.getContentBase(), processingContext.getResourceBundleFactory());
    dataFactory.open();

    final FunctionStorageKey functionStorageKey = FunctionStorageKey.createKey(null, report);
    this.dataFactoryManager.store(functionStorageKey, dataFactory);
    // eval query, query-limit and query-timeout
    this.flowController = flowController;
View Full Code Here

          (parentState.layoutProcess, computeStructureFunctions(report.getStructureFunctions(),
              flowController.getReportContext().getOutputProcessorMetaData()));
    }
    else
    {
      CachingDataFactory dataFactory = dataFactoryManager.restore(functionStorageKey);

      if (dataFactory == null)
      {
        final DataFactory subreportDf = report.getDataFactory();
        final Object dataCacheEnabledRaw =
            report.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.DATA_CACHE);
        final boolean dataCacheEnabled = Boolean.FALSE.equals(dataCacheEnabledRaw) == false;
        if (subreportDf == null)
        {
          // subreport does not define a own factory, so reuse the parent's data-factory.
          dataFactory = new CachingDataFactory(parentState.getFlowController().getDataFactory(), true, dataCacheEnabled);
        }
        else
        {
          // subreport comes with an own factory, so open the gates ..
          dataFactory = new CachingDataFactory(subreportDf, dataCacheEnabled);
          final ProcessingContext context = parentState.getFlowController().getReportContext();
          dataFactory.initialize(context.getConfiguration(), context.getResourceManager(),
              context.getContentBase(), resourceBundleFactory);
          dataFactory.open();
          dataFactoryManager.store(functionStorageKey, dataFactory);
        }
      }

      // And now initialize the sub-report.
View Full Code Here

    else
    {
      parentStateKey = parentState.getProcessKey();
    }

    final CachingDataFactory dataFactory = state.dataFactoryManager.restore
        (FunctionStorageKey.createKey(parentStateKey, state.getReport()));
    if (dataFactory == null)
    {
      throw new ReportProcessingException("No data factory on restart()? Somewhere we went wrong.");
    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.cache.CachingDataFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.