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

Examples of org.pentaho.reporting.engine.classic.core.states.datarow.DefaultFlowController


    {
      processingContext = new DefaultProcessingContext();
    }

    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);
View Full Code Here


  public static MasterReport materialize(final MasterReport report,
                                         final WizardProcessor processor) throws ReportProcessingException
  {
    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);
View Full Code Here

  }

  public ProcessState commit(final ProcessState next) throws ReportProcessingException
  {
    next.leaveGroup();
    final DefaultFlowController fc = next.getFlowController();
    final boolean advanceRequested = fc.isAdvanceRequested();
    final boolean advanceable = fc.getMasterRow().isAdvanceable();
    if (isRootGroup(next))
    {
      throw new ReportProcessingException("This report is invalid. A CR-Row-Group cannot be a root group.");
    }

    final Group parentGroup = next.getReport().getGroup(next.getCurrentGroupIndex());
    if (advanceRequested == false || advanceable == false)
    {
      // This happens for empty - reports. Empty-Reports are never advanceable, therefore we can
      // reach an non-advance state where inner group-footers are printed.
      if (parentGroup instanceof CrosstabRowGroup)
      {
        next.setAdvanceHandler(EndCrosstabRowAxisHandler.HANDLER);
      }
      else if (parentGroup instanceof CrosstabGroup)
      {
        next.setAdvanceHandler(EndCrosstabHandler.HANDLER);
      }
      else if (parentGroup instanceof CrosstabOtherGroup)
      {
        next.setAdvanceHandler(EndCrosstabOtherAxisHandler.HANDLER);
      }
      else
      {
        throw new ReportProcessingException("This report is invalid.");
      }
      return next;
    }

    // This group is not the outer-most group ..
    final DefaultFlowController cfc = fc.performCommit();
    if (ProcessState.isLastItemInGroup(parentGroup, fc.getMasterRow(), cfc.getMasterRow()))
    {
      // continue with an other EndGroup-State ...
      if (parentGroup instanceof CrosstabRowGroup)
      {
        next.setAdvanceHandler(EndCrosstabRowAxisHandler.HANDLER);
      }
      else if (parentGroup instanceof CrosstabGroup)
      {
        next.setAdvanceHandler(EndCrosstabHandler.HANDLER);
      }
      else if (parentGroup instanceof CrosstabOtherGroup)
      {
        next.setAdvanceHandler(EndCrosstabOtherAxisHandler.HANDLER);
      }
      else
      {
        throw new ReportProcessingException("This report is invalid.");
      }
      return next;
    }
    else
    {
      // The parent group is not finished, so finalize the createRollbackInformation.
      // more data in parent group, print the next header
      final DefaultFlowController rfc = cfc.resetRowCursor();
      next.setFlowController(rfc);
      next.setAdvanceHandler(BeginCrosstabRowAxisHandler.HANDLER);
      return next;
    }
  }
