public void VisitDebugConfig() { //Init args DebugConfig debugConfig = new DebugConfig() { IfStart = true }; //Expectations List <string> expectedArgs = new List <string>() { "s3://elasticmapreduce/libs/state-pusher/0.1/fetch" }; //Init visitor BuildRequestVisitor visitor = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings()); VisitorSubscriber visitorSubscriber = new VisitorSubscriber(visitor); //Action debugConfig.Accept(visitor); //Verify Assert.AreEqual(1, visitorSubscriber.TotalObjCount, "Unexpected number of objects created"); StepConfig actual = visitorSubscriber.stepList[0]; Assert.AreEqual("Start debugging", actual.Name, "Unexpected Name"); Assert.AreEqual(ActionOnFailure.CONTINUE, actual.ActionOnFailure, "Unexpected ActionOnFailure"); Assert.AreEqual("s3://elasticmapreduce/libs/script-runner/script-runner.jar", actual.HadoopJarStep.Jar, "Unexpected Jar"); Assert.IsNull(actual.HadoopJarStep.MainClass, "Unexpected MainClass"); Assert.IsTrue(expectedArgs.SequenceEqual(actual.HadoopJarStep.Args), "Unexpected args list"); }
private void CreateStepConfig(String name, String jarPath, String mainClass, ActionOnFailure actionOnFailure, List <String> args) { if (String.IsNullOrEmpty(name)) { throw new InvalidOperationException(Resources.E_StepNameIsMissing); } if (String.IsNullOrEmpty(jarPath)) { throw new InvalidOperationException(Resources.E_StepJarPathIsMissing); } HadoopJarStepConfig hadoopJarStep = new HadoopJarStepConfig(); hadoopJarStep.Jar = this.settings.FillPlaceHolders(jarPath); hadoopJarStep.MainClass = this.settings.FillPlaceHolders(mainClass); hadoopJarStep.Args = this.FillPlaceHolders(args); StepConfig result = new StepConfig(); result.Name = this.settings.FillPlaceHolders(name); result.ActionOnFailure = actionOnFailure; result.HadoopJarStep = hadoopJarStep; if (this.OnStepConfigCreated != null) { this.OnStepConfigCreated(this, result); } }
public void VisitHBaseBackupStep() { //Init args HBaseBackupStep hBaseBackupStep = new HBaseBackupStep(); hBaseBackupStep.HBaseJarPath = "{hbaseJar}"; hBaseBackupStep.BackupPath = "{myBucket}/hbase/backUp"; //Expectations List <string> expectedArgs = new List <string>() { "--backup", "--backup-dir", "s3://myBucket/hbase/backUp" }; //Init settings BuilderSettings settings = BuildRequestVisitorTest.GetSettings(); //Init visitor BuildRequestVisitor visitor = new BuildRequestVisitor(settings); VisitorSubscriber visitorSubscriber = new VisitorSubscriber(visitor); //Action hBaseBackupStep.Accept(visitor); //Verify Assert.AreEqual(1, visitorSubscriber.TotalObjCount, "Unexpected number of objects created"); StepConfig actual = visitorSubscriber.stepList[0]; Assert.AreEqual("Backup HBase", actual.Name, "Unexpected Name"); Assert.AreEqual(ActionOnFailure.TERMINATE_JOB_FLOW, actual.ActionOnFailure, "Unexpected ActionOnFailure"); Assert.AreEqual("/home/hadoop/lib/2.2.0/hbase-0.94.7.jar", actual.HadoopJarStep.Jar, "Unexpected Jar"); Assert.AreEqual("emr.hbase.backup.Main", actual.HadoopJarStep.MainClass, "Unexpected MainClass"); Assert.IsTrue(expectedArgs.SequenceEqual(actual.HadoopJarStep.Args), "Unexpected args list"); }
public void VisitHBaseConfig() { //Init args HBaseConfig hBaseConfig = new HBaseConfig() { IfStart = true }; hBaseConfig.JarPath = "/home/hadoop/lib/hbase-0.94.7.jar"; hBaseConfig.Args = new List <string>() { "-s", "somearg{arg1}", "-s", "{arg2}" }; //Expectations List <string> expectedConfigArgs = new List <string>() { "-s", "somearg1234", "-s", "6789" }; List <string> expectedStartArgs = new List <string>() { "--start-master" }; //Init settings BuilderSettings settings = BuildRequestVisitorTest.GetSettings(); //Init visitor BuildRequestVisitor visitor = new BuildRequestVisitor(settings); VisitorSubscriber visitorSubscriber = new VisitorSubscriber(visitor); //Action hBaseConfig.Accept(visitor); //Verify Assert.AreEqual(3, visitorSubscriber.TotalObjCount, "Unexpected number of objects created"); // BootstrapAction 1: Install HBase BootstrapActionConfig actualBootstrapAction = visitorSubscriber.bootstrapActionList[0]; Assert.AreEqual("Install HBase", actualBootstrapAction.Name, "Unexpected Name"); Assert.AreEqual("s3://elasticmapreduce/bootstrap-actions/setup-hbase", actualBootstrapAction.ScriptBootstrapAction.Path, "Unexpected ScriptBootstrapAction.Path"); Assert.IsNull(actualBootstrapAction.ScriptBootstrapAction.Args, "Unexpected args list"); // BootstrapAction 2: Configure HBase actualBootstrapAction = visitorSubscriber.bootstrapActionList[1]; Assert.AreEqual("Configure HBase", actualBootstrapAction.Name, "Unexpected Name"); Assert.AreEqual("s3://elasticmapreduce/bootstrap-actions/configure-hbase", actualBootstrapAction.ScriptBootstrapAction.Path, "Unexpected ScriptBootstrapAction.Path"); Assert.IsTrue(expectedConfigArgs.SequenceEqual(actualBootstrapAction.ScriptBootstrapAction.Args), "Unexpected args list"); //Step : Start HBase StepConfig actualStep = visitorSubscriber.stepList[0]; Assert.AreEqual("Start HBase", actualStep.Name, "Unexpected Name"); Assert.AreEqual(ActionOnFailure.TERMINATE_JOB_FLOW, actualStep.ActionOnFailure, "Unexpected ActionOnFailure"); Assert.AreEqual("/home/hadoop/lib/hbase-0.94.7.jar", actualStep.HadoopJarStep.Jar, "Unexpected Jar"); Assert.AreEqual("emr.hbase.backup.Main", actualStep.HadoopJarStep.MainClass, "Unexpected MainClass"); Assert.IsTrue(expectedStartArgs.SequenceEqual(actualStep.HadoopJarStep.Args), "Unexpected args list"); }
public override bool Execute(Workflow workflow) { string nextStepName = workflow.WorkflowRow.WI_CUSTOM_DATA.ToString(); //workflow.WorkflowRow["WI_CUSTOM_DATA"] = DBNull.Value; StepConfig config = workflow.Config.Steps[nextStepName]; return(SendStep(workflow, config)); }
internal void configureGetters(StepConfig step, StepRuntime newStep) { foreach (var getter in step.Getters) { switch (getter) { case TextGetterConfig config: newStep.Getters.Add(new TextGetterRuntime(config)); break; } } }
internal void configureExpectations(StepConfig step, StepRuntime newStep) { foreach (var exp in step.Expectations) { switch (exp) { case ElementTextExpectConfig config: newStep.Expectations.Add(new ElementTextExpectRuntime(config)); break; case PageUrlExpectConfig config: newStep.Expectations.Add(new PageUrlExpectRuntime(config)); break; case VisiblityExpectConfig config: newStep.Expectations.Add(new VisiblityExpectRuntime(config)); break; } } }
protected PluginStepConfig RegisterPluginStep <T>(EventOperation eventOperation, ExecutionStage executionStage, Action <LocalPluginContext> action) where T : Entity { var e = Activator.CreateInstance <T>(); //TypedPluginStepConfig stepConfig = new TypedPluginStepConfig(eventOperation, executionStage, (e as Entity).LogicalName); var config = new StepConfig((e as Entity).LogicalName, (int)executionStage, Enum.GetName(typeof(EventOperation), eventOperation), (e as Entity).LogicalName); var extended = new ExtendedStepConfig((int)Deployment.ServerOnly, (int)ExecutionMode.Synchronous, (e as Entity).LogicalName, 1, "", null); var pluginStepConfig = new PluginStepConfig(config, extended, new List <ImageConfig>()); this.PluginStepConfigs.Add(pluginStepConfig); this.RegisteredEvents.Add( new Tuple <int, string, string, Action <LocalPluginContext> >( config.ExecutionStage, config.EventOperation, config.LogicalName, new Action <LocalPluginContext>(action))); return(pluginStepConfig); }
public void VisitJarStep() { //Init args JarStep jarStep = new JarStep(); jarStep.Name = "step-for-Hadoop-Version:{hadoopVersion}"; jarStep.MainClass = "com.supperslonic.{hadoopVersion}.Driver"; jarStep.JarPath = "{myBucket}/my.jar"; jarStep.ActionOnFailure = ActionOnFailure.TERMINATE_CLUSTER; jarStep.Args = new List <string> { "{arg1}", "900" }; //Expectations List <string> expectedArgs = new List <string>() { "1234", "900" }; //Init visitor BuildRequestVisitor visitor = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings()); VisitorSubscriber visitorSubscriber = new VisitorSubscriber(visitor); //Action jarStep.Accept(visitor); //Verify Assert.AreEqual(1, visitorSubscriber.TotalObjCount, "Unexpected number of objects created"); StepConfig actual = visitorSubscriber.stepList[0]; Assert.AreEqual("step-for-Hadoop-Version:2.2.0", actual.Name, "Unexpected Name"); Assert.AreEqual(ActionOnFailure.TERMINATE_CLUSTER, actual.ActionOnFailure, "Unexpected ActionOnFailure"); Assert.AreEqual("s3://myBucket/my.jar", actual.HadoopJarStep.Jar, "Unexpected Jar"); Assert.AreEqual("com.supperslonic.2.2.0.Driver", actual.HadoopJarStep.MainClass, "Unexpected MainClass"); Assert.IsTrue(expectedArgs.SequenceEqual(actual.HadoopJarStep.Args), "Unexpected args list"); }
internal void configureActions(StepConfig step, StepRuntime newStep) { foreach (var act in step.Actions) { switch (act) { case ClickActionConfig config: newStep.Actions.Add(new ClickActionRuntime(config)); break; case EnterTextActionConfig config: newStep.Actions.Add(new EnterTextActionRuntime(config)); break; case FormSubmitActionConfig config: newStep.Actions.Add(new FormSubmitActionRuntime(config)); break; case LogMessageActionConfig config: newStep.Actions.Add(new LogMessageActionRuntime(config)); break; case SpecialKeyActionConfig config: newStep.Actions.Add(new SpecialKeyActionRuntime(config)); break; case WaitForVisibilityActionConfig config: newStep.Actions.Add(new WaitForVisibilityActionRuntime(config)); break; case MultipleTextActionConfig config: newStep.Actions.Add(new MultipleTextActionRuntime(config)); break; } } }
public Root WorkflowConfig2Root(WorkflowConfig workflowConfig) { Root root = new Root(); root.ID = workflowConfig.Id; root.Description = workflowConfig.Description; root.DisplayName = workflowConfig.DisplayName; root.IsSave = workflowConfig.IsSaveContent.ToString(); root.Name = workflowConfig.Name; root.Priority = ((int)workflowConfig.Priority).ToString(); root.ContentChoice = ((int)workflowConfig.ContentChoice).ToString(); root.ManualPageXml = workflowConfig.ContentXml ?? ""; if (workflowConfig.ControlActions != null) { root.ControllActions = new List <ControllAction>(); ControllAction controllAction; foreach (ControlActionConfig caConfig in workflowConfig.ControlActions) { controllAction = new ControllAction(); controllAction.ActionName = caConfig.ActionName; controllAction.AreaName = caConfig.AreaName; controllAction.ControllName = caConfig.ControlName; controllAction.Order = caConfig.Order; controllAction.Title = caConfig.Title == null ? "" : caConfig.Title; controllAction.ShowKind = (int)caConfig.ShowKind; root.ControllActions.Add(controllAction); } } root.Nodes = new List <Node>(); root.LineList = new List <Line>(); Node node; for (int i = 0; i < workflowConfig.Steps.Count; i++) { node = new Node(); Line line = new Line(); StepConfig stepConfig = workflowConfig.Steps[i]; BeginStepConfig beginStep = workflowConfig.Steps[i] as BeginStepConfig; EndStepConfig endStep = workflowConfig.Steps[i] as EndStepConfig; AutoStepConfig autoStep = workflowConfig.Steps[i] as AutoStepConfig; ManualStepConfig manualStep = workflowConfig.Steps[i] as ManualStepConfig; RouteStepConfig routeStep = workflowConfig.Steps[i] as RouteStepConfig; node.ObjectIndex = new BaseIntElement { Type = "number", Value = 0 }; node.TypeIndex = new BaseIntElement { Type = "number", Value = 0 }; stepConfig.Id = string.IsNullOrEmpty(stepConfig.Id) ? context.GetUniId() : stepConfig.Id; node.ID = new BaseStringElement { Type = "string", Value = stepConfig.Id }; node.Text = new BaseStringElement { Type = "string", Value = stepConfig.DisplayName }; node.Name = new BaseStringElement { Type = "string", Value = stepConfig.Name }; node.Height = new BaseIntElement { Type = "number", Value = stepConfig.Height == 0 ? 51 : stepConfig.Height }; node.Width = new BaseIntElement { Type = "number", Value = stepConfig.Width == 0 ? 130 : stepConfig.Width }; node.X = new BaseIntElement { Type = "number", Value = stepConfig.Left }; node.Y = new BaseIntElement { Type = "number", Value = stepConfig.Top }; node.ParentList = new List <Parent>(); node.ChildList = new List <Child>(); if (stepConfig.HasInStep) { Parent parent; ////输入节点数量 0:无输入 1:1输入 2:多输入 //switch (stepConfig.PrevSteps.Count()) //{ // case 0: // node.InputType = new BaseIntElement { Type = "number", Value = 0 }; // break; // case 1: // node.InputType = new BaseIntElement { Type = "number", Value = 1 }; // break; // default: // node.InputType = new BaseIntElement { Type = "number", Value = 2 }; // break; //} foreach (StepConfig sc in stepConfig.PrevSteps) { sc.Id = string.IsNullOrEmpty(sc.Id) ? context.GetUniId() : sc.Id; parent = new Parent(); parent.Value = sc.Id; node.ParentList.Add(parent); } } if (stepConfig.HasOutStep) { Child child; //switch (stepConfig.NextStepCount) //{ // case 0: // node.OutputType = new BaseIntElement { Type = "number", Value = 0 }; // break; // case 1: // node.OutputType = new BaseIntElement { Type = "number", Value = 1 }; // break; // default: // node.OutputType = new BaseIntElement { Type = "number", Value = 2 }; // break; //} foreach (StepConfig sc in stepConfig.NextSteps) { sc.Id = string.IsNullOrEmpty(sc.Id) ? context.GetUniId() : sc.Id; child = new Child(); child.Value = sc.Id; node.ChildList.Add(child); line = new Line(); line.ID = stepConfig.Id + "_" + sc.Id; if (routeStep != null) { for (int k = 0; k < routeStep.Connections.Count; k++) { if (routeStep.Connections[k].NextStepName == sc.Name) { line.Name = routeStep.Connections[k].Name; line.PlugName = routeStep.Connections[k].PlugName; line.Text = routeStep.Connections[k].DisplayName; break; } } } root.LineList.Add(line); } } if (beginStep != null) { node.Icon = new BaseStringElement { Type = "string", Value = "nodeicon1" }; node.NodeType = new BaseIntElement { Type = "number", Value = (int)NodeType.Begin }; node.CreatorRegName = new BaseStringElement { Type = "string", Value = beginStep.CreatorRegName }; node.InputType = new BaseIntElement { Type = "number", Value = 0 }; node.OutputType = new BaseIntElement { Type = "number", Value = 1 }; } else if (endStep != null) { node.Icon = new BaseStringElement { Type = "string", Value = "nodeicon2" }; node.NodeType = new BaseIntElement { Type = "number", Value = (int)NodeType.End }; node.PlugRegName = new BaseStringElement { Type = "string", Value = endStep.PlugRegName }; node.InputType = new BaseIntElement { Type = "number", Value = 2 }; node.OutputType = new BaseIntElement { Type = "number", Value = 0 }; } else if (routeStep != null) { node.Icon = new BaseStringElement { Type = "string", Value = "nodeicon3" }; node.NodeType = new BaseIntElement { Type = "number", Value = (int)NodeType.Route }; node.InputType = new BaseIntElement { Type = "number", Value = 2 }; node.OutputType = new BaseIntElement { Type = "number", Value = 2 }; } else if (autoStep != null) { node.Icon = new BaseStringElement { Type = "string", Value = "nodeicon-auto" }; node.NodeType = new BaseIntElement { Type = "number", Value = (int)NodeType.Auto }; node.PlugRegName = new BaseStringElement { Type = "string", Value = autoStep.PlugRegName }; node.InputType = new BaseIntElement { Type = "number", Value = 2 }; node.OutputType = new BaseIntElement { Type = "number", Value = 1 }; } else if (manualStep != null) { node.Icon = new BaseStringElement { Type = "string", Value = "nodeicon5" }; node.NodeType = new BaseIntElement { Type = "number", Value = (int)NodeType.Manual }; node.ActorRegName = new BaseStringElement { Type = "string", Value = manualStep.ActorRegName }; node.InputType = new BaseIntElement { Type = "number", Value = 2 }; node.OutputType = new BaseIntElement { Type = "number", Value = 1 }; node.ManualPageXml = new BaseStringElement { Type = "string", Value = manualStep.ContentXml }; node.ContentChoice = new BaseIntElement { Type = "number", Value = (int)manualStep.ContentChoice }; if (manualStep.ControlActions != null) { node.ControllActions = new List <ControllAction>(); ControllAction controllAction; foreach (ControlActionConfig caConfig in manualStep.ControlActions) { controllAction = new ControllAction(); controllAction.ActionName = caConfig.ActionName; controllAction.AreaName = caConfig.AreaName; controllAction.ControllName = caConfig.ControlName; controllAction.Order = caConfig.Order; controllAction.Title = caConfig.Title == null ? "" : caConfig.Title; controllAction.ShowKind = (int)caConfig.ShowKind; node.ControllActions.Add(controllAction); } } if (manualStep.Process != null) { node.Process = new Process(); node.Process.UIOperationConfig = new WorkFlowDesigner.Models.UIOperationConfig(); if (manualStep.Process.UIOperation != null) { node.Process.UIOperationConfig.ButtonCaption = manualStep.Process.UIOperation.ButtonCaption; node.Process.UIOperationConfig.DisplayName = manualStep.Process.UIOperation.DisplayName; node.Process.UIOperationConfig.Name = manualStep.Process.UIOperation.Name; node.Process.UIOperationConfig.Plugin = manualStep.Process.UIOperation.PlugIn; } node.Process.NonUIOperationConfigs = new List <WorkFlowDesigner.Models.NonUIOperationConfig>(); WorkFlowDesigner.Models.NonUIOperationConfig nonUiConfig; if (manualStep.Process.NonUIOperations != null) { foreach (var nonUi in manualStep.Process.NonUIOperations) { nonUiConfig = new WorkFlowDesigner.Models.NonUIOperationConfig(); nonUiConfig.ButtonCaption = nonUi.ButtonCaption; nonUiConfig.DisplayName = nonUi.DisplayName; nonUiConfig.Name = nonUi.Name; nonUiConfig.NeedPrompt = nonUi.NeedPrompt.ToString(); nonUiConfig.Plugin = nonUi.PlugIn; node.Process.NonUIOperationConfigs.Add(nonUiConfig); } } } } root.Nodes.Add(node); } return(root); }
public void CreateLineNode(WorkflowConfig wfConfig, Root rt, Line line) { string lineId = line.ID; StepConfig fromStep = null; StepConfig toStep = null; int index; string nodeId; #region 循环查找 for (int i = 0; i < rt.Nodes.Count; i++) { nodeId = rt.Nodes[i].ID.Value; index = lineId.IndexOf(nodeId); if (index != -1) { if (steps.Keys.Contains(nodeId)) { if (index == 0) { fromStep = steps[nodeId]; RouteStepConfig routeStepConfig = fromStep as RouteStepConfig; if (routeStepConfig != null) { ConnectionConfig connectionConfig = new ConnectionConfig(); connectionConfig.DisplayName = line.Text; connectionConfig.PlugName = line.PlugName; connectionConfig.Name = line.Name; routeStepConfig.Connections.Add(connectionConfig); } } else { toStep = steps[nodeId]; } } else { StepConfig stepConfig = null; #region 将nodes转化为workflowconfig switch ((NodeType)rt.Nodes[i].NodeType.Value) { case NodeType.Begin: BeginStepConfig beginStep = new BeginStepConfig(wfConfig); beginStep.Id = rt.Nodes[i].ID.Value; beginStep.Name = rt.Nodes[i].Name.Value; beginStep.DisplayName = rt.Nodes[i].Text.Value;; beginStep.Height = rt.Nodes[i].Height.Value; beginStep.Width = rt.Nodes[i].Width.Value; beginStep.Left = rt.Nodes[i].X.Value; beginStep.Top = rt.Nodes[i].Y.Value; beginStep.CreatorRegName = rt.Nodes[i].CreatorRegName.Value; steps.Add(nodeId, beginStep); wfConfig.Steps.Add(beginStep); stepConfig = beginStep; break; case NodeType.End: EndStepConfig endStep = new EndStepConfig(wfConfig); endStep.Id = rt.Nodes[i].ID.Value; endStep.Name = rt.Nodes[i].Name.Value; endStep.DisplayName = rt.Nodes[i].Text.Value;; endStep.Height = rt.Nodes[i].Height.Value; endStep.Width = rt.Nodes[i].Width.Value; endStep.Left = rt.Nodes[i].X.Value; endStep.Top = rt.Nodes[i].Y.Value; endStep.PlugRegName = rt.Nodes[i].PlugRegName.Value; steps.Add(nodeId, endStep); wfConfig.Steps.Add(endStep); stepConfig = endStep; break; case NodeType.Auto: AutoStepConfig autoStep = new AutoStepConfig(wfConfig); autoStep.Id = rt.Nodes[i].ID.Value; autoStep.Name = rt.Nodes[i].Name.Value; autoStep.DisplayName = rt.Nodes[i].Text.Value;; autoStep.Height = rt.Nodes[i].Height.Value; autoStep.Width = rt.Nodes[i].Width.Value; autoStep.Left = rt.Nodes[i].X.Value; autoStep.Top = rt.Nodes[i].Y.Value; autoStep.PlugRegName = rt.Nodes[i].PlugRegName.Value; steps.Add(nodeId, autoStep); wfConfig.Steps.Add(autoStep); stepConfig = autoStep; break; case NodeType.Route: RouteStepConfig routeStep = new RouteStepConfig(wfConfig); routeStep.Id = rt.Nodes[i].ID.Value; routeStep.Name = rt.Nodes[i].Name.Value; routeStep.DisplayName = rt.Nodes[i].Text.Value; routeStep.Height = rt.Nodes[i].Height.Value; routeStep.Width = rt.Nodes[i].Width.Value; routeStep.Left = rt.Nodes[i].X.Value; routeStep.Top = rt.Nodes[i].Y.Value; if (index == 0) { ConnectionConfig connection = new ConnectionConfig(); connection.DisplayName = line.Text; connection.PlugName = line.PlugName; connection.Name = line.Name; routeStep.Connections.Add(connection); } steps.Add(nodeId, routeStep); wfConfig.Steps.Add(routeStep); stepConfig = routeStep; break; case NodeType.Manual: ManualStepConfig manualStep = new ManualStepConfig(wfConfig); manualStep.Id = rt.Nodes[i].ID.Value; manualStep.Name = rt.Nodes[i].Name.Value; manualStep.DisplayName = rt.Nodes[i].Text.Value; manualStep.Height = rt.Nodes[i].Height.Value; manualStep.Width = rt.Nodes[i].Width.Value; manualStep.Left = rt.Nodes[i].X.Value; manualStep.Top = rt.Nodes[i].Y.Value; manualStep.ActorRegName = rt.Nodes[i].ActorRegName.Value; manualStep.ContentXml = rt.Nodes[i].ManualPageXml.Value; manualStep.ContentChoice = rt.Nodes[i].ContentChoice.Value.Value <ConfigChoice>(); if (rt.Nodes[i].ControllActions != null) { manualStep.ControlActions = new Ataw.Framework.Core.RegNameList <ControlActionConfig>(); ControlActionConfig controlActionConfig; for (int j = 0; j < rt.Nodes[i].ControllActions.Count; j++) { controlActionConfig = new ControlActionConfig { ShowKind = (ShowKind)rt.Nodes[i].ControllActions[j].ShowKind, Title = rt.Nodes[i].ControllActions[j].Title, Order = rt.Nodes[i].ControllActions[j].Order, AreaName = rt.Nodes[i].ControllActions[j].AreaName, ControlName = rt.Nodes[i].ControllActions[j].ControllName, ActionName = rt.Nodes[i].ControllActions[j].ActionName }; manualStep.ControlActions.Add(controlActionConfig); } } if (rt.Nodes[i].Process != null) { manualStep.Process = new ProcessConfig(); if (rt.Nodes[i].Process.UIOperationConfig != null) { manualStep.Process.UIOperation = new Ataw.Workflow.Core.UIOperationConfig(); manualStep.Process.UIOperation.Name = rt.Nodes[i].Process.UIOperationConfig.Name; manualStep.Process.UIOperation.DisplayName = rt.Nodes[i].Process.UIOperationConfig.DisplayName; manualStep.Process.UIOperation.ButtonCaption = rt.Nodes[i].Process.UIOperationConfig.ButtonCaption; manualStep.Process.UIOperation.PlugIn = rt.Nodes[i].Process.UIOperationConfig.Plugin; } if (rt.Nodes[i].Process.NonUIOperationConfigs != null) { manualStep.Process.NonUIOperations = new Ataw.Framework.Core.RegNameList <Ataw.Workflow.Core.NonUIOperationConfig>(); Ataw.Workflow.Core.NonUIOperationConfig nonUIOperationConfig; for (int j = 0; j < rt.Nodes[i].Process.NonUIOperationConfigs.Count; j++) { nonUIOperationConfig = new Ataw.Workflow.Core.NonUIOperationConfig { Name = rt.Nodes[i].Process.NonUIOperationConfigs[j].Name, DisplayName = rt.Nodes[i].Process.NonUIOperationConfigs[j].DisplayName, ButtonCaption = rt.Nodes[i].Process.NonUIOperationConfigs[j].ButtonCaption, PlugIn = rt.Nodes[i].Process.NonUIOperationConfigs[j].Plugin, NeedPrompt = rt.Nodes[i].Process.NonUIOperationConfigs[j].NeedPrompt == "1" ? true : false }; manualStep.Process.NonUIOperations.Add(nonUIOperationConfig); } } } steps.Add(nodeId, manualStep); wfConfig.Steps.Add(manualStep); stepConfig = manualStep; break; } #endregion if (index == 0) { fromStep = stepConfig; } else { toStep = stepConfig; } } } } #endregion if (fromStep != null && toStep != null) { //设置路由步骤的Connection 的下一步名称 RouteStepConfig rsc = fromStep as RouteStepConfig; if (rsc != null) { rsc.Connections[rsc.Connections.Count - 1].NextStepName = toStep.Name; } fromStep.AddNextConfig(toStep, fromStep.Left, fromStep.Top, toStep.Left, toStep.Top); } }
static void Main(string[] args) { var steps = new StepConfig[] { new StepConfig() { Step = new ConsoleWriteStep(new ConsoleWriteOptions() { Message = "Hello! This is the test application." }), Condition = new ExecutionCondition() { Always = true } }, new ConditionalStepConfig(new StepConfig[] { new StepConfig() { Step = new ConsoleWriteStep(new ConsoleWriteOptions() { Message = "First branch succeded!" }), Condition = new ExecutionCondition() { Always = true } } }, new StepConfig[] { new StepConfig() { Step = new ConsoleWriteStep(new ConsoleWriteOptions() { Message = "Second branch succeded!" }), Condition = new ExecutionCondition() { Always = true } } }, new System.Random() ) { Condition = new ExecutionCondition() { Always = true } }, new StepConfig() { Step = new ConsoleWriteStep(new ConsoleWriteOptions() { Message = "The end!" }), Condition = new ExecutionCondition() { Always = true } }, }; var processor = new Processor(steps); processor.Execute(); }
void visitor_OnStepConfigCreated(object sender, StepConfig e) { this.baseCheck(sender); this.stepList.Add(e); }