Both the old WindowsWorkflows and the new CodeWorkflows definitions are written into xml configuration files having the “wf_...” prefix.
The configuration files are stored into the GN4 database using the “config” command of the cmd4.exe command-line tool. For example:
cmd4 config –in ..\config\global\wf_ImportDocuments.xml
Let’s compare the structure of the old and new GN4 workflows.
Comparison of WindowsWorkflows and CodeWorkflows
Note: In this example, the names of activities and resources, such as ‘<Activity1>’, ‘<Resource3>’, etc…, are just placeholders to show the workflow structure.
Example of a sequential WindowsWorkflow |
Example of a sequential CodeWorkflow |
<wfres:workFlow xmlns:wfres="http://www.teradp.com/schemas/GN4/1/WFRes.xsd">
<SequentialWorkflow> <Activity1 x:Name="activity1" /> <Activity2 x:Name="activity2" /> <Activity3 x:Name="activity3" /> . . . </SequentialWorkflow>
<Resource1 wfres:activityName="activity1" /> <Resource3 wfres:activityName="activity3" /> . . . </wfres:workFlow> |
<codeWorkflow xmlns="http://www.teradp.com/schemas/GN4/1/WFRes.xsd">
<References> <!-- Add here references to additional assemblies (DLL) --> <!-- <Reference>XXXX</Reference>--> </References>
<Imports> <!-- Add here additional namespaces to import --> <!-- <Import>XXXX</Import> --> </Imports>
<Members> <![CDATA[ ]]> </Members>
<Sequential> <![CDATA[ Dim resource1 As Resource1 = New Resource1 Dim resource3 As Resource3 = New Resource3
Dim activity1Act As Activity1 = New Activity1(Context) activity1Act.Resource1 = resource1 Dim activity1Res As Activity1Result = activity1Act.Do()
Dim activity2Act As Activity2 = New Activity2(Context) Dim activity2Res As Activity2Result = activity2Act.Do()
Dim activity3Act As Activity3 = New Activity3(Context) Activity3Act.Resource3 = resource3 Dim activity3Res As Activity3Result = activity3Act.Do() ]]> </Sequential>
</codeWorkflow> |
<Activity…> tags are the definition of the GN4 sequential activities (like LoadObjects, TransformXml, …). <Resource…> tags are the xml serialized classes (like XmlExportOptions, ObjectUI, SearchConditions, …) needed by the activities to perform their operations. Each resource is associated to the Activity by its wfres:activityName property. |
The sequential GN4 CodeWorkflow is a piece of VB.NET code written into a CDATA section of the xml configuration file. Please notice: •The root of the CodeWorkflow is the tag <codeWorkflow> (not <workflow> anymore). So, to find the released CodeWorkflows into the daily GN4Config.zip, you can looks for the “<codeWorkflow” token into the xml files. •The VB.NET code of the workflow is into the CDATA section of the <Sequential> tag •If a CodeWorkflow contains VB.NET Sub()s or Function()s, they must be written into the CDATA section of the <Members> tag. •The default assemblies used by the CodeWorkflow are: System.dll, System.Core.dll, System.Xml.dll, System.Xml.Linq.dll, Common.dll and Server.dll. |
Note
•If a CodeWorkflow needs to use classes defined into assemblies other than the default ones, then you have to add the <Reference> row into the <References> tag with the name of the required library.
For example, here the <References> of the publishing workflows (they need to use the gnWebSrv class in GnWebClient.dll and other classes that are not defined into the default assemblies):
<References>
<!-- Add here references to additional assemblies (DLL) -->
<Reference>.\GNClient.dll</Reference>
<Reference>.\GnWebClient.dll</Reference>
<Reference>.\Microsoft.Web.Services3.dll</Reference>
<Reference>System.Data.dll</Reference>
<Reference>System.Web.dll</Reference>
<Reference>System.Web.Services.dll</Reference>
</References>
•If a CodeWorkflow needs to extensively use a .NET namespace, you can import it adding the <Import> row into the <Imports> tag (this way, you avoid to write it many times into the code).
For example:
<References>
<!-- Add here references to additional assemblies (DLL) -->
<Reference>GNClient.dll</Reference>
</References>
<Imports>
<!-- Add here additional namespaces to import -->
<Import>TeraDP.GN4.GNClient</Import>
</Imports>