Class DataRowDataSource
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.filter.DataRowDataSource
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataSource
public class DataRowDataSource extends Object implements DataSource
A DataSource that can access values from the 'data-row'. The data-row contains all values from the current row of the report'sTableModel
, plus the current values of the defined expressions and functions for the report. The DataRowDataSource can either query the data-row directly using the specified field name or it can evaluate a given formula (which must be compatible to the OpenFormula specifications) to compute the value. Fields and formulas are mutually exclusive; defining a field name autmatically undefines the formula and vice versa.- Author:
- Thomas Morgner
- See Also:
DataRow
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DataRowDataSource()
Default constructor.DataRowDataSource(String column)
Constructs a new data source.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DataRowDataSource
clone()
Clones the data source.String
getDataSourceColumnName()
Returns the data source column name.String
getField()
Deprecated.Required for legacy-parsing, do not use elsewhere.String
getFormula()
Returns the formula used to compute the value of the data source.Object
getValue(ExpressionRuntime runtime, ReportElement element)
Returns the current value of the data source, obtained from a particular column in the data-row.void
setDataSourceColumnName(String dataSourceColumnName)
Defines the name of the column in the datarow to be queried.void
setField(String field)
Deprecated.Required for legacy-parsing, do not use elsewhere.void
setFormula(String formula)
Defines the formula used to compute the value of this data source.
-
-
-
Constructor Detail
-
DataRowDataSource
public DataRowDataSource()
Default constructor. The expression name is empty ("", not null), the value initially null.
-
DataRowDataSource
public DataRowDataSource(String column)
Constructs a new data source.- Parameters:
column
- the name of the field, function or expression in the data-row.
-
-
Method Detail
-
getField
public String getField()
Deprecated.Required for legacy-parsing, do not use elsewhere.
-
setField
public void setField(String field)
Deprecated.Required for legacy-parsing, do not use elsewhere.- Parameters:
field
-
-
getDataSourceColumnName
public String getDataSourceColumnName()
Returns the data source column name.- Returns:
- the column name.
-
setDataSourceColumnName
public void setDataSourceColumnName(String dataSourceColumnName)
Defines the name of the column in the datarow to be queried.- Parameters:
dataSourceColumnName
- the name of the column in the datarow to be queried.- Throws:
NullPointerException
- if the name isnull
.- See Also:
DataRow.get(java.lang.String)
-
getFormula
public String getFormula()
Returns the formula used to compute the value of the data source.- Returns:
- the formula.
-
setFormula
public void setFormula(String formula)
Defines the formula used to compute the value of this data source.- Parameters:
formula
- the formula for the data source.
-
getValue
public Object getValue(ExpressionRuntime runtime, ReportElement element)
Returns the current value of the data source, obtained from a particular column in the data-row.- Specified by:
getValue
in interfaceDataSource
- Parameters:
runtime
- the expression runtime that is used to evaluate formulas and expressions when computing the value of this filter.element
-- Returns:
- the value.
-
clone
public DataRowDataSource clone() throws CloneNotSupportedException
Clones the data source. A previously registered report definition is not inherited to the clone.- Specified by:
clone
in interfaceDataSource
- Overrides:
clone
in classObject
- Returns:
- a clone.
- Throws:
CloneNotSupportedException
- if the cloning is not supported.
-
-