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

Examples of org.pentaho.reporting.engine.classic.core.states.ReportDefinitionImpl


    final ElementStyleSheet es = report.getStyleSheetCollection().createStyleSheet("test");
    es.setStyleProperty(ElementStyleKeys.HREF_TITLE, "Hello World!");
    report.getReportHeader().getStyle().addParent(es);
    assertEquals(report.getReportHeader().getStyle().getStyleProperty(ElementStyleKeys.HREF_TITLE), "Hello World!");

    final ReportDefinition rd = new ReportDefinitionImpl(report, report.getPageDefinition());
    assertEquals(rd.getReportHeader().getStyle().getStyleProperty(ElementStyleKeys.HREF_TITLE), "Hello World!");

    // redefining the outside stylesheet must not change the stylesheet
    // inside the report definition.
    // check for deep-cloning!
    es.setStyleProperty(ElementStyleKeys.HREF_TITLE, "Hello Little Green Man!");
    assertSame(rd.getReportHeader().getStyle().getStyleProperty(ElementStyleKeys.HREF_TITLE), "Hello World!");

  }
View Full Code Here


      }
    }

    this.flowController =
        postQueryFlowController.activateExpressions(fullReport.getExpressions().getExpressions(), false);
    this.report = new ReportDefinitionImpl(fullReport, fullReport.getPageDefinition());
    this.layoutProcess = new SubLayoutProcess(layoutProcess,
        computeStructureFunctions(fullReport.getStructureFunctions(),
            getFlowController().getReportContext().getOutputProcessorMetaData()));

    StateUtilities.computeLevels(this.flowController, this.layoutProcess, processLevels);
