Class ReportFormulaContext
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.function.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 Summary
Constructors Constructor Description ReportFormulaContext(org.pentaho.reporting.libraries.formula.FormulaContext backend, ExpressionRuntime runtime)
Creates a new ReportFormulaContext using the given FormulaContext as backend.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Invalidates the formula context.org.pentaho.reporting.libraries.base.config.Configuration
getConfiguration()
Returns the local configuration of the formula.Date
getCurrentDate()
DataRow
getDataRow()
Returns the current data-row.DataSchema
getDataSchema()
String
getExportType()
Return the export type of the current report processing run.org.pentaho.reporting.libraries.formula.function.FunctionRegistry
getFunctionRegistry()
Returns the function registry.org.pentaho.reporting.libraries.formula.LocalizationContext
getLocalizationContext()
Returns the localization context of this formula.org.pentaho.reporting.libraries.formula.operators.OperatorFactory
getOperatorFactory()
Returns the operator registry.ProcessingContext
getProcessingContext()
ExpressionRuntime
getRuntime()
org.pentaho.reporting.libraries.formula.typing.TypeRegistry
getTypeRegistry()
Returns the type registry.boolean
isReferenceDirty(Object name)
Checks whether the external object referenced byname
has changed.boolean
isResultSetEmpty()
Object
resolveReference(Object name)
Queries the type of the given reference.org.pentaho.reporting.libraries.formula.typing.Type
resolveReferenceType(Object name)
Resolves the given reference.
-
-
-
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 interfaceorg.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 interfaceorg.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 interfaceorg.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 interfaceorg.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 interfaceorg.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 byname
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 interfaceorg.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 interfaceorg.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 interfaceorg.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.
-
getProcessingContext
public ProcessingContext getProcessingContext()
-
isResultSetEmpty
public boolean isResultSetEmpty()
-
getRuntime
public ExpressionRuntime getRuntime()
-
getCurrentDate
public Date getCurrentDate()
- Specified by:
getCurrentDate
in interfaceorg.pentaho.reporting.libraries.formula.FormulaContext
-
-