Variable types
This section describes the interactions between workflows and contracts, including the variables that can be configured in a workflow and initialized in the contract. The filters to be configured in a contract against specific triggers and how to use custom scripts, through a service called Script Task, are given as well.
BOOLEAN
Boolean
Select True/False
CLUSTER
Cluster
Select with the Cluster List
CODE_PAGE
File Code Page
Select with the enum (/ghibli-rest/v2/resources/enums/Charsets)
COMPRESSION
Compression
Select with the enum (/ghibli-rest/v2/resources/enums/Compression)
COMPRESSION_STRATEGY_LEVEL
Compression strategy level
Select with the enum (/ghibli-rest/v2/resources/enums/CompressionStrategyLevel)
CRON_EXPRESSION
Cron expression
Cron expr wizard
DATE
Date
Input type date
DATETIME
Date time
Input type date-time
DECIMAL
Decimal
Input type numeric
ENUM
List
Input type string
EOL
File End of Line type
Select with the enum (/ghibli-rest/v2/resources/enums/ResourceEol)
EXPRESSION
Expression
Input type text
FILE
File
Input type text
INTEGER
Integer
Input type numeric
LONG
Long
Input type numeric
RESOURCE_PROFILE
Resource profile
SECURITY_CHIPER_ALGO
Security Cipher Algorithm
Select with the enum (/ghibli-rest/v2/resources/enums/SecurityCipherAlgorithm)
SECURITY_OPERATION
Security Operation
Select with the enum (/ghibli-rest/v2/resources/enums/SecurityOperation)
SECURITY_SIGNATURE_HASH_ALGO
Security Signature Hash Algorithm
Select with the enum (/ghibli-rest/v2/resources/enums/SecuritySignatureHashAlgo)
STRING
String
Input type time
TIME
Time
Input type time format hh:mm:ss SSS
TIMEZONE
Time zone
Select with the Timezone List
TRANSFER_PROFILE
Transfer profile
VIRTUAL_PATH
Virtual path
Filter
Every flow template triggered by a "NewFile/IncomingTransfer" event, not timers, has a field in its definition referred to as "Filter" so that the trigger will fire a new instance only if the filter is matched.
If the Filter is empty, a new instance is created regardless of the file.
The syntax used in the expression uses Groovy scripting. It is not necessary to know the entire Groovy language. It is enough to know its operators to build correct expressions that return a "true or false" variable.
=
equal
!=
different
<
less than
<=
less than or equal
>
greater than
>=
greater than or equal
&&
logical "and"
||
logical "or"
!
logical "not"
These operators will work on Objects and their properties.
Here are some examples of real cases:
Trigger Type: NEW FILE
File variable is created when the trigger "New File" starts an instance, it is referred as file and its values come from the filesetEvent and their nature is as follows:
Trigger Type: INCOMING/OUTGOING TRANSFER
File variable is created when the trigger "Incoming transfer" or "Outgoing transfer" starts an instance, it is referred as file and its values come from the transferEvent and their nature is as follows:
Trigger Type: INCOMING UPDATE METADATA
File variable is created when the trigger "Incoming update metadata" starts an instance, it is referred as file and its values come from the filesetMetadataEvent and their nature is as follows:
A couple of examples will follow to better understand how the Filter will behave, according to sample data provided here, with some of the following expressions specified in the Contract:
Expression:
file.registryId==666
Result:
FALSE, no instance will be created
Expression:
file.registryId==11
Result:
TRUE, a new instance will be created
Expression:
file.name=="myFileName.txt" && filesetEvent.clusterName=="clusterFake"
Result:
FALSE, no instance will be created
Expression:
file.name=="myFileName.txt" && filesetEvent.clusterName=="cluster1"
Result:
TRUE, a new instance will be created
Expressions that will return TRUE according to above provided data:
file.name.contains("ileNam") && file.extension == "txt"
file.name.matches("myFileName.txt")
file.name.matches("myFileNam(.*)")
file.name.startsWith("myFil")
Syntax scripting Filter field
- Syntax Boolean matches(String regex) - Meaning Tests whether this string matches the desired regular expression (with regular expression syntax). - Parameters Regex − the expression for comparison.
- Syntax Boolean startsWith(String prefix) - Meaning Tests whether this string starts with the specified prefix. - Parameters Prefix – The prefix to search for
- Syntax Boolean endsWith(String suffix) - Meaning Tests whether this string ends with the specified suffix. - Parameters Suffix – The suffix to search for
- Syntax Boolean isEmpty() - Meaning Tests whether this string has a value. - Parameters NA
Scripting and Script Task
A Script Task is executed by a business process engine. The modeler or implementer defines a script in a language that the engine can interpret. When the Task is ready to start, the engine will execute the script. When the script is completed, the Task will also be completed.
— BPMN 2.0.2 Standard, 10.3.3, Script Task
In Primeur DATA ONE, 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 we leave 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:
The resulting log, once set testMe as an int variable assigned with 2 as value will be:
Last updated