Exemple #1
0
        /// <summary>
        /// 获取下一步节点列表,满足运行时条件信息
        /// </summary>
        /// <param name="currentActivityGUID"></param>
        /// <returns></returns>
        public NextActivityMatchedResult GetNextActivityList(string currentActivityID)
        {
            try
            {
                NextActivityMatchedResult result     = null;
                NextActivityMatchedType   resultType = NextActivityMatchedType.Unknown;

                //创建“下一步节点”的根节点
                NextActivityComponent   root           = NextActivityComponentFactory.CreateNextActivityComponent();
                NextActivityComponent   child          = null;
                List <TransitionEntity> transitionList = GetForwardTransitionList(currentActivityID).ToList();

                if (transitionList.Count > 0)
                {
                    //遍历连线,获取下一步节点的列表
                    foreach (TransitionEntity transition in transitionList)
                    {
                        if (XPDLHelper.IsWorkItem(transition.TargetActivity.ActivityType))        //可流转简单类型节点 || 子流程节点
                        {
                            child = NextActivityComponentFactory.CreateNextActivityComponent(transition, transition.TargetActivity);
                        }
                        else if (transition.TargetActivity.ActivityType == ActivityTypeEnum.GatewayNode)
                        {
                            NextActivityScheduleBase activitySchedule = NextActivityScheduleFactory.CreateActivitySchedule(this as IProcessModel,
                                                                                                                           transition.TargetActivity.GatewaySplitJoinType);

                            child = activitySchedule.GetNextActivityListFromGateway(transition,
                                                                                    transition.TargetActivity,
                                                                                    out resultType);
                        }
                        else
                        {
                            throw new XmlDefinitionException(string.Format("未知的节点类型:{0}", transition.TargetActivity.ActivityType.ToString()));
                        }

                        if (child != null)
                        {
                            root.Add(child);
                            resultType = NextActivityMatchedType.Successed;
                        }
                    }
                }
                else
                {
                    resultType = NextActivityMatchedType.NoneTransitionFilteredByCondition;
                }
                result = NextActivityMatchedResult.CreateNextActivityMatchedResultObject(resultType, root);
                return(result);
            }
            catch (System.Exception e)
            {
                throw new WfXpdlException(string.Format("解析流程定义文件发生异常,异常描述:{0}", e.Message), e);
            }
        }
Exemple #2
0
        /// <summary>
        /// 添加子节点到网关节点
        /// </summary>
        /// <param name="newRoot">新的根节点</param>
        /// <param name="root">根节点</param>
        /// <param name="child">子节点</param>
        /// <returns>下一步活动节点</returns>
        private NextActivityComponent AddChildToNewGatewayComponent(NextActivityComponent newRoot,
                                                                    NextActivityComponent root,
                                                                    NextActivityComponent child)
        {
            if ((newRoot == null) && (child != null))
            {
                newRoot = NextActivityComponentFactory.CreateNextActivityComponent(root);
            }

            if ((newRoot != null) && (child != null))
            {
                newRoot.Add(child);
            }
            return(newRoot);
        }
        /// <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);
        }