Package org.eclipse.birt.report.engine.api.script

# Interface IReportContext

public interface IReportContext
An interface used to share information between the event methods in scripting. Gives access to report parameters and configuration values. Also provides a way for the report developer to register and retrieve custom properties.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`PAGE_VAR_PAGE_LABEL`
property: page label

## Method Summary

Modifier and Type
Method
Description
`void`
`cancel()`
cancel the current engine task
`void`
`cancel(String reason)`
Cancel the current engine task
`void`
`deleteGlobalVariable(String name)`
Remove an object from runtime scope.
`void`
`deletePersistentGlobalVariable(String name)`
Remove an object from report document scope.
`Object`
`evaluate(String script)`
Evaluate the script with default script language.
`Object`
`evaluate(String language, String script)`
Evaluate the script with specified script language.
`Object`
`evaluate(org.eclipse.birt.report.engine.ir.Expression script)`
Evaluate the script.
`Map`
`getAppContext()`
Get the application context
`ClassLoader`
`getApplicationClassLoader()`
Get the application classLoader of the current report context
`org.eclipse.birt.report.model.api.ReportDesignHandle`
`getDesignHandle()`
get the report design handle.
`Object`
`getGlobalVariable(String name)`
Get the value of the global variable
`Object`
`getHttpServletRequest()`
Get the HTTP servlet request object
`Locale`
`getLocale()`
Get the locale
`String`
`getMessage(String key)`
Finds user-defined messages for the current thread's locale.
`String`
`getMessage(String key, Object[] params)`
Finds user-defined messages for the current thread's locale using parameters
`String`
`getMessage(String key, Locale locale)`
Finds user-defined messages for the given locale.
`String`
`getMessage(String key, Locale locale, Object[] params)`
Finds user-defined messages for the given locale using parameters
`String`
`getOutputFormat()`
Get the output format
`Object`
`getPageVariable(String name)`
Get the page variable
`Object`
`getParameterDisplayText(String name)`
Get the display text
`Object`
`getParameterValue(String name)`
Get the parameter value
`Object`
`getPersistentGlobalVariable(String name)`
Retrieve an object from report document scope.
`org.eclipse.birt.report.engine.api.IRenderOption`
`getRenderOption()`
Get the render options used to render the report.
`org.eclipse.birt.report.engine.api.IReportRunnable`
`getReportRunnable()`
return the report runnable used to create/render this report
`URL`
`getResource(String resourceName)`
get the URL for the resource.
`String`
`getResourceRenderURL(String resourceName)`
get the render URL for a resource.
`int`
`getTaskType()`
Get the type of the current task.
`com.ibm.icu.util.TimeZone`
`getTimeZone()`
Get the time zone informations
`boolean`
`isReportDocumentFinished()`
Check if the report document generation is finished.
`void`
`setGlobalVariable(String name, Object obj)`
Add the object to runtime scope.
`void`
`setPageVariable(String name, Object value)`
Set the page variable
`void`
`setParameterDisplayText(String name, String value)`
`void`
`setParameterValue(String name, Object value)`
Set the parameter value
`void`
`setPersistentGlobalVariable(String name, Serializable obj)`
Add the object to report document scope.

## Field Details

### PAGE_VAR_PAGE_LABEL

static final String PAGE_VAR_PAGE_LABEL
property: page label

See Also:
  - Constant Field Values

## Method Details

### getReportRunnable

org.eclipse.birt.report.engine.api.IReportRunnable getReportRunnable()
return the report runnable used to create/render this report

Returns:
  the report runnable used to create/render this report

### getParameterValue

Object getParameterValue(String name)
Get the parameter value

Parameters:
  `name` - parameter name
Returns:
  the parameter value

### setParameterValue

void setParameterValue(String name, Object value)
Set the parameter value

Parameters:
  `name` - parameter name
  `value` - object value

### getParameterDisplayText

Object getParameterDisplayText(String name)
Get the display text

Parameters:
  `name` - parameter name
Returns:
  the display text

### setParameterDisplayText

void setParameterDisplayText(String name, String value)

Parameters:
  `name` -
  `value` -

### getLocale

Locale getLocale()
Get the locale

Returns:
  the locale

### getTimeZone

com.ibm.icu.util.TimeZone getTimeZone()
Get the time zone informations

Returns:
  the time zone informations

### getOutputFormat

String getOutputFormat()
Get the output format

Returns:
  the output format

### getRenderOption

org.eclipse.birt.report.engine.api.IRenderOption getRenderOption()
Get the render options used to render the report.

Returns:
  the render options used to render the report.

### getAppContext

Map getAppContext()
Get the application context

Returns:
  the application context

### getHttpServletRequest

Object getHttpServletRequest()
Get the HTTP servlet request object

Returns:
  the HTTP servlet request object

### setGlobalVariable

void setGlobalVariable(String name, Object obj)
Add the object to runtime scope. This object can only be retrieved in the same phase, i.e. it is not persisted between generation and presentation.

