Пример #1
0
        /// <summary>
        /// 获取下一步节点列表
        /// </summary>
        /// <param name="fromTransition">起始转移</param>
        /// <param name="currentGatewayActivity">当前节点</param>
        /// <param name="conditionKeyValuePair">条件对</param>
        /// <param name="session">会话</param>
        /// <param name="resultType">结果类型</param>
        /// <returns>下一步组件类型</returns>
        internal override NextActivityComponent GetNextActivityListFromGateway(TransitionEntity fromTransition,
                                                                               ActivityEntity currentGatewayActivity,
                                                                               IDictionary <string, string> conditionKeyValuePair,
                                                                               IDbSession session,
                                                                               out NextActivityMatchedType resultType)
        {
            NextActivityComponent child            = null;
            NextActivityComponent gatewayComponent = null;

            resultType = NextActivityMatchedType.Unknown;

            var transitionList = this.ProcessModel.GetForwardTransitionList(currentGatewayActivity.ActivityGUID).ToList();

            foreach (TransitionEntity transition in transitionList)
            {
                bool isValidTransition = base.ProcessModel.IsValidTransition(transition, conditionKeyValuePair);
                if (isValidTransition)
                {
                    child = GetNextActivityListFromGatewayCore(transition,
                                                               conditionKeyValuePair,
                                                               session,
                                                               out resultType);

                    gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);
                }
            }

            if (gatewayComponent == null)
            {
                resultType = NextActivityMatchedType.NoneTransitionFilteredByCondition;
            }
            return(gatewayComponent);
        }
Пример #2
0
        /// <summary>
        /// 创建下一步活动的节点
        /// </summary>
        /// <param name="activity"></param>
        /// <returns></returns>
        internal static NextActivityComponent CreateNextActivityComponent(TransitionEntity transition,
                                                                          ActivityEntity activity)
        {
            NextActivityComponent component = null;

            if (XPDLHelper.IsSimpleComponentNode(activity.ActivityType) == true)           //可流转简单类型节点
            {
                string name = "单一节点";
                component = new NextActivityItem(name, transition, activity);
            }
            else if (activity.ActivityType == ActivityTypeEnum.SubProcessNode)
            {
                string name = "子流程节点";
                component = new NextActivityItem(name, transition, activity);
            }
            else
            {
                string name = string.Empty;
                if (activity.GatewayDirectionType == Slickflow.Engine.Common.GatewayDirectionEnum.AndSplit)
                {
                    name = "必全选节点";
                }
                else if (activity.GatewayDirectionType == GatewayDirectionEnum.AndSplitMI)
                {
                    name = "并行多实例节点";
                }
                else
                {
                    name = "或多选节点";
                }

                component = new NextActivityGateway(name, transition, activity);
            }
            return(component);
        }
Пример #3
0
        /// <summary>
        /// 获取下一步节点列表
        /// </summary>
        /// <param name="fromTransition">起始转移</param>
        /// <param name="currentGatewayActivity">当前节点</param>
        /// <param name="conditionKeyValuePair">条件对</param>
        /// <param name="resultType">结果类型</param>
        /// <returns>下一步组件类型</returns>
        internal override NextActivityComponent GetNextActivityListFromGateway(TransitionEntity fromTransition,
                                                                               ActivityEntity currentGatewayActivity,
                                                                               IDictionary <string, string> conditionKeyValuePair,
                                                                               out NextActivityMatchedType resultType)
        {
            NextActivityComponent child            = null;
            NextActivityComponent gatewayComponent = null;

            resultType = NextActivityMatchedType.Unknown;

            //直接取出下步列表,运行时再根据条件执行
            List <TransitionEntity> transitionList = base.ProcessModel.GetForwardTransitionList(currentGatewayActivity.ActivityGUID,
                                                                                                conditionKeyValuePair).ToList();

            foreach (TransitionEntity transition in transitionList)
            {
                child = GetNextActivityListFromGatewayCore(transition,
                                                           conditionKeyValuePair,
                                                           out resultType);

                gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);
            }

            return(gatewayComponent);
        }
