/// <summary> /// 创建一个带动态矩阵资源的流程定义 /// </summary> /// <returns></returns> public static WfClientProcessDescriptor CreateClientProcessWithActivityMatrixResourceDescriptor() { WfClientProcessDescriptor processDesp = CreateSimpleClientProcessWithoutLines(); WfClientActivityDescriptor actDesp = ActivityDescriptorHelper.CreateSimpleClientActivity("N1", "活动矩阵", WfClientActivityType.NormalActivity); actDesp.Properties.AddOrSetValue("IsDynamic", true); actDesp.Resources.Add(GetClientActivityMatrixResourceDescriptor()); processDesp.Activities.Add(actDesp); WfClientTransitionDescriptor transitionToN1 = new WfClientTransitionDescriptor(processDesp.InitialActivity.Key, "N1") { Key = "L1" }; processDesp.InitialActivity.ToTransitions.Add(transitionToN1); WfClientTransitionDescriptor transitionToCompleted = new WfClientTransitionDescriptor(actDesp.Key, processDesp.CompletedActivity.Key) { Key = "L2" }; processDesp.Activities["N1"].ToTransitions.Add(transitionToCompleted); return(processDesp); }
/// <summary> /// 创建一个有4个节点的流程,开始点有两条出线,根据Amount是否大于等于5000来判断 /// </summary> /// <returns></returns> public static WfClientProcessDescriptor CreateClientProcessWithConditionLines() { WfClientProcessDescriptor processDesp = CreateSimpleClientProcessWithoutLines(); processDesp.Activities.Add(ActivityDescriptorHelper.CreateSimpleClientActivityWithUser("N1", "CFO", "CFO", WfClientActivityType.NormalActivity)); processDesp.Activities.Add(ActivityDescriptorHelper.CreateSimpleClientActivityWithUser("N2", "CEO", "CEO", WfClientActivityType.NormalActivity)); WfClientTransitionDescriptor transitionToCFO = new WfClientTransitionDescriptor(processDesp.InitialActivity.Key, "N1"); transitionToCFO.Key = "L1"; transitionToCFO.Condition.Expression = "Amount >= 5000"; processDesp.InitialActivity.ToTransitions.Add(transitionToCFO); WfClientTransitionDescriptor transitionToCEO = new WfClientTransitionDescriptor(processDesp.InitialActivity.Key, "N2"); transitionToCEO.Key = "L2"; transitionToCEO.Condition.Expression = "Amount < 5000"; processDesp.InitialActivity.ToTransitions.Add(transitionToCEO); WfClientTransitionDescriptor transitionCEOToCFO = new WfClientTransitionDescriptor("CFO", "CEO"); transitionCEOToCFO.Key = "L3"; processDesp.Activities["N1"].ToTransitions.Add(transitionCEOToCFO); return(processDesp); }
/// <summary> /// 创建一个没有连线的Server端流程对象 /// </summary> /// <returns></returns> public static WfProcessDescriptor CreateSimpleServerProcessWithoutLines() { WfProcessDescriptor processDesp = new WfProcessDescriptor(); processDesp.Key = UuidHelper.NewUuidString(); processDesp.Name = "服务端测试流程"; processDesp.Activities.Add(ActivityDescriptorHelper.CreateSimpleServerActivity("Start", "开始", WfActivityType.InitialActivity)); processDesp.Activities.Add(ActivityDescriptorHelper.CreateSimpleServerActivity("End", "结束", WfActivityType.CompletedActivity)); processDesp.RelativeLinks.Add(new WfRelativeLinkDescriptor("AR1") { Category = "Activity", Url = "http://www.ak47.com" }); return(processDesp); }
/// <summary> /// 创建一个没有连线的客户端流程对象 /// </summary> /// <returns></returns> public static WfClientProcessDescriptor CreateSimpleClientProcessWithoutLines() { WfClientProcessDescriptor processDesp = new WfClientProcessDescriptor(); processDesp.Key = UuidHelper.NewUuidString(); processDesp.Name = "客户端测试流程"; processDesp.Activities.Add(ActivityDescriptorHelper.CreateSimpleClientActivityWithUser("Start", "开始", "Requestor", WfClientActivityType.InitialActivity)); processDesp.Activities.Add(ActivityDescriptorHelper.CreateSimpleClientActivity("End", "结束", WfClientActivityType.CompletedActivity)); processDesp.RelativeLinks.Add(new WfClientRelativeLinkDescriptor("AP1") { Category = "Process", Url = "http://www.ak47.com" }); processDesp.CancelEventReceivers.Add(new WfClientUserResourceDescriptor(Consts.Users["Requestor"])); return(processDesp); }