Example

Build 1501 on 14/Nov/2017  This topic last edited on: 5/Aug/2014, at 15:34

Let’s look at a complete example in detail. This is a workflow that generates a preview file from a video object in the content store.

<?xml version="1.0" encoding="utf-8"?>

<wfres:workFlow

xmlns:inopt="http://www.teradp.com/schemas/GN4/1/XmlImportOptions.xsd"

xmlns:wfres="http://www.teradp.com/schemas/GN4/1/WFRes.xsd">

 

   <!—It’s a Sequential workflow named ‘mainWorkflow’, with 4 activity

      instances: ObjectsReplicator, LoadData, TransformData, StoreData -->

 <SequentialWorkflow

  x:Name="mainWorkflow"

  xmlns="http://www.teradp.com/schemas/GN4/1/Workflow/Activity"

  xmlns:gn4wf="http://www.teradp.com/schemas/GN4/1/Workflow"

… (more definitions go here)

  xmlns:coll="clr-namespace:System.Collections;assembly=mscorlib">

 

   <!-- Process the video objects one by one

        The ObjectsReplicator activity receives the list of (video) object

        ids from the root element - SequentialWorkflow-->

<ObjectsReplicator

    x:Name="replicatorActivity"

    ObjectIds="{wf:ActivityBind mainWorkflow, ObjectIds}">

     <!-- Load the original video file from the database or the file system.

          Note that LoadData activity is used in the same way regardless of

          where the data is stored.

          LoadData needs the id of the objects and the name of the content

          attribute. Here it gets ObjectIds to load from ObjectsReplicator

          and the AttributeName is set to ‘Data’. -->

     <LoadData

      x:Name="loadVideoActivity"

      ObjectIds="{wf:ActivityBind replicatorActivity, ObjectIdsOut}"

      AttributeName="data">

 

       <!-- Create the flash video preview of the video. The data to be

            transformed is passed in the DataOut property of the LoadData

            activity. The converted data is available in the DataOut

            property of the TransformData activity.-->

       <TransformData

        x:Name="videoConvertActivity"

        Data="{wf:ActivityBind loadVideoActivity, Path=DataOut}">

         <TransformData.Steps>

           … (steps omitted because it’s not important for this example)

         </TransformData.Steps>

       <!-- Save the flash video preview in the data store. StoreData needs the

            ids of the objects to store, the name of the content attribute, and

            the data itself. Here the ObjectIds are passed from the ObjectIdsOut

            property of the ObjectsReplicator activity, and the video object

            AttributeName is hard coded to ‘videoPreview’. The binary data is read

            from the DataOut property of the TransformData activity.-->

         <StoreData

            x:Name="saveVideoPreviewActivity"

            AttributeName="videoPreview"

            ObjectIds="{wf:ActivityBind replicatorActivity, Path=ObjectIdsOut}"

            Data="{wf:ActivityBind videoConvertActivity, Path=DataOut}" />

 

       </TransformData>

     </LoadData >

   </ObjectsReplicator >

 </SequentialWorkflow>

</wfres:workFlow>