Пример #4
0
        /// <summary>
        /// 根据Transition,获取下一步节点列表
        /// </summary>
        /// <param name="forwardTransition">转移实体</param>
        /// <param name="conditionKeyValuePair">条件kv对</param>
        /// <param name="resultType">结果类型</param>
        protected NextActivityComponent GetNextActivityListFromGatewayCore(TransitionEntity forwardTransition,
                                                                           IDictionary <string, string> conditionKeyValuePair,
                                                                           out NextActivityMatchedType resultType)
        {
            NextActivityComponent child = null;

            if (XPDLHelper.IsSimpleComponentNode(forwardTransition.ToActivity.ActivityType) == true)       //可流转简单类型节点
            {
                child      = NextActivityComponentFactory.CreateNextActivityComponent(forwardTransition, forwardTransition.ToActivity);
                resultType = NextActivityMatchedType.Successed;
            }
            else if (forwardTransition.ToActivity.ActivityType == ActivityTypeEnum.GatewayNode)
            {
                child = GetNextActivityListFromGateway(forwardTransition,
                                                       forwardTransition.ToActivity,
                                                       conditionKeyValuePair,
                                                       out resultType);
            }
            else
            {
                resultType = NextActivityMatchedType.Failed;

                throw new XmlDefinitionException(string.Format("未知的节点类型:{0}", forwardTransition.ToActivity.ActivityType.ToString()));
            }
            return(child);
        }
Пример #5
0
 /// <summary>
 /// 添加子节点
 /// </summary>
 /// <param name="nextActivity">活动节点</param>
 public override void Add(NextActivityComponent nextActivity)
 {
     nextActivityList.Add(nextActivity);
     if (hasChildren == false)
     {
         hasChildren = true;
     }
 }
Пример #6
0
        /// <summary>
        /// 移除子节点
        /// </summary>
        /// <param name="nextActivity">活动节点</param>
        /// <returns>删除状态</returns>
        public override bool Remove(NextActivityComponent nextActivity)
        {
            bool isRemoved = nextActivityList.Remove(nextActivity);

            if (nextActivityList.Count == 0)
            {
                hasChildren = false;
            }
            return(isRemoved);
        }
        /// <summary>
        /// 创建下一步活动的节点
        /// </summary>
        /// <param name="transition">转移</param>
        /// <param name="activity">活动</param>
        /// <returns>下一步节点封装</returns>
        internal static NextActivityComponent CreateNextActivityComponent(TransitionEntity transition,
                                                                          ActivityEntity activity)
        {
            string name = string.Empty;
            NextActivityComponent component = null;

            if (XPDLHelper.IsSimpleComponentNode(activity.ActivityType) == true)           //可流转简单类型节点
            {
                name      = "单一节点";
                component = new NextActivityItem(name, transition, activity);
            }
            else if (XPDLHelper.IsIntermediateEventComponentNode(activity.ActivityType) == true)
            {
                name      = "跨事件节点";
                component = new NextActivityIntermediate(name, transition, activity);
            }
            else if (XPDLHelper.IsGatewayComponentNode(activity.ActivityType) == true)
            {
                if (activity.GatewayDirectionType == GatewayDirectionEnum.AndSplit)
                {
                    name      = "必全选节点";
                    component = new NextActivityGateway(name, transition, activity);
                }
                else if (activity.GatewayDirectionType == GatewayDirectionEnum.AndSplitMI)
                {
                    name      = "并行多实例节点";
                    component = new NextActivityGateway(name, transition, activity);
                }
                else if (activity.GatewayDirectionType == GatewayDirectionEnum.OrSplit ||
                         activity.GatewayDirectionType == GatewayDirectionEnum.OrSplitMI ||
                         activity.GatewayDirectionType == GatewayDirectionEnum.XOrSplit)
                {
                    name      = "或多选节点";
                    component = new NextActivityGateway(name, transition, activity);
                }
                else
                {
                    throw new WfXpdlException(string.Format("无法创建下一步节点列表,不明确的分支类型:{0}",
                                                            activity.GatewayDirectionType.ToString()));
                }
            }
            else if (activity.ActivityType == ActivityTypeEnum.SubProcessNode)
            {
                name      = "子流程节点";
                component = new NextActivityItem(name, transition, activity);
            }
            else
            {
                throw new WfXpdlException(string.Format("无法创建下一步节点列表,不明确的节点类型:{0}",
                                                        activity.ActivityType.ToString()));
            }

            return(component);
        }
