Class ResourceFileFilter
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.filter.ResourceFileFilter
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataFilter
,DataSource
,DataTarget
public class ResourceFileFilter extends Object implements DataFilter
Lookup a key from a datasource using a ResourceBundle. Filters a given datasource and uses the datasource value as key for a ResourceBundle.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ResourceFileFilter()
Creates a new ResourceFileFilter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceFileFilter
clone()
Clones thisDataSource
.DataSource
getDataSource()
Returns the assigned DataSource for this Target.String
getResourceIdentifier()
Returns the name of the used resource bundle.Object
getValue(ExpressionRuntime runtime, ReportElement element)
Returns the current value for the data source.void
setDataSource(DataSource ds)
Assigns a DataSource for this Target.void
setResourceIdentifier(String resourceIdentifier)
Defines the name of the used resource bundle.
-
-
-
Method Detail
-
getResourceIdentifier
public String getResourceIdentifier()
Returns the name of the used resource bundle.- Returns:
- the name of the resourcebundle
- See Also:
ResourceBundleFactory.getResourceBundle(String)
-
setResourceIdentifier
public void setResourceIdentifier(String resourceIdentifier)
Defines the name of the used resource bundle. If undefined, all calls toDataSource.getValue(ExpressionRuntime, org.pentaho.reporting.engine.classic.core.ReportElement)
will result innull
values.- Parameters:
resourceIdentifier
- the resource bundle name
-
getValue
public Object getValue(ExpressionRuntime runtime, ReportElement element)
Returns the current value for the data source. The method will return null, if no datasource or no resource bundle is defined or if the datasource's value is null. The value read from the dataSource is looked up in the given resourcebundle using theResourceBundle.getObject()
method. If the lookup fails, null is returned.- 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 or null, if the value could not be looked up.
-
clone
public ResourceFileFilter clone() throws CloneNotSupportedException
Clones thisDataSource
.- Specified by:
clone
in interfaceDataSource
- Specified by:
clone
in interfaceDataTarget
- Overrides:
clone
in classObject
- Returns:
- the clone.
- Throws:
CloneNotSupportedException
- this should never happen.
-
getDataSource
public DataSource getDataSource()
Returns the assigned DataSource for this Target.- Specified by:
getDataSource
in interfaceDataTarget
- Returns:
- The datasource.
-
setDataSource
public void setDataSource(DataSource ds)
Assigns a DataSource for this Target.- Specified by:
setDataSource
in interfaceDataTarget
- Parameters:
ds
- The data source.
-
-