Handling Process Variable
During the modeling process it will happen to have the necessity of checking a variable value, RC variables is the sharpest example, or to access variable values when a variable is not a plain String but a "Complex" type with methods (i.e. FileDetail variable type when triggering an instance with NewFile trigger).
Process variables are persisted entities that will live inside any process instance identified by a name and a value.
Whenever a process instance starts, required variable requested in contract creation come to life being assigned with their value, all the variables declared in any single service task, will come to life during the execution, when it will hit that very service task and it will be executed without errors.
The way to get a variable value is to surround it with ${variableName}
, if it is a plain variable, if it is a complex object like one, described here: Process Variable Objects. It will contain multiple values that can be accessed by the relative getter method: i.e. ${file.getRegistryId()}
.
If we need to check a variable value, in the case of an exclusive gateway, the condition has to be inside the parenthesis; ${variableValue == 0}
or ${file.getRegistryId() == 12}
.
Process Variable Objects
These are variables of type "Object" that can be found inside a process instance.
The user modeling a process won't be able to access a variable value just by its name, that is what happens with non-object variables:
i.e. ${myCustomVariable}
but since those are actually objects, there are methods providing access to the object's internal desired value:
i.e. ${myCustomVariable.getVariableValue()}
FileDetail
FileDetails is a Java Object returned from New File Event and available as predefined variable --> file.
Parameter | Type | Function to retrieve the result | Description |
---|---|---|---|
registryId | Long | getRegistryId() | The Id Fileset inserted in the Databox (ex: ${file.getRegistryId()}) |
clusterName | String | getClusterName() | The Cluster name where the file has been received (ex: ${file.getClusterName()}) |
virtualPath | String | getVirtualPath() | The Databox (Virtual Path) where the file has been inserted. The format is vfsName:vfsPath (ex: ${file.getVirtualPath()}) Sample value: epoLAB-vfs-unsigned:/eMail_attachment |
name | String | getName() | The Original File Name (ex: ${file.getName()}) |
virtualFolder | String | getVirtualFolder() | The Databox Folder where the file has been inserted. The format is vfsPath (ex: ${file.getVirtualPath()}) Sample value: /eMail_attachment |
virtualFs | String | getVirtualFS() | The Databox FileSystem name where the file has been inserted. The format is vfsName (ex: ${file.getVirtualFS()}) Sample value: epoLAB-vfs-unsigned |
extension | String | getExtension() | File extension |
nameNoExtension | String | getNameNoExtension() | File name without extension |
absoluteFileName | String | getAbsoluteFileName() | The absolute file name of the file (ex: ${file.getAbsoluteFileName()}) |
metadata | String | getMetadataValue(String key) | Get a file metadata value by key |
metadata | List <String> | getMetadatakeys() | Get file metadata values (list of values) NOTE: available only when the ${file} variable is created by an Incoming Update Metadata Event. |
ExternalFile
ExternalFile is a Java Object returned by service tasks of types: Spls, DataboxSpls, RemoteSpls, VirtualBox LS. Each brick returns a variable --> fileList
that is a List
. In the following examples we assume that the current element of the list is refernced as --> currentFile
.
Parameter | Type | Function to retrieve the result | Description |
---|---|---|---|
fileId | Long | getFileId() | The Id Fileset inserted in the Databox (ex: ${currentFile.getFileId()}). This is available only from DataboxSpls that lists files in a Databox, otherwise is NULL |
size | Long | getSize() | The size file attribute provided by the subsystem that created this entry |
dateModified | Date | getDatemodified() | The date of the last file modification |
directory | Boolean | getDirectory() | If true the file is a Directory (ex: ${currentFile.getDirectory()}) |
filePath | String | getFilePath() | The full path of the file (ex: ${currentFile .getFilePath()}) |
fileName | String | getFileName() | File Name (ex: ${currentFile.getFileName()}) |
fileNameNoExtension | String | getFileNameNoExtension() | File Name only without extension (ex: ${currentFile.getFileNameNoExtension()}) |
size | Long | getSize() | The size of the file (ex: ${currentFile.getFileSize()}) |
Properties
Properties is a Java Object returned from Command Server bricks: Spprop. The return variable is --> property and is a Map<String, String> read from a property file.
Parameter | Type | Function to retrieve the result | Description |
---|---|---|---|
value | String | getProperty(key) | Get the value of the property with Key=key (ex: ${property.getProperty("MyKey")}) |
GBIFlowInput
GBIFlowInput is a Java Object that contains all parameters required to start a new GBI Process.
Parameter | Type | Function to retrieve the result | Description |
---|---|---|---|
flowId | String | getFlowId() | The GBI Flow Identifier |
parameters | Map<String, String> | getParameters() | Map of all Input Parameters required by GBI Flow |
correlationId | String | getCorrelationId() | System generated correlationId to be used as input in Camunda object that waits for GBI Flow termination |
GBIFlowOutput
GBIFlowOutput is a Java Object that contains all parameters returned from GBI Process.
Parameter | Type | Function to retrieve the result | Description |
---|---|---|---|
outcome | String | getOutcome() | The GBI Flow return code |
parameters | Map<String, String> | getParameters() | Map of all Output Parameters returned by GBI Flow |
correlationId | String | getCorrelationId() | System generated correlationId used for process correlation |
Updated 8 months ago