Пример #8
0
        /// <summary>
        /// 根据Transition,获取下一步节点列表
        /// </summary>
        /// <param name="forwardTransition">转移实体</param>
        /// <param name="conditionKeyValuePair">条件kv对</param>
        /// <param name="session">会话</param>
        /// <param name="resultType">结果类型</param>
        protected NextActivityComponent GetNextActivityListFromGatewayCore(TransitionEntity forwardTransition,
                                                                           IDictionary <string, string> conditionKeyValuePair,
                                                                           IDbSession session,
                                                                           out NextActivityMatchedType resultType)
        {
            NextActivityComponent child = null;

            if (XPDLHelper.IsSimpleComponentNode(forwardTransition.ToActivity.ActivityType) == true)       //可流转简单类型节点
            {
                child      = NextActivityComponentFactory.CreateNextActivityComponent(forwardTransition, forwardTransition.ToActivity);
                resultType = NextActivityMatchedType.Successed;
            }
            else if (forwardTransition.ToActivity.ActivityType == ActivityTypeEnum.GatewayNode)
            {
                child = GetNextActivityListFromGateway(forwardTransition,
                                                       forwardTransition.ToActivity,
                                                       conditionKeyValuePair,
                                                       session,
                                                       out resultType);
            }
            else if (forwardTransition.ToActivity.ActivityType == ActivityTypeEnum.IntermediateNode)
            {
                if (forwardTransition.ToActivity.ActivityTypeDetail.TriggerType == TriggerTypeEnum.Timer)
                {
                    child      = NextActivityComponentFactory.CreateNextActivityComponent(forwardTransition, forwardTransition.ToActivity);
                    resultType = NextActivityMatchedType.Successed;
                }
                else
                {
                    NextActivityScheduleBase activitySchedule = NextActivityScheduleFactory.CreateActivityScheduleIntermediate(this.ProcessModel);
                    child = activitySchedule.GetNextActivityListFromGateway(forwardTransition,
                                                                            forwardTransition.ToActivity,
                                                                            conditionKeyValuePair,
                                                                            session,
                                                                            out resultType);
                }
            }
            else if (forwardTransition.ToActivity.ActivityType == ActivityTypeEnum.ServiceNode)
            {
                NextActivityScheduleBase activitySchedule = NextActivityScheduleFactory.CreateActivityScheduleIntermediate(this.ProcessModel);
                child = activitySchedule.GetNextActivityListFromGateway(forwardTransition,
                                                                        forwardTransition.ToActivity,
                                                                        conditionKeyValuePair,
                                                                        session,
                                                                        out resultType);
            }
            else
            {
                resultType = NextActivityMatchedType.Failed;

                throw new XmlDefinitionException(LocalizeHelper.GetEngineMessage("nextactivityschedulebase.unknownnodetype", forwardTransition.ToActivity.ActivityType.ToString()));
            }
            return(child);
        }
