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

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


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

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

    try
    {
      final ReportDocumentContext activeContext = reportDesignerContext.getActiveContext();
      if (activeContext != null)
      {
        final MasterReport reportDefinition = activeContext.getContextRoot();
        dataFactory.initialize(new DesignTimeDataFactoryContext(reportDefinition));
      }

      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


    final CompoundDataFactory cdf = new CompoundDataFactory();
    cdf.add(tableDataFactory);
    master.setDataFactory(cdf);

    final CachingDataFactory caDf = new CachingDataFactory(cdf, true);
    master.setDataFactory(caDf);

    final CompoundDataFactory ccdf = new CascadingDataFactory();
    ccdf.add(caDf);
    ccdf.add(tableDataFactory);
View Full Code Here

  public void testCascadingAndCaching() throws ReportDataFactoryException
  {
    final CompoundDataFactory cdf = new CompoundDataFactory();
    cdf.add(new TableDataFactory("static", new DefaultTableModel()));

    final CachingDataFactory caDf = new CachingDataFactory(cdf, true);

    final CompoundDataFactory ccdf = new CascadingDataFactory();
    ccdf.add(caDf);
    ccdf.add(new StaticDataFactory());
View Full Code Here

    final PerformanceMonitorContext pmc = new NoOpPerformanceMonitorContext();
    final DefaultProcessingContext processingContext = new DefaultProcessingContext(report);
    final DataSchemaDefinition definition = report.getDataSchemaDefinition();
    final DefaultFlowController flowController = new DefaultFlowController(processingContext,
        definition, StateUtilities.computeParameterValueSet(report), pmc);
    final CachingDataFactory dataFactory = new CachingDataFactory(report.getDataFactory(), false);
    dataFactory.initialize(new ProcessingDataFactoryContext(processingContext, dataFactory));

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

      return processor.performPreProcessing(report, postQueryFlowController);
    }
    finally
    {
      dataFactory.close();
    }
  }
View Full Code Here

    final DataSchemaCompiler dataSchemaCompiler =
        new DataSchemaCompiler(getDataSchemaDefinition(), getDataAttributeContext(), getMasterReportElement().getResourceManager());

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

      dataFactory.initialize(new DesignTimeDataFactoryContext(masterReport));

      try
      {
        List<SortConstraint> sortConstraints = new SortOrderReportPreProcessor().computeSortConstraints(parent);
        final TableModel reportData = queryReportData
            (parent.getQuery(), parent.getQueryTimeout(), dataFactory, sortConstraints);
        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 ReportProcessingException e)
    {
      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(new DesignTimeDataFactoryContext
        (configuration, resourceManager, resourceKey, resourceBundleFactory, dataFactory));

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

  {
    if (key == null)
    {
      throw new NullPointerException();
    }
    final CachingDataFactory expressions;
    if (perDeclaration)
    {
      expressions = storage.get(key.getReportId());
    }
    else
View Full Code Here

        ("test/org/pentaho/reporting/engine/classic/extensions/datasources/mondrian/steelwheels.mondrian.xml"));
    mondrianDataFactory.setDataSourceProvider(provider);
    mondrianDataFactory.setJdbcUser("sa");
    mondrianDataFactory.setJdbcPassword("");
    mondrianDataFactory.setQuery("default", query, null, null);
    CachingDataFactory cachingFactory = new CachingDataFactory(mondrianDataFactory, true);

    return cachingFactory;
  }
View Full Code Here

      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 SubReport subReport = processor.performPreProcessing(report, postQueryFlowController);
        subReport.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, originalEnable);
        return subReport;
      }
      finally
      {
        dataFactory.close();
      }
    }
    finally
    {
      performanceMonitorContext.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.