/// <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); } }
/// <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); }