Getting started¶
The workflow designer is a rehosting of the workflow designer that comes built into .NET. It features a canvas on which CodeActivities can be dragged either into sequences or flowcharts which are the two modelling styles supported. Sequential workflows are predictable in direction whereas the flowchart can revert to a previous state in the workflow. Regardless, a workflow always needs to start with a sequence, which can then host a flowchart to contain the rest.
Workflows can be created in Workflow Manager in two ways. They can be created from scratch by selecting Create new workflow. Workflows can also be imported from external JSON file format by selecting Import workflow file. From the designer menu, a new repository can be created or an existing can be opened from the File menu.
Create a new workflow¶
Creating a new workflow will create a new empty workflow that can then by authored. Importing a workflow will import from external workflow JSON file format, with option to select from available workflows in a file.
Import an existing workflow.
Import a workflow¶
Existing Workflow JSON file can be directly imported in the Workflow Manager.
There are 6 workflows specified in this file. If all selected for import, then the 6 workflows will be imported into the Workflow Manager.
Run a workflow¶
Once imported into Workflow Manager, they can be further authored and executed as shown below.
Edit a workflow¶
Once opened, the list in the left hand side will display the workflows as shown in the figure below.
Below the list of workflows are the Code Activities as shown in below
figure. The code activities are grouped according to the assemblies they
sit in. As such, all assemblies with code activities are
called DHI.Workflow.Activities.*.dll
and in below figure the CodeActivities residing
in DHI.Workflow.Activities.Core.dll, DHI.Workflow.Activities.Dfs.dll
and DHI.Workflow.Activities.IronPython.dll
.
These assemblies are loaded using .NET reflection so which means adding
a new assembly with code activities automatically registers it in the designer if the assembly follows the naming convention.
Under the Workflow menu, it is possible to add, remove and save workflows as well as import and export the workflows as XAML. Please note that when doing this the Parameters are not exported.
Once a workflow is selected from the left hand side, then the designer window is populated with workflow as shown below
A sequence can contain sequences or flowcharts, which then in turn can
contain sequences. These can be collapse giving better overview of the
entire structure. Adding a new CodeActivity to the flowchart or sequence
is a matter of dragging it from the list of activities to the location
and wiring it up in the context. Configuring the CodeActivitiy is done
by selecting it, which populates the property grid in the right hand
side with the properties exposed by the CodeActivity. The majority of
all properties takes VB.NET
expressions, which allows doing simple
manipulation of input or output from a code Activity. An example of this
is when an argument is a list of strings. In this case that would
translate into New List(Of String)({"somestring"})
.
The workflow has the concept of global variables as shown in the figure below. For a variable to be used in the workflow, it needs to be defined here. It can then act as both input and output to CodeActivities. When executing the workflow, these variables are identical to the parameters in the task repository and are available to be set from outside e.g. through the Web API when executing the workflow. In that case the default parameter set on the variables in the workflow are overridden by the parameters set from outside.
The designer allows for execution of workflows through the Run menu, which is useful during construction of workflows. A workflow can be executed in two modes either locally which means the designer will execute the workflow in-process, or remotely which means a host executes it. If remote executing a workflow, this is not using the Job Runner and will as such bypass any queuing that may be in place. It will contact the Workflow Service on the host directly. These two modes of execution correspond to Use Case 4 and 5.
Certain CodeActivities have Designers defined, which provides a richer UI for editing properties through drop down boxes, check boxes, and file dialogs. These designers are based on Windows Presentation Foundation (WPF). Below figures show an example of such user interfaces for the Dfs2SpatialRModel and Dfsu2Dfs2 CodeActivitites