public interface EventHandlerContext
extends com.archibus.utility.ThreadLocal
Describes event handler execution context. The context provides uniform access to named parameters from two sources:
Event handler input map, as recieved from the client. The event handler must not add, remove or change objects contained in the input map.
Event handler response map. The event handler can add values to the response map. The response values will be available to other event handlers or views as a workflow rule execution result.
Input parameters that are defined in the workflow rule XML configuration are evaluated by Web Central before the event handler is called. For each <input> tag Web Central:
Evaluates all macros in the @value
attribute. #Attribute
macro can be
used to pull any attribute of the incoming request action, or any attribute of the containing Web
Central context, e.g. preferences. #Date
macro can be used to pull current date
and/or time.
Formats evaluated value according to the @type
attribute, creating a Java object.
Puts created Java object into the input map, using @name
attribute as a map key.
Supported input parameter types:
The <input-group> tags in the workflow rule XML configuration are treated differently. Each
<input-group> tag contains an XPath query that is evaluated to a list of attributes,
usually from incoming request action. All found attribute values are put in the new Map, that is
in turn added to the input map as another input parameter, using @name
attribute of
the <input-group> tag as a map key.
Modifier and Type | Method and Description |
---|---|
void |
addInputParameter(java.lang.String name,
java.lang.Object value)
Adds value to the input parameter map.
|
void |
addResponseParameter(java.lang.String name,
java.lang.Object value)
Adds value to the response.
|
boolean |
getBoolean(java.lang.String name)
Returns parameter value converted to boolean type.
|
boolean |
getBoolean(java.lang.String name,
boolean defaultValue) |
void |
getDataRecordValues(com.archibus.datasource.data.DataRecord record)
Set specified DataRecordDTO values from "fieldValues" and "oldFieldValues" input parameters.
|
double |
getDouble(java.lang.String name)
Returns parameter value converted to double type.
|
double |
getDouble(java.lang.String name,
double defaultValue) |
java.util.Map |
getInputs()
Returns immutable Map of input parameters.
|
int |
getInt(java.lang.String name)
Returns parameter value converted to int type.
|
int |
getInt(java.lang.String name,
int defaultValue) |
org.json.JSONArray |
getJSONArray(java.lang.String name)
Returns parameter value as JSON array.
|
org.json.JSONObject |
getJSONObject(java.lang.String name)
Returns parameter value as JSON object.
|
org.json.JSONObject |
getJSONObject(java.lang.String name,
org.json.JSONObject defaultValue) |
java.util.Locale |
getLocale()
Returns the locale that overrides the current user locale.
|
java.lang.Object |
getParameter(java.lang.String name)
Returns formatted parameter value as Java object by name.
|
java.lang.Object |
getParameter(java.lang.String name,
java.lang.Object defaultValue) |
java.util.Map |
getParameters(java.lang.String name)
Returns a named group of parameter values.
|
java.util.Map |
getResponse()
Returns immutable Map of response parameters.
|
java.lang.String |
getString(java.lang.String name)
Returns parameter value cast to String type.
|
java.lang.String |
getString(java.lang.String name,
java.lang.String defaultValue) |
int |
getViewFormatVersion()
Returns view format version (1 for 1.0 views, 2 for 2.0 views) if specified in the context.
|
boolean |
parameterExists(java.lang.String key)
Checks whether named event handler parameter exists.
|
boolean |
parameterExistsNotEmpty(java.lang.String key)
Checks whether named event handler parameter exists and is not an empty string.
|
void |
removeResponseParameter(java.lang.String name)
Removes value from the response.
|
void |
setLocale(java.util.Locale locale)
Sets a locale to use in the workflow rule to localize database values.
|
void |
setResponse(com.archibus.datasource.data.DataRecord record)
Adds single record to the response using JSON format.
|
void |
setResponse(com.archibus.datasource.data.DataSet dataSet)
Adds dataset to the response using JSON format.
|
void |
setResponse(org.json.JSONArray json)
Adds a JSON array to the response as "jsonExpression" parameter.
|
void |
setResponse(org.json.JSONObject json)
Adds a JSON object to the response as "jsonExpression" parameter.
|
void |
setResponse(java.util.List values)
Adds a list of values to the response using JSON format.
|
void |
setResponse(java.util.Map values)
Adds a map of values to the response using JSON format.
|
int getViewFormatVersion()
java.lang.Object getParameter(java.lang.String name) throws com.archibus.utility.ExceptionBase
name
- Parameter name, must not be null.com.archibus.utility.ExceptionBase
- if name is specified (not null) but not found.java.lang.Object getParameter(java.lang.String name, java.lang.Object defaultValue) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
java.lang.String getString(java.lang.String name) throws com.archibus.utility.ExceptionBase
name
- Parameter name, must not be null.com.archibus.utility.ExceptionBase
- if name is specified (not null) but not found.java.lang.String getString(java.lang.String name, java.lang.String defaultValue) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
boolean getBoolean(java.lang.String name) throws com.archibus.utility.ExceptionBase
name
- Parameter name, must not be null.com.archibus.utility.ExceptionBase
- if name is specified (not null) but not found.boolean getBoolean(java.lang.String name, boolean defaultValue) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
int getInt(java.lang.String name) throws com.archibus.utility.ExceptionBase
name
- Parameter name, must not be null.com.archibus.utility.ExceptionBase
- if name is specified (not null) but not found.int getInt(java.lang.String name, int defaultValue) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
double getDouble(java.lang.String name) throws com.archibus.utility.ExceptionBase
name
- Parameter name, must not be null.com.archibus.utility.ExceptionBase
- if name is specified (not null) but not found.double getDouble(java.lang.String name, double defaultValue) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
org.json.JSONObject getJSONObject(java.lang.String name) throws com.archibus.utility.ExceptionBase
name
- Parameter name, must not be null.com.archibus.utility.ExceptionBase
- if name is specified (not null) but not found.org.json.JSONObject getJSONObject(java.lang.String name, org.json.JSONObject defaultValue) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
org.json.JSONArray getJSONArray(java.lang.String name) throws com.archibus.utility.ExceptionBase
name
- Parameter name, must not be null.com.archibus.utility.ExceptionBase
- if name is specified (not null) but not found.void getDataRecordValues(com.archibus.datasource.data.DataRecord record) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
java.util.Map getParameters(java.lang.String name) throws com.archibus.utility.ExceptionBase
name
- Name of com.archibus.utility.ExceptionBase
- if name is specified but not found or is not a Map.java.util.Map getInputs()
java.util.Map getResponse()
This method may return immutable Map in future releases.
boolean parameterExists(java.lang.String key)
key
- Parameter key.boolean parameterExistsNotEmpty(java.lang.String key)
key
- Parameter key.void addInputParameter(java.lang.String name, java.lang.Object value)
name
- Parameter name.value
- Parameter value.void addResponseParameter(java.lang.String name, java.lang.Object value)
name
- Parameter name.value
- Parameter value.void removeResponseParameter(java.lang.String name)
name
- Parameter name.void setResponse(com.archibus.datasource.data.DataRecord record)
record
- DataRecordDTOvoid setResponse(com.archibus.datasource.data.DataSet dataSet)
dataSet
- DataSetvoid setResponse(java.util.List values)
records
- Listvoid setResponse(java.util.Map values)
records
- Mapvoid setResponse(org.json.JSONObject json)
json
- JSONObjectvoid setResponse(org.json.JSONArray json)
json
- JSONArrayvoid setLocale(java.util.Locale locale)
locale
- java.util.Locale getLocale()