Пример #9
0
        /// <summary>
        /// 把子节点添加到网关路由节点,根据网关节点和子节点是否为空处理
        /// </summary>
        /// <param name="fromTransition">起始转移</param>
        /// <param name="currentGatewayActivity">当前网关节点</param>
        /// <param name="gatewayComponent">网关Component</param>
        /// <param name="child">子节点</param>
        /// <returns>下一步Component</returns>
        protected NextActivityComponent AddChildToGatewayComponent(TransitionEntity fromTransition,
                                                                   ActivityEntity currentGatewayActivity,
                                                                   NextActivityComponent gatewayComponent,
                                                                   NextActivityComponent child)
        {
            if ((gatewayComponent == null) && (child != null))
            {
                gatewayComponent = NextActivityComponentFactory.CreateNextActivityComponent(fromTransition, currentGatewayActivity);
            }

            if ((gatewayComponent != null) && (child != null))
            {
                gatewayComponent.Add(child);
            }

            return(gatewayComponent);
        }
Пример #10
0
        /// <summary>
        /// 创建跳转节点(强制拉取跳转方式,后续节点状态可以强制拉取前置节点到当前节点[后续节点])
        /// </summary>
        /// <param name="fromActivity">要拉取的节点</param>
        /// <param name="toActivity">拉取到节点</param>
        /// <returns></returns>
        internal static NextActivityComponent CreateNextActivityComponent(ActivityEntity fromActivity,
                                                                          ActivityEntity toActivity)
        {
            NextActivityComponent component = null;

            if (XPDLHelper.IsSimpleComponentNode(fromActivity.ActivityType) == true)       //可流转简单类型节点
            {
                string name       = "单一节点";
                var    transition = TransitionBuilder.CreateJumpforwardEmptyTransition(fromActivity, toActivity);

                component = new NextActivityItem(name, transition, fromActivity);     //强制拉取跳转类型的transition 为空类型
            }
            else
            {
                throw new ApplicationException(string.Format("不能跳转到其它非任务类型的节点!当前节点:{0}",
                                                             fromActivity.ActivityType));
            }
            return(component);
        }
Пример #11
0
        /// <summary>
        /// 创建跳转节点(强制拉取跳转方式,后续节点状态可以强制拉取前置节点到当前节点[后续节点])
        /// </summary>
        /// <param name="fromActivity">要拉取的节点</param>
        /// <param name="toActivity">拉取到节点</param>
        /// <returns>下一步节点封装</returns>
        internal static NextActivityComponent CreateNextActivityComponent(ActivityEntity fromActivity,
                                                                          ActivityEntity toActivity)
        {
            NextActivityComponent component = null;

            if (XPDLHelper.IsSimpleComponentNode(fromActivity.ActivityType) == true)       //可流转简单类型节点
            {
                //单一节点
                string name       = LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.singlenode");;
                var    transition = CreateJumpforwardEmptyTransition(fromActivity, toActivity);

                component = new NextActivityItem(name, transition, toActivity);     //强制拉取跳转类型的transition 为空类型
            }
            else
            {
                throw new ApplicationException(LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.CreateNextActivityComponent.jump.error",
                                                                               fromActivity.ActivityType.ToString()));
            }
            return(component);
        }
Пример #12
0
 private NextActivityMatchedResult(NextActivityMatchedType matchedType,
                                   NextActivityComponent root)
 {
     MatchedType = matchedType;
     Root        = root;
 }
Пример #13
0
        /// <summary>
        /// 根据现有下一步节点列表,创建新的下一步节点列表对象
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        internal static NextActivityComponent CreateNextActivityComponent(NextActivityComponent c)
        {
            NextActivityComponent newComp = CreateNextActivityComponent(c.Transition, c.Activity);

            return(newComp);
        }
