Class URLFilter
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.filter.URLFilter
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataFilter
,DataSource
,DataTarget
public class URLFilter extends Object implements DataFilter
The URLFilter forms URLs from Strings ,Files and URLs. If an URL is relative, the missing contents can be obtained by a default url, called the baseURL.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description URLFilter()
DefaultConstructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URLFilter
clone()
Creates a clone of the URL filter.URL
getBaseURL()
Gets the base url used to make relative URLs absolute.DataSource
getDataSource()
Returns the data source for the filter.Object
getValue(ExpressionRuntime runtime, ReportElement element)
Tries to form a url from the object returned from the datasource.void
setBaseURL(URL baseURL)
Defines the base url used to complete relative urls.void
setDataSource(DataSource ds)
Sets the data source.
-
-
-
Method Detail
-
getDataSource
public DataSource getDataSource()
Returns the data source for the filter.- Specified by:
getDataSource
in interfaceDataTarget
- Returns:
- The data source.
-
setDataSource
public void setDataSource(DataSource ds)
Sets the data source.- Specified by:
setDataSource
in interfaceDataTarget
- Parameters:
ds
- The data source.
-
getValue
public Object getValue(ExpressionRuntime runtime, ReportElement element)
Tries to form a url from the object returned from the datasource. This function will return null if the datasource is null or returned null when getValue was called. Null is also returned if the datasources value is not an url, a String or a file. If the creation of the url failed with an MalformedURLException or the datasource returned a file which is not readable, also 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:
- created url or null if something went wrong on url creation.
-
getBaseURL
public URL getBaseURL()
Gets the base url used to make relative URLs absolute.- Returns:
- the base url used to complete relative urls.
-
setBaseURL
public void setBaseURL(URL baseURL)
Defines the base url used to complete relative urls.- Parameters:
baseURL
- the base URL.
-
clone
public URLFilter clone() throws CloneNotSupportedException
Creates a clone of the URL filter.- Specified by:
clone
in interfaceDataSource
- Specified by:
clone
in interfaceDataTarget
- Overrides:
clone
in classObject
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- should never happen.
-
-