Exemple #1
0
 public Human(int flowNodeIndex, IActionersHelper helper)
     : base(flowNodeIndex)
 {
     this.Helper = helper;
     //由于兼容需要必须保留此初始化
     this.Actioners = new InArgument<string[]>(new GetUsers("originator"));
 }
Exemple #2
0
        /// <summary>
        /// 创建人工节点
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="displayName"></param>
        /// <param name="actioner"></param>
        /// <param name="humanResultTo"></param>
        /// <param name="nexts"></param>
        /// <param name="defaultFlowNode"></param>
        /// <returns></returns>
        public static FlowStep CreateHuman(ActivitySetting setting
                                           , string displayName
                                           , IActionersHelper actioner//Activity<string[]> actioner
                                           , Variable <string> humanResultTo
                                           , IDictionary <string, FlowNode> nexts
                                           , FlowNode defaultFlowNode)
        {
            var human = CreateHuman(setting, displayName, actioner, humanResultTo);
            var step  = new FlowStep();

            step.Action = human;

            if (nexts == null && defaultFlowNode == null)
            {
                return(step);
            }

            //设置finish cases
            //HACK:在进入switch之前就已经计算出任务结果
            var flowSwitch = new FlowSwitch <string>(o => humanResultTo.Get(o));

            if (defaultFlowNode != null)
            {
                flowSwitch.Default = defaultFlowNode;
            }
            if (nexts != null)
            {
                nexts.ToList().ForEach(o => flowSwitch.Cases.Add(o.Key, o.Value));
            }
            step.Next = flowSwitch;
            return(step);
        }
Exemple #3
0
 public Human(int flowNodeIndex, IActionersHelper helper)
     : base(flowNodeIndex)
 {
     this.Helper = helper;
     //由于兼容需要必须保留此初始化
     this.Actioners = new InArgument <string[]>(new GetUsers("originator"));
 }
Exemple #4
0
 public Human(IActionersHelper helper)
     : base()
 {
     this.Helper = helper;
     //由于兼容需要必须保留此初始化 
     //HACK:依赖序列化的糟糕兼容设计导致
     this.Actioners = new InArgument<string[]>(new GetUsers("originator"));
 }
Exemple #5
0
 public Human(IActionersHelper helper)
     : base()
 {
     this.Helper = helper;
     //由于兼容需要必须保留此初始化
     //HACK:依赖序列化的糟糕兼容设计导致
     this.Actioners = new InArgument <string[]>(new GetUsers("originator"));
 }
Exemple #6
0
        /// <summary>
        /// 创建人工节点
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="displayName"></param>
        /// <param name="actioner"></param>
        /// <param name="humanResultTo"></param>
        /// <returns></returns>
        public static Human CreateHuman(ActivitySetting setting
                                        , string displayName
                                        , IActionersHelper actioner//Activity<string[]> actioner
                                        , Variable <string> humanResultTo)
        {
            //HACK:实现类似于K2的client event
            var first = setting.FlowNodeIndex == Default_FlowNodeIndex;
            var human = first
                ? new Human(actioner)
                : new Human(setting.FlowNodeIndex, actioner);

            if (first)
            {
                human.OnFlowNodeIndex = o => setting.SetFlowNodeIndex(o);
            }

            human.DisplayName = displayName;
            if (humanResultTo != null)
            {
                human.Result = new OutArgument <string>(humanResultTo);
            }
            return(human);
        }
        /// <summary>
        /// 创建人工节点
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="displayName"></param>
        /// <param name="actioner"></param>
        /// <param name="humanResultTo"></param>
        /// <returns></returns>
        public static Human CreateHuman(ActivitySetting setting
            , string displayName
            , IActionersHelper actioner//Activity<string[]> actioner
            , Variable<string> humanResultTo)
        {
            //HACK:实现类似于K2的client event
            var first = setting.FlowNodeIndex == Default_FlowNodeIndex;
            var human = first
                ? new Human(actioner)
                : new Human(setting.FlowNodeIndex, actioner);
            if (first)
                human.OnFlowNodeIndex = o => setting.SetFlowNodeIndex(o);

            human.DisplayName = displayName;
            if (humanResultTo != null)
                human.Result = new OutArgument<string>(humanResultTo);
            return human;
        }
        /// <summary>
        /// 创建人工节点
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="displayName"></param>
        /// <param name="actioner"></param>
        /// <param name="humanResultTo"></param>
        /// <param name="nexts"></param>
        /// <param name="defaultFlowNode"></param>
        /// <returns></returns>
        public static FlowStep CreateHuman(ActivitySetting setting
            , string displayName
            , IActionersHelper actioner//Activity<string[]> actioner
            , Variable<string> humanResultTo
            , IDictionary<string, FlowNode> nexts
            , FlowNode defaultFlowNode)
        {
            var human = CreateHuman(setting, displayName, actioner, humanResultTo);
            var step = new FlowStep();
            step.Action = human;

            if (nexts == null && defaultFlowNode == null) return step;

            //设置finish cases
            //HACK:在进入switch之前就已经计算出任务结果
            var flowSwitch = new FlowSwitch<string>(o => humanResultTo.Get(o));
            if (defaultFlowNode != null)
                flowSwitch.Default = defaultFlowNode;
            if (nexts != null)
                nexts.ToList().ForEach(o => flowSwitch.Cases.Add(o.Key, o.Value));
            step.Next = flowSwitch;
            return step;
        }