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

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


    {
      final DefaultProcessingContext processingContext = new DefaultProcessingContext(report);
      final DataSchemaDefinition definition = report.getDataSchemaDefinition();
      final DefaultFlowController flowController = new DefaultFlowController(processingContext,
          definition, StateUtilities.computeParameterValueSet(report), performanceMonitorContext);
      final CachingDataFactory dataFactory = new CachingDataFactory(report.getDataFactory(), isCacheEnabled(report));
      dataFactory.initialize(new ProcessingDataFactoryContext(processingContext, dataFactory));

      try
      {
        final DefaultFlowController postQueryFlowController = flowController.performDesignTimeQuery
            (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);
        DesignTimeUtil.resetDocumentMetaData(masterReport);
        return masterReport;
      }
      finally
      {
        dataFactory.close();
      }
    }
    finally
    {
      performanceMonitorContext.close();
View Full Code Here


        processedReport.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.DATA_CACHE);
    final boolean dataCacheEnabled = designtime == false && Boolean.FALSE.equals(dataCacheEnabledRaw) == false;

    final DataFactory sortingDataFactory =
        new SortingDataFactory(lookupDataFactory(processedReport), performanceMonitorContext);
    final CachingDataFactory dataFactory = new CachingDataFactory(sortingDataFactory, dataCacheEnabled);
    dataFactory.initialize(new ProcessingDataFactoryContext(processingContext, dataFactory));

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

        }
        else
        {
          // subreport comes with an own factory, so open the gates ..
          final DataFactory sortingDataFactory = new SortingDataFactory(subreportDf, performanceMonitorContext);
          final CachingDataFactory cdataFactory = new CachingDataFactory(sortingDataFactory, dataCacheEnabled);
          final ProcessingContext context = postPreProcessingFlowController.getReportContext();
          cdataFactory.initialize(new ProcessingDataFactoryContext(context, cdataFactory));
          dataFactoryManager.store(functionStorageKey, cdataFactory, isReportsShareConnections(preDataSubReport));
          dataFactory = cdataFactory;
        }
      }
      else
View Full Code Here

    else
    {
      parentStateKey = parentState.getProcessKey();
    }

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

        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

    if (rawDataFactory == null)
    {
      return new String[0];
    }

    final DataFactory dataFactory = new CachingDataFactory(rawDataFactory, true);

    try
    {
      final ReportRenderContext activeContext = reportDesignerContext.getActiveContext();
      if (activeContext != null)
      {
        final MasterReport reportDefinition = activeContext.getMasterReportElement();
        dataFactory.initialize(reportDefinition.getConfiguration(),
            reportDefinition.getResourceManager(), reportDefinition.getContentBase(),
            MasterReport.computeAndInitResourceBundleFactory
                (reportDefinition.getResourceBundleFactory(), reportDefinition.getReportEnvironment()));
      }

      dataFactory.open();
      final TableModel tableModel = dataFactory.queryData
          (queryName, new QueryDataRowWrapper(new ReportParameterValues(), 1, 0));

      final int colCount = tableModel.getColumnCount();
      final String[] cols = new String[colCount];
      for (int i = 0; i < colCount; i++)
      {
        cols[i] = tableModel.getColumnName(i);
      }
      return cols;
    }
    catch (ReportProcessingException aExc)
    {
      UncaughtExceptionsModel.getInstance().addException(aExc);
      return new String[0];
    }
    finally
    {
      dataFactory.close();
    }
  }
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.