Пример #14
0
        /// <summary>
        /// 创建下一步活动的节点
        /// </summary>
        /// <param name="transition">转移</param>
        /// <param name="activity">活动</param>
        /// <returns>下一步节点封装</returns>
        internal static NextActivityComponent CreateNextActivityComponent(TransitionEntity transition,
                                                                          ActivityEntity activity)
        {
            string name = string.Empty;
            NextActivityComponent component = null;

            if (XPDLHelper.IsSimpleComponentNode(activity.ActivityType) == true)           //可流转简单类型节点
            {
                //单一节点
                name      = LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.singlenode");
                component = new NextActivityItem(name, transition, activity);
            }
            else if (XPDLHelper.IsIntermediateEventComponentNode(activity.ActivityType) == true)
            {
                //跨事件节点
                name      = LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.intermediatenode");
                component = new NextActivityIntermediate(name, transition, activity);
            }
            else if (XPDLHelper.IsGatewayComponentNode(activity.ActivityType) == true)
            {
                if (activity.GatewayDirectionType == GatewayDirectionEnum.AndSplit ||
                    activity.GatewayDirectionType == GatewayDirectionEnum.AndJoin)
                {
                    //必全选节点
                    name = LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.mandatorycheckall");
                }
                else if (activity.GatewayDirectionType == GatewayDirectionEnum.AndSplitMI ||
                         activity.GatewayDirectionType == GatewayDirectionEnum.AndJoinMI)
                {
                    //并行多实例节点
                    name = LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.parallelmultipleinstance");
                }
                else if (activity.GatewayDirectionType == GatewayDirectionEnum.OrSplit ||
                         activity.GatewayDirectionType == GatewayDirectionEnum.OrJoin)
                {
                    //或多选节点
                    name = LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.orsplitorjoin");
                }
                else if (activity.GatewayDirectionType == GatewayDirectionEnum.XOrSplit ||
                         activity.GatewayDirectionType == GatewayDirectionEnum.XOrJoin)
                {
                    //异或节点
                    name = LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.xor");
                }
                else if (activity.GatewayDirectionType == GatewayDirectionEnum.EOrJoin)
                {
                    //增强合并多选节点
                    name = LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.eorjoin");
                }
                else
                {
                    throw new WfXpdlException(LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.CreateNextActivityComponent.gateway.error",
                                                                              activity.GatewayDirectionType.ToString()));
                }
                component = new NextActivityGateway(name, transition, activity);
            }
            else if (activity.ActivityType == ActivityTypeEnum.SubProcessNode)
            {
                //子流程节点
                name      = LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.subprocess");
                component = new NextActivityItem(name, transition, activity);
            }
            else
            {
                throw new WfXpdlException(LocalizeHelper.GetEngineMessage("nextactivitycomponentfactory.CreateNextActivityComponent.error",
                                                                          activity.ActivityType.ToString()));
            }

            return(component);
        }
Пример #15
0
 /// <summary>
 /// 删除子节点
 /// </summary>
 /// <param name="nextActivity"></param>
 /// <returns></returns>
 public virtual bool Remove(NextActivityComponent nextActivity)
 {
     throw new InvalidOperationException("非组合节点,无子项可以删除!");
 }