View Full Code Here

        report.isVisible() == false)
    {
      // make it a minimum effort report, but still enter the loop.
      final ReportDefinition parentReport = parentState.getReport();
      final SubReport dummyReport = new SubReport(functionStorageKey.getReportId());
      this.report = new ReportDefinitionImpl(dummyReport, parentReport.getPageDefinition());
      this.flowController = parentState.flowController.derive();
      this.advanceHandler = EndSubReportHandler.HANDLER;
      this.layoutProcess = new SubLayoutProcess
          (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.
      final ParameterMapping[] inputMappings = report.getInputMappings();
      final ParameterMapping[] exportMappings = report.getExportMappings();

      // eval query, query-limit and query-timeout
      this.flowController = parentState.flowController.performInitSubreport
          (dataFactory, inputMappings, resourceBundleFactory);
      final Integer queryLimitDefault = IntegerCache.getInteger(report.getQueryLimit());
      final Integer queryTimeoutDefault = IntegerCache.getInteger(report.getQueryTimeout());

      final Object queryRaw = evaluateExpression(report.getAttributeExpression(AttributeNames.Internal.NAMESPACE,
          AttributeNames.Internal.QUERY), report.getQuery());
      final Object queryLimitRaw = evaluateExpression(report.getAttributeExpression(AttributeNames.Internal.NAMESPACE,
          AttributeNames.Internal.QUERY_LIMIT), queryLimitDefault);
      final Object queryTimeoutRaw = evaluateExpression(report.getAttributeExpression(AttributeNames.Internal.NAMESPACE,
          AttributeNames.Internal.QUERY_TIMEOUT), queryTimeoutDefault);
      this.query = (String) ConverterRegistry.convert(queryRaw, String.class, report.getQuery());
      this.queryLimit = (Integer) ConverterRegistry.convert(queryLimitRaw, Integer.class, queryLimitDefault);
      this.queryTimeout = (Integer) ConverterRegistry.convert(queryTimeoutRaw, Integer.class, queryTimeoutDefault);

      DefaultFlowController postQueryFlowController = flowController.performSubReportQuery
          (query, queryLimit.intValue(), queryTimeout.intValue(), exportMappings);
      final ProxyDataSchemaDefinition schemaDefinition =
          new ProxyDataSchemaDefinition(report.getDataSchemaDefinition(),
              postQueryFlowController.getMasterRow().getDataSchemaDefinition());
      postQueryFlowController = postQueryFlowController.updateDataSchema(schemaDefinition);

      SubReport fullReport = report;
      DataSchemaDefinition fullDefinition = schemaDefinition;

      if (needPreProcessing)
      {
        final ReportPreProcessor[] processors = getAllPreProcessors(report);
        for (int i = 0; i < processors.length; i++)
        {
          final ReportPreProcessor processor = processors[i];
          fullReport = processor.performPreProcessing(fullReport, postQueryFlowController);
          if (fullReport.getDataSchemaDefinition() != fullDefinition)
          {
            fullDefinition = fullReport.getDataSchemaDefinition();
            postQueryFlowController = postQueryFlowController.updateDataSchema(fullDefinition);
          }
        }

        subReportStorage.store(functionStorageKey, fullReport);
      }

      this.report = new ReportDefinitionImpl(fullReport, fullReport.getPageDefinition());


      final Expression[] structureFunctions = getStructureFunctionStorage().restore(functionStorageKey);
      if (structureFunctions != null)
      {
View Full Code Here

    {
      expressions = fullReport.getExpressions().getExpressions();
    }

    this.flowController = postQueryFlowController.activateExpressions(expressions, false);
    this.report = new ReportDefinitionImpl(fullReport, fullReport.getPageDefinition());
    this.layoutProcess = new SubLayoutProcess(layoutProcess,
        computeStructureFunctions(fullReport.getStructureFunctions(),
            getFlowController().getReportContext().getOutputProcessorMetaData()), fullReport.getObjectID());

    if (StateUtilities.computeLevels(this.flowController, this.layoutProcess, processLevels))
View Full Code Here

    if (isSubReportInvisible(initialSubReport, parentStateFlowController))
    {
      // make it a minimum effort report, but still enter the loop.
      final ReportDefinition parentReport = parentState.getReport();
      final SubReport dummyReport = new SubReport(functionStorageKey.getReportId());
      this.report = new ReportDefinitionImpl(dummyReport, parentReport.getPageDefinition(), subreportFromMarker.getParentSection());
      this.flowController = parentStateFlowController.derive();
      this.advanceHandler = EndSubReportHandler.HANDLER;
      this.layoutProcess = new SubLayoutProcess
          (parentState.layoutProcess, computeStructureFunctions(initialSubReport.getStructureFunctions(),
              flowController.getReportContext().getOutputProcessorMetaData()), this.report.getObjectID());
    }
    else
    {
      DataFactory dataFactory = dataFactoryManager.restore(functionStorageKey, isReportsShareConnections(initialSubReport));

      final DefaultFlowController postPreProcessingFlowController;
      final SubReport preDataSubReport;
      if (dataFactory == null)
      {
        final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor(parentStateFlowController);
        preDataSubReport = preprocessor.invokePreDataProcessing(initialSubReport);
        postPreProcessingFlowController = preprocessor.getFlowController();

        final DataFactory subreportDf = lookupDataFactory(preDataSubReport);
        final boolean dataCacheEnabled = isCacheEnabled(preDataSubReport);
        if (subreportDf == null)
        {
          // subreport does not define a own factory, we reuse the parent's data-factory in the master-row.
          dataFactory = new EmptyDataFactory();
        }
        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
      {
        preDataSubReport = initialSubReport;
        postPreProcessingFlowController = parentStateFlowController;
      }

      // And now initialize the sub-report.
      final ParameterMapping[] inputMappings = preDataSubReport.getInputMappings();
      final ParameterMapping[] exportMappings = preDataSubReport.getExportMappings();

      // eval query, query-limit and query-timeout
      this.flowController = postPreProcessingFlowController.performInitSubreport
          (dataFactory, inputMappings, resourceBundleFactory);
      final Integer queryLimitDefault = IntegerCache.getInteger(preDataSubReport.getQueryLimit());
      final Integer queryTimeoutDefault = IntegerCache.getInteger(preDataSubReport.getQueryTimeout());

      final Object queryRaw = evaluateExpression(preDataSubReport.getAttributeExpression(AttributeNames.Internal.NAMESPACE,
          AttributeNames.Internal.QUERY), preDataSubReport.getQuery());
      final Object queryLimitRaw = evaluateExpression(preDataSubReport.getAttributeExpression(AttributeNames.Internal.NAMESPACE,
          AttributeNames.Internal.QUERY_LIMIT), queryLimitDefault);
      final Object queryTimeoutRaw = evaluateExpression(preDataSubReport.getAttributeExpression(AttributeNames.Internal.NAMESPACE,
          AttributeNames.Internal.QUERY_TIMEOUT), queryTimeoutDefault);
      final String queryDefined = designtime ? "design-time-query" : preDataSubReport.getQuery();
      this.query = (String) ConverterRegistry.convert(queryRaw, String.class, queryDefined);
      this.queryLimit = (Integer) ConverterRegistry.convert(queryLimitRaw, Integer.class, queryLimitDefault);
      this.queryTimeout = (Integer) ConverterRegistry.convert(queryTimeoutRaw, Integer.class, queryTimeoutDefault);
      final List<SortConstraint> sortOrder = lookupSortOrder(preDataSubReport);


      DefaultFlowController postQueryFlowController = flowController.performSubReportQuery
          (query, queryLimit.intValue(), queryTimeout.intValue(), exportMappings, sortOrder);
      final ProxyDataSchemaDefinition schemaDefinition =
          new ProxyDataSchemaDefinition(preDataSubReport.getDataSchemaDefinition(),
              postQueryFlowController.getMasterRow().getDataSchemaDefinition());
      postQueryFlowController = postQueryFlowController.updateDataSchema(schemaDefinition);

      SubReport fullReport = preDataSubReport;
      DefaultFlowController fullFlowController = postQueryFlowController;
      if (needPreProcessing)
      {
        final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor(postQueryFlowController);
        fullReport = preprocessor.invokePreProcessing(preDataSubReport);
        fullFlowController = preprocessor.getFlowController();
        subReportStorage.store(functionStorageKey, fullReport);
      }

      this.report = new ReportDefinitionImpl(fullReport, fullReport.getPageDefinition(), subreportFromMarker.getParentSection());


      final Expression[] structureFunctions = getStructureFunctionStorage().restore(functionStorageKey);
      if (structureFunctions != null)
      {
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.states.ReportDefinitionImpl

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.