Scripting and Script Tasks

In Primeur Data Mover, Script Tasks are used to execute scripts in a JSR-223 compatible scripting language, for instance, JavaScript or Groovy.

Scripts Tasks are mainly used to perform simple calculations or operations.

Here below you can find some snippets of an example used when developing Script Tasks to clarify the usage of some basic scripting operations and their syntax.

Example: DataType Conversion

testMe is a Process Variable inside a running instance, its type is int but we need to convert it to a String because we need to place it into a Map<String,String>.

This is the result according to the content of a Log Info Service Task containing:

TESTVARIABLE: ${testMe} - TOSTRING: ${execution.getVariable("testMe").concat("")} 
-  APPENDSTR: ${execution.getVariable("testMe").concat("example")} 
-  ADDNUMBER: ${execution.getVariable("testMe") +5}

The resulting log, once set testMe as an int variable assigned with 2 as value will be:

2018-07-30 16:18:00,264 
INFO  [com.primeur.ghibli.workflow.bpm.boundary.services.log.BpmLogInfoService] (pool-13-thread-1247) 
TESTVARIABLE: 2 - TOSTRING: 2 - APPENDSTR: 2example  - ADDNUMBER: 7

Last updated