Пример #16
0
 /// <summary>
 /// 添加子节点
 /// </summary>
 /// <param name="nextActivity"></param>
 public virtual void Add(NextActivityComponent nextActivity)
 {
     throw new InvalidOperationException("非组合节点,不能添加子项!");
 }
        /// <summary>
        /// 获取下一步节点列表
        /// </summary>
        /// <param name="fromTransition">起始转移</param>
        /// <param name="currentGatewayActivity">当前节点</param>
        /// <param name="conditionKeyValuePair">条件</param>
        /// <param name="session">会话</param>
        /// <param name="resultType">结果类型</param>
        /// <returns>返回节点</returns>
        internal override NextActivityComponent GetNextActivityListFromGateway(TransitionEntity fromTransition,
                                                                               ActivityEntity currentGatewayActivity,
                                                                               IDictionary <string, string> conditionKeyValuePair,
                                                                               IDbSession session,
                                                                               out NextActivityMatchedType resultType)
        {
            NextActivityComponent child            = null;
            NextActivityComponent gatewayComponent = null;

            resultType = NextActivityMatchedType.Unknown;
            var transitionList = this.ProcessModel.GetForwardTransitionList(currentGatewayActivity.ActivityGUID).ToList();

            if (currentGatewayActivity.GatewayDirectionType == GatewayDirectionEnum.AndSplit ||
                currentGatewayActivity.GatewayDirectionType == GatewayDirectionEnum.AndSplitMI)
            {
                //获取AndSplit的每一条后续连线上的To节点
                foreach (TransitionEntity transition in transitionList)
                {
                    child = GetNextActivityListFromGatewayCore(transition,
                                                               conditionKeyValuePair,
                                                               session,
                                                               out resultType);

                    gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);
                }

                if (gatewayComponent == null)
                {
                    resultType = NextActivityMatchedType.WaitingForOtherSplitting;
                }
            }
            else if (currentGatewayActivity.GatewayDirectionType == GatewayDirectionEnum.OrSplit)
            {
                //获取OrSplit的,满足条件的后续连线上的To节点
                foreach (TransitionEntity transition in transitionList)
                {
                    bool isValidTransition = base.ProcessModel.IsValidTransition(transition, conditionKeyValuePair);
                    if (isValidTransition)
                    {
                        child = GetNextActivityListFromGatewayCore(transition,
                                                                   conditionKeyValuePair,
                                                                   session,
                                                                   out resultType);

                        gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);
                    }
                }

                if (gatewayComponent == null)
                {
                    //没有分支满足,则选择默认分支流转
                    var defaultTransition = transitionList.Find(t => t.GroupBehaviours != null && t.GroupBehaviours.DefaultBranch == true);
                    if (defaultTransition != null)
                    {
                        child = GetNextActivityListFromGatewayCore(defaultTransition,
                                                                   conditionKeyValuePair,
                                                                   session,
                                                                   out resultType);

                        gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);
                    }
                    else
                    {
                        resultType = NextActivityMatchedType.NoneTransitionMatchedToSplit;
                    }
                }
            }
            else if (currentGatewayActivity.GatewayDirectionType == GatewayDirectionEnum.XOrSplit)
            {
                //按连线定义的优先级排序
                transitionList.Sort(new TransitionPriorityCompare());

                //获取XOrSplit的,第一条满足条件的后续连线上的To节点
                foreach (TransitionEntity transition in transitionList)
                {
                    bool isValidTransitionXOr = base.ProcessModel.IsValidTransition(transition, conditionKeyValuePair);
                    if (isValidTransitionXOr)
                    {
                        child = GetNextActivityListFromGatewayCore(transition,
                                                                   conditionKeyValuePair,
                                                                   session,
                                                                   out resultType);

                        gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);
                        //退出循环
                        break;
                    }
                }

                if (gatewayComponent == null)
                {
                    resultType = NextActivityMatchedType.NoneTransitionMatchedToSplit;
                }
            }
            else if (currentGatewayActivity.GatewayDirectionType == GatewayDirectionEnum.ApprovalOrSplit)
            {
                var fromActivity     = fromTransition.FromActivity;
                var aim              = new ActivityInstanceManager();
                var nodePassedResult = aim.CheckActivityInstancePassedResult(this.TaskID, session);

                //根据节点通过类型连线类型
                if (nodePassedResult.NodePassedType == NodePassedTypeEnum.Passed)
                {
                    transitionList = transitionList.Where <TransitionEntity>(t => t.GroupBehaviours.Approval == (short)ApprovalStatusEnum.Agreed).ToList();
                }
                else if (nodePassedResult.NodePassedType == NodePassedTypeEnum.NotPassed)
                {
                    transitionList = transitionList.Where <TransitionEntity>(t => t.GroupBehaviours.Approval == (short)ApprovalStatusEnum.Refused).ToList();
                }
                else if (nodePassedResult.NodePassedType == NodePassedTypeEnum.NeedToBeMoreApproved)
                {
                    transitionList = transitionList.Where <TransitionEntity>(t => t.GroupBehaviours.Approval == (short)ApprovalStatusEnum.Agreed).ToList();
                }
                else
                {
                    transitionList = null;
                    resultType     = NextActivityMatchedType.WaitingForAgreedOrRefused;
                }

                //获取有效的下一步节点
                if (transitionList != null)
                {
                    foreach (TransitionEntity transition in transitionList)
                    {
                        child = GetNextActivityListFromGatewayCore(transition,
                                                                   conditionKeyValuePair,
                                                                   session,
                                                                   out resultType);

                        gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);

                        if (gatewayComponent == null)
                        {
                            resultType = NextActivityMatchedType.NoneTransitionMatchedToSplit;
                        }
                    }
                }
            }
            else
            {
                resultType = NextActivityMatchedType.Failed;
                throw new WfXpdlException(LocalizeHelper.GetEngineMessage("nextactivityschedulesplit.error",
                                                                          currentGatewayActivity.GatewayDirectionType.ToString()));
            }
            return(gatewayComponent);
        }
