Class ReportFormulaContext

  • All Implemented Interfaces:
    org.pentaho.reporting.libraries.formula.FormulaContext

    public class ReportFormulaContext
    extends Object
    implements org.pentaho.reporting.libraries.formula.FormulaContext
    The report formula context is a FormulaContext implementation that connects the formula evaluator with the current data-row of the report process.

    This is an internal class used by the FormulaExpression and FormulaFunction. It has no sensible usages outside of that scope.

    Author:
    Thomas Morgner
    • Constructor Detail

      • ReportFormulaContext

        public ReportFormulaContext​(org.pentaho.reporting.libraries.formula.FormulaContext backend,
                                    ExpressionRuntime runtime)
        Creates a new ReportFormulaContext using the given FormulaContext as backend. All data is read from the data-row.
        Parameters:
        backend - the formula-context backend.
        runtime - the ExpressionRuntime
    • Method Detail

      • getDataSchema

        public DataSchema getDataSchema()
      • getLocalizationContext

        public org.pentaho.reporting.libraries.formula.LocalizationContext getLocalizationContext()
        Returns the localization context of this formula. The localization context can be used to query locale specific configuration settings.
        Specified by:
        getLocalizationContext in interface org.pentaho.reporting.libraries.formula.FormulaContext
        Returns:
        the localization context.
      • getConfiguration

        public org.pentaho.reporting.libraries.base.config.Configuration getConfiguration()
        Returns the local configuration of the formula.
        Specified by:
        getConfiguration in interface org.pentaho.reporting.libraries.formula.FormulaContext
        Returns:
        the local configuration.
      • getFunctionRegistry

        public org.pentaho.reporting.libraries.formula.function.FunctionRegistry getFunctionRegistry()
        Returns the function registry. The function registry grants access to all formula-function implementations.
        Specified by:
        getFunctionRegistry in interface org.pentaho.reporting.libraries.formula.FormulaContext
        Returns:
        the function registry.
      • getTypeRegistry

        public org.pentaho.reporting.libraries.formula.typing.TypeRegistry getTypeRegistry()
        Returns the type registry. The type registry contains all type information and allows to convert values between different types.
        Specified by:
        getTypeRegistry in interface org.pentaho.reporting.libraries.formula.FormulaContext
        Returns:
        the function registry.
      • getOperatorFactory

        public org.pentaho.reporting.libraries.formula.operators.OperatorFactory getOperatorFactory()
        Returns the operator registry. The Operator-registry contains all operator-implementations.
        Specified by:
        getOperatorFactory in interface org.pentaho.reporting.libraries.formula.FormulaContext
        Returns:
        the operator registry.
      • isReferenceDirty

        public boolean isReferenceDirty​(Object name)
                                 throws org.pentaho.reporting.libraries.formula.EvaluationException
        Checks whether the external object referenced by name has changed. This forwards the call to the data-row and checks, whether the value has changed since the last call to advance().
        Specified by:
        isReferenceDirty in interface org.pentaho.reporting.libraries.formula.FormulaContext
        Parameters:
        name - the name that identifies the reference.
        Returns:
        true, if the reference has changed, false otherwise.
        Throws:
        org.pentaho.reporting.libraries.formula.EvaluationException - if an error occurs.
      • resolveReferenceType

        public org.pentaho.reporting.libraries.formula.typing.Type resolveReferenceType​(Object name)
        Resolves the given reference. How the name is interpreted by the outside system is an implementation detail. This method always returns AnyType, as we do not interpret the values returned from the data-row.
        Specified by:
        resolveReferenceType in interface org.pentaho.reporting.libraries.formula.FormulaContext
        Parameters:
        name - the name that identifies the reference.
        Returns:
        the resolved object.
      • resolveReference

        public Object resolveReference​(Object name)
                                throws org.pentaho.reporting.libraries.formula.EvaluationException
        Queries the type of the given reference. How the name is interpreted by the outside system is an implementation detail. This return a LibFormula type object matching the type of the object that would be returned by resolveReference.
        Specified by:
        resolveReference in interface org.pentaho.reporting.libraries.formula.FormulaContext
        Parameters:
        name - the name that identifies the reference.
        Returns:
        the type of the resolved object.
        Throws:
        org.pentaho.reporting.libraries.formula.EvaluationException - if an error occurs.
      • getDataRow

        public DataRow getDataRow()
        Returns the current data-row.
        Returns:
        the current datarow.
      • close

        public void close()
        Invalidates the formula context.
      • getExportType

        public String getExportType()
        Return the export type of the current report processing run.
        Returns:
        the current export type.
      • isResultSetEmpty

        public boolean isResultSetEmpty()
      • getCurrentDate

        public Date getCurrentDate()
        Specified by:
        getCurrentDate in interface org.pentaho.reporting.libraries.formula.FormulaContext