How to Build Your First PAK Workflow
After finishing this tutorial you will be able to create your first simple workflow using the PAK Editor.
To complete this guide you need:
Roughly 20 minutes
The PAK Bpmn Editor ( Download )
When starting the PAK Editor for the first time, you will see two buttons on the left-hand side of the window.
New BPMN(1): Use this button to create a new empty Workflow
Open BPMN(2): Use this button to open an existing Workflow from your local filesystem.
Let’s create a new Workflow by clicking on (1). After creating a new BPMN, the Editor loads all possible commands, control elements and a graphical representation of the workflow.
The Editor is divided in three sections:
Control Elements and Custom Commands Palette: All imported commands, as well as the workflow control elements are available in this section. The specific type and amount of the commands may vary depending on which repositories you have added and enabled under Preferences → Commands.
Graphical representation of the workflow: In this section you are able to create your workflow by dragging and dropping commands and control elements here.
Analysing Tabs: Here, you are able to analyse your Workflow, edit the Datastore and analyse the usage of the different variable keys in the Workflow.
For our first Workflow, we simply want to open a text file on our local filesystem.
After creating a new workflow, only the „Start“ node (2) will exist. This is our entry point for the Workflow.
In order to extent the workflow, click on the start node and select the Command you want to append on the left-hand side. On the Commands palette (1) we can see different command groups. By clicking on the Generic group, we can see different commands and subgroups. We need some Command which is able to open a text file. Let’s have a look under File, which contains commands for generic file operations. The Command „Open Text File“ (2) is exactly what we need. While hovering over this command we see a preview (3) of where the Command will be added in the Workflow. The new command will have a direct connection to the element we marked before. We can also have a look at the explanation of the command containing its possible input and output variables (4).
Finally click on the command name, which will add the Command to the BPMN.
|If you don’t see the preview while hovering over the command name, or the command is not directly connected to the entry point, you might have to re-select the „Start“ node.|
After the Command is added to the Workflow, we can configure the Command by clicking on it. On the right-hand side of the window the Properties of the Command are shown. We now have the opportunity to give the Command a custom name (1), select a specific version (2) and define its input and output parameters.
|When no specific version is chosen, the Editor will assume the newest version of the Command.|
Now, we can add the path to a file we want to open. In the command description in Command Preview we have already seen the possible variables of the command. The Command just has one input variable, which needs a path to a file. By clicking on the „+“ button (3) next to the Constants & Mapping header, we can add this key for the path.
We can now decide which key we want to configure in the corresponding dropdown (4). In our case the
pathToFile key should be the only option. After choosing the desired key, we have to choose the mapping type for this parameter.
Constant Mapping (5): Provides a hard-coded value for the key in question
Key/Datastore Mapping (6): Provides a key to look up in the datastore.
For our scenario we can use the constant mapping and provided the path as a constant String value (7).
|For more details, refer to the Basic Mapping Guide.|
After setting up the necessary Commands, we can see an error on the Dataflow Analysis Tab. The Dataflow Analysis calculates all connections between the commands and control elements. It secures that all keys are mapped correctly and that all paths through the workflow have a start and end.
In order to fix this error, we just need to add an end event in our Workflow.
Select End Event (2) in the workflow control elements section and add the circle anywhere to the Workflow. After adding the event, we need to connect the end event with our Open-File-Command using an Edge (1). You can find the edge in the workflow control elements section as well.
After all elements are connected properly, a check mark (3) appears in the Dataflow Analysis Tab.
|The Dataflow Analysis should be run automatically by default. It is also possible to deactivate the automatic analysis task on Workflow→Analyse Automatically and analyse the workflow on demand.|
After adding our end node to the workflow, we are ready to save it. The „*“ symbol on the top of the PAK Editor indicates that the workflow is not saved currently.
Click on File → Save and select a directory to save your Workflow as a .bpmn file.
|In order to execute the Workflow, you need a runner application.|