Script
See also: Script actor, Scripted rule, Script value
CAUTION
The Script compare type is only suitable for highly advanced users with experience of programming. Therefore no detailed application possibilities are described here, since this is part of the developer documentation. The Script compare type should be used exclusively for problems for which Lobster Data Platform / Orchestration does not offer generic approaches. Incorrect use of this compare type can cause significant and irrevocable damage to the system and the dataset. Please contact our support staff for further information and possible training/workshops in this regard.
►NOTE◄ The Script compare type is only supported on the server side. It is not selectable in the Client workflow.
The Script compare type allows the definition of specific compare logic via a Bean Shell script. Like all other compare types, the Script compare type is also used within an Entity property rule.
A Boolean value is expected as the return value (return) of the script, which defines whether the comparison and therefore the parent Entity property rule is considered 'passed' (true) or 'failed' (false).
In fact, any return value other than true is considered 'failed' at the Entity property rule level.
Errors that occur during execution of the script are intercepted. The Entity property rule is considered as 'failed' if necessary.
Configuration
The 'script' must be entered as static text in a Text field marked as syntax highlighter. The script can also contain comments (see screenshot, below).
►NOTE◄ The editor is only available in context if the Role of session has the "Administration/System/BSH Script/Script Bearbeiten" permission. This permission has no influence on the runtime behavior of an already configured comparison.
Variables
Below the script editor, value configurations for variables can be added by clicking on the
icon.
A unique Variable name must be specified for each variable.
For read access to variables defined here in the script, the get()function is needed.
An existing variable configuration can be removed by clicking on the
icon.
►NOTE◄
The reference object for the Entity property rule (entity) serves as the reference object for value configurations of variables. The check value configuration of the Entity property rule has no influence on this.
Variables that apply in the context of the Entity property rule can be read in the script via the action parameter (see below) even without explicit value configuration via get() function.
Parameters
At runtime, selected data from the Entity property rule context is provided via parameters for access in the script:
Parameter |
Description |
environment |
Lobster Data Platform / Orchestration environment instance |
si |
Session information object (see Session information) |
logger |
Logger instance |
action |
The current action being handled with all variables (e.g. action.get("VARNAME") ) |
entity |
Reference object given by the context of the Entity property rule |
em |
current database session |