Jump to: navigation, search

Difference between revisions of "HowTo:Create UBIK Workflow Activity Plugin"


(Workflow)
(Workflow)
Line 11: Line 11:
 
<source lang="csharp">
 
<source lang="csharp">
  
 +
using System;
 +
using System.Collections.Generic;
 +
using System.Linq;
 +
using System.Text;
 +
using System.Activities;
 +
using System.ComponentModel;
 +
using System.ComponentModel.Composition;
 +
using UBIK.Kernel;
 +
using UBIK.WorkflowBase;
 +
 +
namespace UBIK.Interface.Module.PluginExamples
 +
{
 +
    /// <summary>
 +
    /// Sends a message to UBIK.Compiler.Debugger
 +
    /// </summary>
 +
    [UBIK.WorkflowBase.Attributes.Category("UBIK Plugins")]
 
     [Export(typeof(UBIK.Injection.IUbikPlugin))]
 
     [Export(typeof(UBIK.Injection.IUbikPlugin))]
     [ExportMetadata("ID", "23B72354-A26F-449E-A7DA-F874B4167248")]
+
     [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
     [ExportMetadata("Type", typeof(myWorkflowActivity))]
+
     [ExportMetadata("Type", typeof(TestActivity))]
     [ExportMetadata("Name", "my WorkflowActivity")]
+
     [ExportMetadata("Name", "TestActivity" )]
     [ExportMetadata("Description", "does fancy things in version 2.4")]
+
     [ExportMetadata("Description", "WF Activity: Sends a message to UBIK.Compiler.Debugger")]
     [ExportMetadata("Version", 3)]
+
     [ExportMetadata("Version", 1)]
    [ExportMetadata("MinimumKernelVersion", "2.4.0.0")]
+
    [ExportMetadata("MinimumDatabaseVersion", "2.4.0.0")]
+
 
     [ExportMetadata("Company", "Augmensys GmbH")]
 
     [ExportMetadata("Company", "Augmensys GmbH")]
     [ExportMetadata("Copyright", "2014, Augmensys GmbH")]
+
     [ExportMetadata("Copyright", "2015, Augmensys GmbH")]
     public class myWorkflowActivity : UBIK.Injection.IUbikPlugin, UBIK.WorkflowBase.IUBIKActivity
+
     public class TestActivity : NativeActivity<string>, UBIK.Injection.IUbikPlugin, UBIK.WorkflowBase.IUBIKActivity
 
     {
 
     {
 +
        public InArgument<BaseClass> UBIKObject { get; set; }
 +
        public InArgument<string> Text { get; set; }
  
 +
        protected override void Execute(NativeActivityContext context)
 +
        {
 +
            BaseClass bc = this.UBIKObject.Get<BaseClass>(context);
 +
 +
            string txt = this.Text.Get<string>(context);
 +
 +
            UBIK.Compiler.Debugger.Output(this, txt);
 +
 +
            this.Result.Set(context, txt);
 +
        }
 
     }
 
     }
 +
}
 +
  
 
</source>
 
</source>

Revision as of 12:45, 2 February 2015

Prerequisite

If you want to add a UBIK Workflow Activity via the UBIK Injection Interface to UBIK your Activity needs to be a UBIK Plugin. See here how to create your own Plugin.

Workflow

Further more your Plugin should implement the Ubik UBIK.WorkflowBase.IUBIKActivity (but there is no technical need to do it). Therefor, you need a reference to UBIK.WorkflowBase.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.ComponentModel;
using System.ComponentModel.Composition;
using UBIK.Kernel;
using UBIK.WorkflowBase;

namespace UBIK.Interface.Module.PluginExamples
{
    /// <summary>
    /// Sends a message to UBIK.Compiler.Debugger
    /// </summary>
    [UBIK.WorkflowBase.Attributes.Category("UBIK Plugins")]
    [Export(typeof(UBIK.Injection.IUbikPlugin))]
    [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
    [ExportMetadata("Type", typeof(TestActivity))]
    [ExportMetadata("Name", "TestActivity" )]
    [ExportMetadata("Description", "WF Activity: Sends a message to UBIK.Compiler.Debugger")]
    [ExportMetadata("Version", 1)]
    [ExportMetadata("Company", "Augmensys GmbH")]
    [ExportMetadata("Copyright", "2015, Augmensys GmbH")]
    public class TestActivity : NativeActivity<string>, UBIK.Injection.IUbikPlugin, UBIK.WorkflowBase.IUBIKActivity
    {
        public InArgument<BaseClass> UBIKObject { get; set; }
        public InArgument<string> Text { get; set; }

        protected override void Execute(NativeActivityContext context)
        {
            BaseClass bc = this.UBIKObject.Get<BaseClass>(context);

            string txt = this.Text.Get<string>(context);

            UBIK.Compiler.Debugger.Output(this, txt);

            this.Result.Set(context, txt);
        }
    }
}
IC Attention.pngThe injection of WF Activities is only supported via the UBIK Installation Injection Folder. Make sure this folder is configured as probing path in the config file*.

* <probing> Element on MSDN