Exemple #1
0
        /// <summary>
        /// 遍历执行当前节点后面的节点
        /// 正常运行:需要走Transition的解析流转
        /// 其它方式为直接指定:比如跳转,返送等,不需要解析,不能等同于正常流转解析
        /// </summary>
        /// <param name="isNotParsedByTransition">不需要走解析流转</param>
        /// <param name="session">数据会话</param>
        internal void ContinueForwardCurrentNode(bool isNotParsedByTransition, IDbSession session)
        {
            try
            {
                var mediatorResult   = new List <WfNodeMediatedResult>();
                var activityResource = ActivityForwardContext.ActivityResource;

                if (isNotParsedByTransition == true)
                {
                    //跳转模式时,直接流转运行
                    var root = NextActivityComponentFactory.CreateNextActivityComponent();
                    var nextActivityComponent = NextActivityComponentFactory.CreateNextActivityComponent(
                        this.Linker.FromActivity,
                        this.Linker.ToActivity);

                    root.Add(nextActivityComponent);

                    ContinueForwardCurrentNodeRecurisivly(this.Linker.FromActivity,
                                                          this.Linker.FromActivityInstance,
                                                          root,
                                                          activityResource.ConditionKeyValuePair,
                                                          isNotParsedByTransition,
                                                          ref mediatorResult);
                }
                else
                {
                    //普通正常运行
                    var nextActivityMatchedResult = this.ActivityForwardContext.ProcessModel.GetNextActivityList(
                        this.Linker.FromActivityInstance.ActivityGUID,
                        ActivityForwardContext.TaskID,
                        activityResource.ConditionKeyValuePair,
                        activityResource,
                        (a, b) => a.NextActivityPerformers.ContainsKey(b.ActivityGUID),
                        session);

                    if (nextActivityMatchedResult.MatchedType != NextActivityMatchedType.Successed ||
                        nextActivityMatchedResult.Root.HasChildren == false)
                    {
                        throw new WfRuntimeException(LocalizeHelper.GetEngineMessage("nodemediator.ContinueForwardCurrentNode.warn"));
                    }

                    ContinueForwardCurrentNodeRecurisivly(this.Linker.FromActivity,
                                                          this.Linker.FromActivityInstance,
                                                          nextActivityMatchedResult.Root,
                                                          activityResource.ConditionKeyValuePair,
                                                          isNotParsedByTransition,
                                                          ref mediatorResult);
                }

                if (mediatorResult.Count() > 0)
                {
                    this.WfNodeMediatedResult = mediatorResult[0];
                }
            }
            catch (System.Exception ex)
            {
                throw new WfRuntimeException(LocalizeHelper.GetEngineMessage("nodemediator.ContinueForwardCurrentNode.error", ex.Message), ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// 遍历执行当前节点后面的节点
        /// 正常运行:需要走Transition的解析流转
        /// 其它方式为直接指定:比如跳转,返送等,不需要解析,不能等同于正常流转解析
        /// </summary>
        /// <param name="isNotParsedByTransition">不需要走解析流转</param>
        internal void ContinueForwardCurrentNode(bool isNotParsedByTransition)
        {
            try
            {
                var mediatorResult   = new List <WfNodeMediatedResult>();
                var activityResource = ActivityForwardContext.ActivityResource;

                if (isNotParsedByTransition == true)
                {
                    //跳转模式时,直接流转运行
                    var root = NextActivityComponentFactory.CreateNextActivityComponent();
                    var nextActivityComponent = NextActivityComponentFactory.CreateNextActivityComponent(
                        this.Linker.FromActivity,
                        this.Linker.ToActivity);

                    root.Add(nextActivityComponent);

                    ContinueForwardCurrentNodeRecurisivly(this.Linker.FromActivity,
                                                          this.Linker.FromActivityInstance,
                                                          root,
                                                          activityResource.ConditionKeyValuePair,
                                                          isNotParsedByTransition,
                                                          ref mediatorResult);
                }
                else
                {
                    //普通正常运行
                    var nextActivityMatchedResult = this.ActivityForwardContext.ProcessModel.GetNextActivityList(
                        this.Linker.FromActivityInstance.ActivityGUID,
                        activityResource.ConditionKeyValuePair,
                        activityResource,
                        (a, b) => a.NextActivityPerformers.ContainsKey(b.ActivityGUID));

                    if (nextActivityMatchedResult.MatchedType != NextActivityMatchedType.Successed ||
                        nextActivityMatchedResult.Root.HasChildren == false)
                    {
                        throw new WfRuntimeException("没有匹配的后续流转节点,流程虽然能处理当前节点,但是无法流转到下一步!");
                    }

                    ContinueForwardCurrentNodeRecurisivly(this.Linker.FromActivity,
                                                          this.Linker.FromActivityInstance,
                                                          nextActivityMatchedResult.Root,
                                                          activityResource.ConditionKeyValuePair,
                                                          isNotParsedByTransition,
                                                          ref mediatorResult);
                }

                if (mediatorResult.Count() > 0)
                {
                    this.WfNodeMediatedResult = mediatorResult[0];
                }
            }
            catch (System.Exception ex)
            {
                throw new WfRuntimeException(string.Format("NodeMediator流转时发生错误:{0}", ex.Message), ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// 遍历执行当前节点后面的节点
        /// </summary>
        /// <param name="isJumpforward">是否跳转</param>
        internal void ContinueForwardCurrentNode(bool isJumpforward)
        {
            var mediatorResult   = new List <WfNodeMediatedResult>();
            var activityResource = ActivityForwardContext.ActivityResource;

            if (isJumpforward == false)
            {
                //非跳转模式的正常运行
                var nextActivityMatchedResult = this.ActivityForwardContext.ProcessModel.GetNextActivityList(
                    this.Linker.FromActivityInstance.ActivityGUID,
                    activityResource.ConditionKeyValuePair,
                    activityResource,
                    (a, b) => a.NextActivityPerformers.ContainsKey(b.ActivityGUID));

                if (nextActivityMatchedResult.MatchedType != NextActivityMatchedType.Successed ||
                    nextActivityMatchedResult.Root.HasChildren == false)
                {
                    throw new WfRuntimeException("没有匹配的后续流转节点,流程虽然能处理当前节点,但是无法流转到下一步!");
                }

                ContinueForwardCurrentNodeRecurisivly(this.Linker.FromActivity,
                                                      this.Linker.FromActivityInstance,
                                                      nextActivityMatchedResult.Root,
                                                      activityResource.ConditionKeyValuePair,
                                                      isJumpforward,
                                                      ref mediatorResult);
            }
            else
            {
                //跳转模式运行
                var root = NextActivityComponentFactory.CreateNextActivityComponent();
                var nextActivityComponent = NextActivityComponentFactory.CreateNextActivityComponent(
                    this.Linker.FromActivity,
                    this.Linker.ToActivity);

                root.Add(nextActivityComponent);

                ContinueForwardCurrentNodeRecurisivly(this.Linker.FromActivity,
                                                      this.Linker.FromActivityInstance,
                                                      root,
                                                      activityResource.ConditionKeyValuePair,
                                                      isJumpforward,
                                                      ref mediatorResult);
            }

            if (mediatorResult.Count() > 0)
            {
                this.WfNodeMediatedResult = mediatorResult[0];
            }
        }