Parameters:
  `name` - name of the global variable
  `obj` - object value

### deleteGlobalVariable

void deleteGlobalVariable(String name)
Remove an object from runtime scope.

Parameters:
  `name` - variable name

### getGlobalVariable

Object getGlobalVariable(String name)
Get the value of the global variable

Parameters:
  `name` - variable name
Returns:
  the value of the global variable

### setPersistentGlobalVariable

void setPersistentGlobalVariable(String name, Serializable obj)
Add the object to report document scope. This object can be retrieved later. It is persisted between phases, i.e. between generation and presentation.

Parameters:
  `name` - variable name
  `obj` - object value

### deletePersistentGlobalVariable

void deletePersistentGlobalVariable(String name)
Remove an object from report document scope.

Parameters:
  `name` - variable name

### getPersistentGlobalVariable

Object getPersistentGlobalVariable(String name)
Retrieve an object from report document scope.

Parameters:
  `name` - variable name
Returns:
  the global variable value

### getPageVariable

Object getPageVariable(String name)
Get the page variable

Parameters:
  `name` - variable name
Returns:
  the page variable

### setPageVariable

void setPageVariable(String name, Object value)
Set the page variable

Parameters:
  `name` - variable name
  `value` - object value

### getMessage

String getMessage(String key)
Finds user-defined messages for the current thread's locale.

Parameters:
  `key` - resource key of the user-defined message.
Returns:
  the corresponding locale-dependent messages. Return `null` if resoueceKey is blank.

### getMessage

String getMessage(String key, Locale locale)
Finds user-defined messages for the given locale.

First we look up in the report itself, then look into the referenced message file. Each search uses a reduced form of Java locale-driven search algorithm: Languageinvalid input: '&Country', language, default.

Parameters:
  `key` - resource key of the user defined message.
  `locale` - locale of message, if the input `locale` is `null`, the locale for the current thread will be used instead.
Returns:
  the corresponding locale-dependent messages. Return `null` if resoueceKey is blank.

### getMessage

String getMessage(String key, Object[] params)
Finds user-defined messages for the current thread's locale using parameters

Parameters:
  `key` - resource key of the user-defined message.
  `params` - string arguments used to format error messages
Returns:
  the corresponding locale-dependent messages. Return `null` if resoueceKey is blank.

### getMessage

String getMessage(String key, Locale locale, Object[] params)
Finds user-defined messages for the given locale using parameters

First we look up in the report itself, then look into the referenced message file. Each search uses a reduced form of Java locale-driven search algorithm: Languageinvalid input: '&Country', language, default.

Parameters:
  `key` - resource key of the user defined message.
  `locale` - locale of message, if the input `locale` is `null`, the locale for the current thread will be used instead.
  `params` - string arguments used to format error messages
Returns:
  the corresponding locale-dependent messages. Return `null` if resoueceKey is blank.

### getTaskType

int getTaskType()
Get the type of the current task.

Returns:
  task type including:

0 for GetParameterDefinition Task
1 for Run Task
2 for Render Task
3 for Run and Render Task
4 for DataExtraction Task
-1 default value for unknown task

### getDesignHandle

org.eclipse.birt.report.model.api.ReportDesignHandle getDesignHandle()
get the report design handle.

Returns:
  report design handle

### getResource

URL getResource(String resourceName)
get the URL for the resource. The url can only be used in the server side.

Parameters:
  `resourceName` - resource name
Returns:
  resource URL

### getResourceRenderURL

String getResourceRenderURL(String resourceName)
get the render URL for a resource.

Parameters:
  `resourceName` - resource name
Returns:
  the URL which can be used in the client side.

### evaluate

Object evaluate(String script) throws org.eclipse.birt.core.exception.BirtException
Evaluate the script with default script language.

Parameters:
  `script` - script to be evaluated
Returns:
  the evaluated script
Throws:
  `org.eclipse.birt.core.exception.BirtException`

### evaluate

Object evaluate(String language, String script) throws org.eclipse.birt.core.exception.BirtException
Evaluate the script with specified script language.

Parameters:
  `language` -
  `script` - script to be evaluated
Returns:
  the evaluated script
Throws:
  `org.eclipse.birt.core.exception.BirtException`

### evaluate

Object evaluate(org.eclipse.birt.report.engine.ir.Expression script) throws org.eclipse.birt.core.exception.BirtException
Evaluate the script.

Parameters:
  `script` - script to be evaluated
Returns:
  the evaluated script
Throws:
  `org.eclipse.birt.core.exception.BirtException`

### getApplicationClassLoader

ClassLoader getApplicationClassLoader()
Get the application classLoader of the current report context

Returns:
  application classLoader

### cancel

void cancel()
cancel the current engine task

### cancel

void cancel(String reason)
Cancel the current engine task

Parameters:
  `reason` - cancellation reason

### isReportDocumentFinished

boolean isReportDocumentFinished()
Check if the report document generation is finished. It should be used at render time. The default value is false

Returns:
  true, if the report document is finished