Examples of ReportStateKey


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

    return key;
  }

  protected void processOtherNode(final RenderNode node)
  {
    final ReportStateKey stateKey = node.getStateKey();
    if (stateKey == null || stateKey.isInlineSubReportState())
    {
      return;
    }

    if (key == null)
    {
      key = stateKey;
      return;
    }

    if (stateKey.getSequenceCounter() > key.getSequenceCounter())
    {
      key = stateKey;
    }
  }
View Full Code Here

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

        eventTrigger = Math.min(maxRows, Math.max(maxRows / MAX_EVENTS_PER_RUN, MIN_ROWS_PER_EVENT));
      }

      final boolean pagebreaksSupported = isPagebreaksSupported();

      ReportStateKey rollbackPageState = null;

      ProcessState state = startState.deriveForStorage();
      ProcessState fallBackState = pagebreaksSupported ? state.deriveForPagebreak() : null;
      final ProcessState globalState = pagebreaksSupported ? state.deriveForStorage() : null;
      state.setErrorHandler(errorHandler);

      boolean isInRollBackMode = false;
      int lastRow = -1;
      int eventCount = 0;
      int pageEventCount = 0;
      while (!state.isFinish())
      {
        checkInterrupted();
        if (lastRow != state.getCurrentRow())
        {
          lastRow = state.getCurrentRow();
          if (eventCount == 0)
          {
            repaginationState.reuse(ReportProgressEvent.GENERATING_CONTENT, state, calculatePageCount(state));
            fireStateUpdate(repaginationState);
            eventCount += 1;
          }
          else
          {
            if (eventCount == eventTrigger)
            {
              eventCount = 0;
            }
            else
            {
              eventCount += 1;
            }
          }
        }

        ProcessState realFallbackState = fallBackState;
        final ProcessState restoreState;
        if (pagebreaksSupported && state.isArtifcialState() == false)
        {
          restoreState = fallBackState;
          if (isInRollBackMode == false)
          {
            if (pageEventCount >= AbstractReportProcessor.COMMIT_RATE)
            {
              final OutputFunction outputFunction = state.getLayoutProcess().getOutputFunction();
              if (outputFunction.createRollbackInformation())
              {
                if (AbstractReportProcessor.SHOW_ROLLBACKS)
                {
                  logger.debug("Print: Try to generate new fallback state after commit count reached: " + state.getProcessKey());
                }
                realFallbackState = state.deriveForPagebreak();
              }
              else
              {
                realFallbackState = null;
              }
            }
          }
        }
        else
        {
          restoreState = null;
        }

        final ProcessState nextState = state.advance();
        state.setErrorHandler(IgnoreEverythingReportErrorHandler.INSTANCE);
        state = nextState;

        final ReportStateKey nextStateKey = state.getProcessKey();

        if (errorHandler.isErrorOccured() == true)
        {
          final List childExceptions = Arrays.asList(errorHandler.getErrors());
          errorHandler.clearErrors();
          if (failOnError)
          {
            throw new ReportEventException("Failed to dispatch an event.", childExceptions);
          }
          else
          {
            final ReportEventException exception =
                new ReportEventException("Failed to dispatch an event.", childExceptions);
            AbstractReportProcessor.logger.error("Failed to dispatch an event.", exception);
          }
        }

        if (state.isArtifcialState())
        {
          if (AbstractReportProcessor.SHOW_ROLLBACKS)
          {
            logger.debug("Print: Silent commit as we are in an artificial state: " + state.getProcessKey());
          }
          state = state.commit();
          if (AbstractReportProcessor.SHOW_ROLLBACKS)
          {
            logger.debug("Print: Post Silent commit as we are in an artificial state: " + state.getProcessKey());
          }
          continue;
        }

        final OutputFunction outputFunction = state.getLayoutProcess().getOutputFunction();
        if (outputFunction instanceof DefaultOutputFunction == false)
        {
          if (AbstractReportProcessor.SHOW_ROLLBACKS)
          {
            logger.debug("Print: Silent commit as we are have no access to the renderer: " + state.getProcessKey());
          }
          state = state.commit();
          continue;
        }

        final DefaultOutputFunction lm = (DefaultOutputFunction) outputFunction;
        final Renderer renderer = lm.getRenderer();
        renderer.setStateKey(state.getProcessKey());
        pagebreakHandler.setReportState(state);

        boolean assertExpectPagebreak = false;
        if (isInRollBackMode)
        {
          if (nextStateKey.equals(rollbackPageState))
          {
            // reached the border case. We have to insert a manual pagebreak here or at least
            // we have to force the renderer to end the page right now.
            if (AbstractReportProcessor.SHOW_ROLLBACKS)
            {
              AbstractReportProcessor.logger.debug(
                  "Print: Found real pagebreak position. This might be the last state we process: " + rollbackPageState);
              AbstractReportProcessor.logger.debug(
                  "Print:   (Current state process key)           : " + state.getProcessKey());
              AbstractReportProcessor.logger.debug(
                  "Print:   (Handler)                             : " + state.getAdvanceHandler().getClass().getName());
            }
            assertExpectPagebreak = true;
            renderer.addPagebreak();
          }
        }

        final Renderer.LayoutResult pagebreakEncountered = renderer.validatePages();
        if (AbstractReportProcessor.SHOW_ROLLBACKS)
        {
          AbstractReportProcessor.logger.debug("Print: Validate Page returned " + pagebreakEncountered);
          if (assertExpectPagebreak == true && pagebreakEncountered != Renderer.LayoutResult.LAYOUT_PAGEBREAK)
          {
            AbstractReportProcessor.logger.debug("Print: Missed the pagebreak. This smells fishy!");
          }
        }

        if (pagebreakEncountered != Renderer.LayoutResult.LAYOUT_UNVALIDATABLE)
        {
          if (pagebreaksSupported && state.isArtifcialState() == false)
          {
            if (isInRollBackMode == false)
            {
              if (pageEventCount >= AbstractReportProcessor.COMMIT_RATE)
              {
                if (AbstractReportProcessor.SHOW_ROLLBACKS)
                {
                  logger.debug("Print: Try to apply new fallback state after commit count reached: " + state.getProcessKey());
                  logger.debug("Print:        : " + renderer.getLastStateKey());
                }
                fallBackState = realFallbackState;
                pageEventCount = 0;
              }
              else
              {
                if (AbstractReportProcessor.SHOW_ROLLBACKS)
                {
                  logger.debug("Print: Increase counter: " + state.getProcessKey());
                }
                pageEventCount += 1;
              }
            }
          }
        }
        else if (AbstractReportProcessor.SHOW_ROLLBACKS)
        {
          if (pagebreaksSupported && state.isArtifcialState() == false)
          {
            if (isInRollBackMode == false)
            {
              logger.debug("Print: SKIP : " + state.getProcessKey());
            }
          }
        }

        if (pagebreakEncountered == Renderer.LayoutResult.LAYOUT_PAGEBREAK)
        {
          final boolean onGoingPageBreak;

          final ReportStateKey lastVisibleStateKey = renderer.getLastStateKey();
          if (pagebreaksSupported &&
              isInRollBackMode == false &&
              renderer.isOpen() &&
              lastVisibleStateKey != null)
          {
            if (lastVisibleStateKey.equals(nextStateKey) == false &&
                lastVisibleStateKey.getSequenceCounter() > globalState.getProcessKey().getSequenceCounter())
            {
              // Roll back to the last known to be good position and process the states up to, but not
              // including the current state. This way, we can fire the page-events *before* this band
              // gets printed.
              rollbackPageState = lastVisibleStateKey;

              final ReportStateKey restoreStateProcessKey = restoreState.getProcessKey();
              if (AbstractReportProcessor.SHOW_ROLLBACKS)
              {
                AbstractReportProcessor.logger.debug(
                    "Print: Encountered bad break, need to roll-back: " + rollbackPageState);
                AbstractReportProcessor.logger.debug(
                    "Print:    Next StateKey                        : " + state.getProcessKey());
                AbstractReportProcessor.logger.debug(
                    "Print:    Restored Key                         : " + restoreStateProcessKey);
                AbstractReportProcessor.logger.debug(
                    "Print:    Position in event chain              : " + restoreState.getSequenceCounter());
              }

              if (lastVisibleStateKey.getSequenceCounter() < restoreStateProcessKey.getSequenceCounter())
              {
                if (AbstractReportProcessor.SHOW_ROLLBACKS)
                {
                  AbstractReportProcessor.logger.debug(
                      "Print: Fall back to start of page              : " + globalState.getProcessKey());
View Full Code Here

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

    this.timePeriod = timePeriod;
  }

  protected HashMap<Comparable,TimeSeries> getSeriesMap ()
  {
    final ReportStateKey key = getStateKey();
    Sequence<HashMap<Comparable,TimeSeries>> sequence = seriesSequenceMap.get(key);
    if (sequence == null)
    {
      sequence = new Sequence<HashMap<Comparable,TimeSeries>>();
      seriesSequenceMap.put(key, sequence);
View Full Code Here

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

    }

    final long y = box.getY();
    if (y < paginationTableState.getPageEnd())
    {
      final ReportStateKey stateKey = box.getStateKey();
      if (stateKey != null && stateKey.isInlineSubReportState() == false)
      {
        this.visualState = stateKey;
      }
    }
  }
View Full Code Here

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

    if (y >= paginationTableState.getPageEnd())
    {
      return;
    }

    final ReportStateKey reportStateKey = findOldestProcessKeyStep.find(box);
    if (reportStateKey != null && reportStateKey.isInlineSubReportState() == false)
    {
      this.visualState = reportStateKey;
    }
  }
View Full Code Here

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

    this.seriesSequenceMap = new HashMap<ReportStateKey, Sequence<HashMap<Comparable, XYSeries>>>();
  }

  protected HashMap<Comparable,XYSeries> getSeriesMap ()
  {
    final ReportStateKey key = getStateKey();
    Sequence<HashMap<Comparable,XYSeries>> sequence = seriesSequenceMap.get(key);
    if (sequence == null)
    {
      sequence = new Sequence<HashMap<Comparable,XYSeries>>();
      seriesSequenceMap.put(key, sequence);
View Full Code Here

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

                                                final FontStorage fontRegistry,
                                                final boolean expectPageBreak,
                                                final boolean designTime)
      throws ReportProcessingException, ContentProcessingException
  {
    final ReportStateKey stateKey = new ReportStateKey();

    final DebugOutputProcessorMetaData metaData = new DebugOutputProcessorMetaData(fontRegistry);
    metaData.setDesignTime(designTime);

    final MasterReport report = originalReport.derive(true);
View Full Code Here

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

    if (recordedPageBreakPosition != 0 && y >= recordedPageBreakPosition)
    {
      return;
    }

    final ReportStateKey stateKey = box.getStateKey();
    if (stateKey != null && stateKey.isInlineSubReportState() == false)
    {
      this.visualState = stateKey;
    }
  }
View Full Code Here

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

    if (recordedPageBreakPosition != 0 && y >= recordedPageBreakPosition)
    {
      return;
    }

    final ReportStateKey reportStateKey = findOldestProcessKeyStep.find(box);
    if (reportStateKey != null && reportStateKey.isInlineSubReportState() == false)
    {
      this.visualState = reportStateKey;
    }
  }
View Full Code Here

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

        {
          processingStack = new FastStack<CrosstabSpecification>();
        }
        final String[] columnSet = computeColumns(crosstabGroup);
        final String[] rowSet = computeRows(crosstabGroup);
        final ReportStateKey processKey = state.getProcessKey();

        final CrosstabNormalizationMode normalizationMode = (CrosstabNormalizationMode)
            group.getAttribute(AttributeNames.Crosstab.NAMESPACE, AttributeNames.Crosstab.NORMALIZATION_MODE);
        if (CrosstabNormalizationMode.Insertation.equals(normalizationMode))
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.