Creating Processware Task Forms
A Processware Task Form is an implementation of the base class TaskForm
, located in the namespace FlowCentric.Engine.Managed within the Activity Server assembly FlowCentric.Engine.Contracts.dll
. The creation of this implementation is automated using the Processware Visual Studio Extension and by following these steps:
Add a new Processware Task Form
to the project created previously:
There are many ways to populate this file, the simplest of which is to specify the id of the designed Processware activity to be implemented with a name for the type and let the tool generate the initial content.
{ "id": "230", "name": "ActivityForm" }
The id is available on the Properties Window in the Process Suite for said activity:
The Custom Tool is activated when the file is saved (or via the Run Custom Tool context menu), resulting in the generation of two language-specific files with the same name as the .taskForm
-based JSON file.
The initial content for the .taskForm
-based file is generated as comments in the .Generated.cs
file within a code region named Source Definition
. In the case of VB.NET, the .Generated.vb
file includes the commented source definition near the end of the class. Copy the entire JSON structure to the .taskForm
file, and amend as appropriate.
The .taskForm
file captures the definition of a Processware activity in such a way that the associated Custom Tool can generate a representation thereof to simplify the development of the logic backing the associated activity. This Custom Tool is also responsible for generating a default implementation of the members inherited from the Managed Code base type, TaskForm
. The simplified representation is output to the .Generated.cs
or .Generated.vb
code file, while the default implementation is output to the C#.NET or VB.NET file with the same name as the .taskForm
file. The Custom Tool referred to is called the TaskFormCodeGenerator
and is installed with the Managed Code Visual Studio Extension. A .taskForm
file is a JSON file that typically looks like this:
{
"fields": [
{
"modifier": 1,
"index": 10,
"id": 1,
"moniker": "MC10_Control1",
"name": "Control1"
}, // ...
{
"modifier": 1,
"index": 900,
"id": 90,
"moniker": "MC10_ControlX",
"name": "ControlX"
}],
"groups": [
{
"fields": [
{
"modifier": 6,
"index": 1000,
"id": 100,
"moniker": "MC1010_Control1",
"name": "Control1"
}, // ...
{
"modifier": 6,
"index": 1500,
"id": 150,
"moniker": "MC1010_ControlY1",
"name": "ControlY1"
}],
"id": 1,
"moniker": "MC10_ObjectGroup1",
"name": "Group1"
}, // ...
{
"fields": [
{
"modifier": 6,
"index": 10000,
"id": 1000,
"moniker": "MC10ZZ_Control1",
"name": "Control1"
},
// ...
{
"modifier": 6,
"index": 10500,
"id": 1150,
"moniker": "MC10ZZ_ControlYZ",
"name": "ControlYZ"
}
],
"id": 1,
"moniker": "MC10_ObjectGroupZ",
"name": "GroupZ"
}],
"id": 230,
"moniker": "MC10_Activity",
"name": "ActivityForm"
}
The structure is indicative of a task that contains 0 or more (un-grouped) fields, and 0 or more groups containing 0 or more grouped fields. All the elements in the structure, task, group, and field, has an id and moniker referencing the designed activity, object group, and object, respectively. These elements also include a name property that can (and probably should) be changed for the associated members generated for these elements. The name of the task element is used for the type implementing the Processware TaskForm
, the name of the group element is used for the type implementing the internal Processware ColumnsGroup
type, and the name of the field results in the name of the appropriately typed Processware ColumnControl
or Control
property of either the ColumnsGroup
or the TaskForm
implementation based on whether the field is grouped or not, respectively. The field element further includes an index property used for ordering the generated properties and reflects that of the designed object. Finally, the modifier on the field directs the TaskFormCodeGenerator
to the access to apply to the generated properties:
Value | C#.NET Access Modifier(s) | VB.NET Access Level(s) |
---|---|---|
0 | Excluded from generated code | Excluded from generated code |
1 | private | Private |
3 | protected override | Protected Overrides |
6 | internal | Friend |
7 | internal override | Friend Overrides |
9 | protected internal override | Protected Friend Overrides |
10 | public | Public |
11 | public override | Public Overrides |
Tip
The generated TaskForm
do not specify access modifiers/levels allowing a developer to specify it explicitly. The generated ColumnsGroup
implementations will always be private
.
The element names will also be output as class constants in a hierarchy that reflects that of the structure of the .taskForm
file, with un-grouped fields contained in a type named Fields
, groups contained as inner types in a type named Groups
together with their respective grouped fields. These constants are then used to expose the controls and groups to the rest of the task form, and is contained in the .Generated.cs
or .Generated.vb
code file.
Every time the TaskFormCodeGenerator
Custom Tool is run on a .taskForm
file (by saving it, or the context menu), the .Generated.cs
or .Generated.vb
file is re-generated. This allows these files to reflect the current state of the activity, object groups, and objects associated with it. This also implies that any changes made to these files will be lost every time this tool runs. It is also important to update the content of the .taskForm
with the structure generated in comments in the .Generated.cs
or .Generated.vb
file. Any changes made to the modifiers and names should reflect in this generated section; there will therefore be no need to reconfigure the contents copied to the .taskForm
, unless new fields and groups are introduced.
The implementation file, a .cs
or .vb
file with the same name as the associated .taskForm
file, will only be generated if it does not exist. This allows changes made to it to persist even when the .taskForm
file is modified. For more information on the generated members, please refer to the Managed Code sections of the activity and object group, and refer to objects for more information on coding against these.