View Full Code Here

    return state.deriveForAdvance();
  }

  public ProcessState commit(final ProcessState next) throws ReportProcessingException
  {
    final DefaultFlowController fc = next.getFlowController().performAdvance();
    final Group group = next.getReport().getGroup(next.getCurrentGroupIndex());
    final DefaultFlowController cfc = fc.performCommit();
    if (ProcessState.isLastItemInGroup(group, fc.getMasterRow(), cfc.getMasterRow()))
    {
      next.setFlowController(fc);
      next.setAdvanceHandler(EndCrosstabFactHandler.HANDLER);
    }
    else
View Full Code Here

  }

  public ProcessState commit(final ProcessState next) throws ReportProcessingException
  {
    next.leaveGroup();
    final DefaultFlowController fc = next.getFlowController();
    final boolean advanceRequested = fc.isAdvanceRequested();
    final boolean advanceable = fc.getMasterRow().isAdvanceable();
    if (isRootGroup(next))
    {
      throw new ReportProcessingException("This report is invalid. A CR-Col-Group cannot be a root group.");
    }

    final Group parentGroup = next.getReport().getGroup(next.getCurrentGroupIndex());
    if (advanceRequested == false || advanceable == false)
    {
      // This happens for empty - reports. Empty-Reports are never advanceable, therefore we can
      // reach an non-advance state where inner group-footers are printed.
      if (parentGroup instanceof CrosstabRowGroup)
      {
        next.setAdvanceHandler(EndCrosstabRowAxisHandler.HANDLER);
      }
      else if (parentGroup instanceof CrosstabColumnGroup)
      {
        next.setAdvanceHandler(EndCrosstabColumnAxisHandler.HANDLER);
      }
      else
      {
        throw new ReportProcessingException("This report is invalid.");
      }
      return next;
    }

    // This group is not the outer-most group ..
    final DefaultFlowController cfc = fc.performCommit();
    if (ProcessState.isLastItemInGroup(parentGroup, fc.getMasterRow(), cfc.getMasterRow()))
    {
      // continue with an other EndGroup-State ...
      if (parentGroup instanceof CrosstabRowGroup)
      {
        next.setAdvanceHandler(EndCrosstabRowAxisHandler.HANDLER);
View Full Code Here

  }

  public ProcessState commit(final ProcessState next) throws ReportProcessingException
  {
    next.leaveGroup();
    final DefaultFlowController fc = next.getFlowController();
    final boolean advanceRequested = fc.isAdvanceRequested();
    final boolean advanceable = fc.getMasterRow().isAdvanceable();
    if (isRootGroup(next))
    {
      throw new ReportProcessingException("This report is invalid. A CR-Other-Group cannot be a root group.");
    }

    final Group parentGroup = next.getReport().getGroup(next.getCurrentGroupIndex());
    if (advanceRequested == false || advanceable == false)
    {
      // This happens for empty - reports. Empty-Reports are never advanceable, therefore we can
      // reach an non-advance state where inner group-footers are printed.
      if (parentGroup instanceof CrosstabGroup)
      {
        next.setAdvanceHandler(EndCrosstabHandler.HANDLER);
      }
      else if (parentGroup instanceof CrosstabOtherGroup)
      {
        next.setAdvanceHandler(EndCrosstabOtherAxisHandler.HANDLER);
      }
      else
      {
        throw new ReportProcessingException("This report is invalid.");
      }
      return next;
    }

    // This group is not the outer-most group ..
    final DefaultFlowController cfc = fc.performCommit();
    if (ProcessState.isLastItemInGroup(parentGroup, fc.getMasterRow(), cfc.getMasterRow()))
    {
      // continue with an other EndGroup-State ...
      if (parentGroup instanceof CrosstabGroup)
      {
        next.setAdvanceHandler(EndCrosstabHandler.HANDLER);
      }
      else if (parentGroup instanceof CrosstabOtherGroup)
      {
        next.setAdvanceHandler(EndCrosstabOtherAxisHandler.HANDLER);
      }
      else
      {
        throw new ReportProcessingException("This report is invalid.");
      }
      return next;
    }
    else
    {
      // The parent group is not finished, so finalize the createRollbackInformation.
      // more data in parent group, print the next header
      final DefaultFlowController rfc = cfc.resetRowCursor();
      next.setFlowController(rfc);
      next.setAdvanceHandler(BeginCrosstabOtherAxisHandler.HANDLER);
      return next;
    }
  }
View Full Code Here

  }

  public ProcessState advance(final ProcessState state) throws ReportProcessingException
  {
    final ProcessState next = state.deriveForAdvance();
    final DefaultFlowController flowController = next.getFlowController().endCrosstabMode();
    next.setFlowController(flowController);
    return next;
  }
View Full Code Here

  }

  public ProcessState commit(final ProcessState next) throws ReportProcessingException
  {
    next.leaveGroup();
    final DefaultFlowController fc = next.getFlowController();
    final boolean advanceRequested = fc.isAdvanceRequested();
    final boolean advanceable = fc.getMasterRow().isAdvanceable();
    if (isRootGroup(next))
    {
      // there is no parent group. So if there is more data, print the next header for this group,
      // else print the report-footer and finish the report processing.
      if (advanceRequested && advanceable)
      {
        final DefaultFlowController cfc = fc.performCommit();
        next.setFlowController(cfc);
        next.setAdvanceHandler(BeginCrosstabHandler.HANDLER);
        return next;
      }
      else
      {
        next.setAdvanceHandler(ReportFooterHandler.HANDLER);
        return next;
      }
    }

    if (advanceRequested == false || advanceable == false)
    {
      // This happens for empty - reports. Empty-Reports are never advanceable, therefore we can
      // reach an non-advance state where inner group-footers are printed.
      next.setAdvanceHandler(EndGroupHandler.HANDLER);
      return next;
    }

    // This group is not the outer-most group ..
    final Group group = next.getReport().getGroup(next.getCurrentGroupIndex());
    final DefaultFlowController cfc = fc.performCommit();
    if (ProcessState.isLastItemInGroup(group, fc.getMasterRow(), cfc.getMasterRow()))
    {
      // continue with an other EndGroup-State ...
      next.setAdvanceHandler(EndGroupHandler.HANDLER);
      return next;
    }
View Full Code Here

      // and then compute the runlevels based on what we have in the caches.
      this.structuralPreprocessingNeeded = true;
    }

    final DataSchemaDefinition definition = report.getDataSchemaDefinition();
    final DefaultFlowController flowController = new DefaultFlowController(processingContext,
        definition, StateUtilities.computeParameterValueSet(report, parameterValues),
        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;
    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.performQuery
        (dataFactory, query, queryLimit.intValue(), queryTimeout.intValue(),
            processingContext.getResourceBundleFactory());
    final ReportPreProcessor[] processors = getAllPreProcessors(report);
    MasterReport fullReport = report;
    DataSchemaDefinition fullDefinition = definition;
    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);
      }
    }

    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()));
View Full Code Here

          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)
      {
        final StructureFunction[] functions = new StructureFunction[structureFunctions.length];
        //noinspection SuspiciousSystemArraycopy
        System.arraycopy(structureFunctions, 0, functions, 0, structureFunctions.length);
        this.layoutProcess = new SubLayoutProcess(parentState.layoutProcess, functions);
      }
      else
      {
        final StructureFunction[] functions = computeStructureFunctions(fullReport.getStructureFunctions(),
            postQueryFlowController.getReportContext().getOutputProcessorMetaData());
        this.layoutProcess = new SubLayoutProcess(parentState.layoutProcess, functions);
      }

      boolean preserve = true;
      Expression[] expressions = getFunctionStorage().restore(functionStorageKey);
      if (expressions == null)
      {
        // ok, it seems we have entered a new subreport ..
        // we use the expressions from the report itself ..
        expressions = fullReport.getExpressions().getExpressions();
        preserve = false;
      }

      this.flowController = postQueryFlowController.activateExpressions(expressions, preserve);
    }

    StateUtilities.computeLevels(this.flowController, this.layoutProcess, processLevels);
    this.processKey = createKey();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.states.datarow.DefaultFlowController

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.