Пример #18
0
        /// <summary>
        /// 创建方法
        /// </summary>
        /// <param name="matchedType">匹配类型</param>
        /// <param name="root">根节点</param>
        /// <returns>下一步匹配结果</returns>
        internal static NextActivityMatchedResult CreateNextActivityMatchedResultObject(NextActivityMatchedType matchedType,
                                                                                        NextActivityComponent root)
        {
            NextActivityMatchedResult result = new NextActivityMatchedResult(matchedType, root);

            switch (matchedType)
            {
            case NextActivityMatchedType.Unknown:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.Unkonwn");
                break;

            case NextActivityMatchedType.Failed:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.Exceptional");
                break;

            case NextActivityMatchedType.Successed:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.Successed");
                break;

            case NextActivityMatchedType.NoneTransitionFilteredByCondition:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.NoneTransitionFilteredByCondition");
                break;

            case NextActivityMatchedType.WaitingForOtherSplitting:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.WaitingForOtherSplitting");
                break;

            case NextActivityMatchedType.WaitingForAgreedOrRefused:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.WaitingForAgreedOrRefused");
                break;

            case NextActivityMatchedType.NoneTransitionMatchedToSplit:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.NoneWayMatchedToSplit");
                break;

            case NextActivityMatchedType.FailedPassRateOfMulitipleInstance:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.FailedPassRateOfMulitipleInstance");
                break;

            case NextActivityMatchedType.WaitingForOthersJoin:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.WaitingForOthersJoin");
                break;

            case NextActivityMatchedType.NotMadeItselfToJoin:
                result.Message = LocalizeHelper.GetEngineMessage("nextactivitymatchedresult.NotMadeItselfToJoin");
                break;
            }
            return(result);
        }
        /// <summary>
        /// 获取下一步节点列表
        /// </summary>
        /// <param name="fromTransition">起始转移</param>
        /// <param name="currentGatewayActivity">当前节点</param>
        /// <param name="conditionKeyValuePair">条件</param>
        /// <param name="resultType">结果类型</param>
        /// <returns>返回节点</returns>
        internal override NextActivityComponent GetNextActivityListFromGateway(TransitionEntity fromTransition,
                                                                               ActivityEntity currentGatewayActivity,
                                                                               IDictionary <string, string> conditionKeyValuePair,
                                                                               out NextActivityMatchedType resultType)
        {
            NextActivityComponent child            = null;
            NextActivityComponent gatewayComponent = null;

            resultType = NextActivityMatchedType.Unknown;
            var transitionList = this.ProcessModel.GetForwardTransitionList(currentGatewayActivity.ActivityGUID).ToList();

            if (currentGatewayActivity.GatewayDirectionType == GatewayDirectionEnum.AndSplit ||
                currentGatewayActivity.GatewayDirectionType == GatewayDirectionEnum.AndSplitMI)
            {
                //获取AndSplit的每一条后续连线上的To节点
                foreach (TransitionEntity transition in transitionList)
                {
                    child = GetNextActivityListFromGatewayCore(transition,
                                                               conditionKeyValuePair,
                                                               out resultType);

                    gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);
                }

                if (gatewayComponent == null)
                {
                    resultType = NextActivityMatchedType.WaitingForSplitting;
                }
            }
            else if (currentGatewayActivity.GatewayDirectionType == GatewayDirectionEnum.OrSplit)
            {
                //获取OrSplit的,满足条件的后续连线上的To节点
                foreach (TransitionEntity transition in transitionList)
                {
                    bool isValidTransition = base.ProcessModel.IsValidTransition(transition, conditionKeyValuePair);
                    if (isValidTransition)
                    {
                        child = GetNextActivityListFromGatewayCore(transition,
                                                                   conditionKeyValuePair,
                                                                   out resultType);

                        gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);
                    }

                    if (gatewayComponent == null)
                    {
                        resultType = NextActivityMatchedType.NoneTransitionMatchedToSplit;
                    }
                }
            }
            else if (currentGatewayActivity.GatewayDirectionType == GatewayDirectionEnum.XOrSplit)
            {
                //按连线定义的优先级排序
                transitionList.Sort(new TransitionPriorityCompare());

                //获取XOrSplit的,第一条满足条件的后续连线上的To节点
                foreach (TransitionEntity transition in transitionList)
                {
                    bool isValidTransitionXOr = base.ProcessModel.IsValidTransition(transition, conditionKeyValuePair);
                    if (isValidTransitionXOr)
                    {
                        child = GetNextActivityListFromGatewayCore(transition,
                                                                   conditionKeyValuePair,
                                                                   out resultType);

                        gatewayComponent = AddChildToGatewayComponent(fromTransition, currentGatewayActivity, gatewayComponent, child);
                        //退出循环
                        break;
                    }
                }

                if (gatewayComponent == null)
                {
                    resultType = NextActivityMatchedType.NoneTransitionMatchedToSplit;
                }
            }
            else
            {
                resultType = NextActivityMatchedType.Failed;
                throw new Exception("Split 分支节点的类型不明确!");
            }

            return(gatewayComponent);
        }
