Script Contexts
Last updated
Last updated
There are two different script context types:
Both are based on ScriptContext and this is what they both have in common.
The ProcessScriptContext
contains the input and output documents, in addition to the information in ScriptContext
. A Document consists of the document content and its (dynamic document) properties.
public List<Document> inputDocuments = []
public List<Document> outputDocuments = []
A MapScriptContext
represents the input and output variables as they are defined on the platform, in addition to the information in ScriptContext
.
MapScriptContext scriptContext = new MapScriptContext( [
a: 5,
b: 7
])
_testScript.run(scriptContext)
assert scriptContext.variables.total
== (scriptContext.variables.a as int)
+ (scriptContext.variables.b as int),
"Calculation result does not meet expectations!"
The ScriptContext
is the base class,MapScriptContext
and ProcessScriptContext
inherit from it. The ScriptContext hosts:
Process Properties - procProps
Dynamic Process Properties - dynProcProps
Execution Properties - executionProperties
public Map dynProcPros = [:]
public Map procPros = [:]
public final Map executionProperties =
[
ACCOUNT_ID : 'IntelliJ_IDEA-M42S66',
ATOM_ID : '0b6e3ab7-9d81-4954-b781-d212195e577c',
ATOM_NAME : 'Markus Groovy 4 Boomi',
// null on local Atom, some text on Cloud ATOM (e.g. NODE_ID = atom01)
NODE_ID : null,
// set before script starts - ProcessScriptContext run
DOCUMENT_COUNT: 0,
// see Process Call Chain
// If you do not plan to use ExecutionTask objects in your
// scripts you can live with the defaults and you won't care!
EXECUTION_ID : generateExecutionId(), // random
PROCESS_ID : UUID.randomUUID().toString(),
PROCESS_NAME : "My Main Process"
]