Пример #20
0
 /// <summary>
 /// 删除子节点
 /// </summary>
 /// <param name="nextActivity"></param>
 /// <returns></returns>
 public virtual bool Remove(NextActivityComponent nextActivity)
 {
     throw new InvalidOperationException(LocalizeHelper.GetEngineMessage("nextactivitycomponent.Remove.error"));
 }
Пример #21
0
        /// <summary>
        /// 创建方法
        /// </summary>
        /// <param name="scheduleStatus"></param>
        /// <param name="root"></param>
        /// <returns></returns>
        internal static NextActivityMatchedResult CreateNextActivityMatchedResultObject(NextActivityMatchedType matchedType,
                                                                                        NextActivityComponent root)
        {
            NextActivityMatchedResult result = new NextActivityMatchedResult(matchedType, root);

            switch (matchedType)
            {
            case NextActivityMatchedType.Unknown:
                result.Message = NextActivityMatchedResult.Unkonwn;
                break;

            case NextActivityMatchedType.Failed:
                result.Message = NextActivityMatchedResult.Exceptional;
                break;

            case NextActivityMatchedType.Successed:
                result.Message = NextActivityMatchedResult.Successed;
                break;

            case NextActivityMatchedType.NoneTransitionFilteredByCondition:
                result.Message = NextActivityMatchedResult.NoneTransitionFilteredByCondition;
                break;

            case NextActivityMatchedType.WaitingForSplitting:
                result.Message = NextActivityMatchedResult.NoneTransitionAsBeingFiltered;
                break;

            case NextActivityMatchedType.NoneTransitionMatchedToSplit:
                result.Message = NextActivityMatchedResult.NoneWayMatchedToSplit;
                break;

            case NextActivityMatchedType.WaitingForOthersJoin:
                result.Message = NextActivityMatchedResult.WaitingForOthersJoin;
                break;

            case NextActivityMatchedType.NotMadeItselfToJoin:
                result.Message = NextActivityMatchedResult.NotMadeItselfToJoin;
                break;
            }
            return(result);
        }