/// <summary> /// 生成启动流程的Task /// </summary> /// <returns></returns> public InvokeServiceTask ToStartWorkflowTask() { InvokeServiceTask task = new InvokeServiceTask(); task.TaskID = UuidHelper.NewUuidString(); task.ResourceID = this.ProcessID; task.TaskTitle = string.Format("启动\"{0}\"", this.ProcessName); task.SvcOperationDefs.Add(new WfServiceOperationDefinition("StartProcess", string.Empty). SetAddress(WfServiceRequestMethod.Post, UriSettings.GetConfig().CheckAndGet("wfPlatformService", "txProcessService").ToString(), WfServiceContentType.Json). AddParameter("srcConnectionName", this.ConnectionName).AddParameter("processID", this.ProcessID)); task.FillData(); return(task); }
/// <summary> /// 生成同步并且执行活动的Task /// </summary> /// <returns></returns> public InvokeServiceTask ToSyncAndExecuteActivityTask() { this.PreviousActivity.NullCheck("流程当前活动为空。流程尚未启动或者已经完成"); InvokeServiceTask task = new InvokeServiceTask(); task.TaskID = UuidHelper.NewUuidString(); task.ResourceID = this.ProcessID; task.TaskTitle = string.Format("流转\"{0}\"中的活动\"{1}\"", this.ProcessName, this.PreviousActivity.ActivityName); task.SvcOperationDefs.Add(new WfServiceOperationDefinition("SyncAndExecuteActivity", string.Empty). SetAddress(WfServiceRequestMethod.Post, UriSettings.GetConfig().CheckAndGet("wfPlatformService", "txProcessService").ToString(), WfServiceContentType.Json). AddParameter("srcConnectionName", this.ConnectionName).AddParameter("processID", this.ProcessID)); task.FillData(); return(task); }
public InvokeServiceTask ToExecuteRollbackProcessTask() { InvokeServiceTask task = null; if (this.CompensationServices.Count > 0) { task = new InvokeServiceTask(); task.TaskID = UuidHelper.NewUuidString(); task.ResourceID = this.ProcessID; task.TaskTitle = string.Format("执行流程回滚\"{0}\"", this.ProcessName); task.SvcOperationDefs.CopyFrom(this.CompensationServices); task.FillData(); } return(task); }
/// <summary> /// 准备一个带错误的任务 /// </summary> /// <returns></returns> private static InvokeServiceTask PrepareErrorInvokeServiceTask() { string url = "http://localhost/MCSWebApp/PermissionCenterServices/services/PermissionCenterToADService.asmx-error"; InvokeServiceTask task = new InvokeServiceTask() { TaskID = UuidHelper.NewUuidString(), TaskTitle = "新任务", }; WfServiceOperationParameterCollection parameters = new WfServiceOperationParameterCollection(); parameters.Add(new WfServiceOperationParameter("callerID", "InvokeServiceTaskPersistTest")); task.SvcOperationDefs.Add(new WfServiceOperationDefinition( new WfServiceAddressDefinition(WfServiceRequestMethod.Post, null, url), "GetVersion", parameters, "ReturnValue") ); return(task); }
/// <summary> /// 生成执行当前活动回滚操作的Task /// </summary> /// <returns></returns> public InvokeServiceTask ToExecuteRollbackCurrentActivityTask() { this.CurrentActivity.NullCheck("流程当前活动为空。流程尚未启动或者已经完成"); InvokeServiceTask task = null; if (this.CurrentActivity.CompensationServices.Count > 0) { task = new InvokeServiceTask(); task.TaskID = UuidHelper.NewUuidString(); task.ResourceID = this.ProcessID; task.TaskTitle = string.Format("执行回滚\"{0}\"中的活动\"{1}\"", this.ProcessName, this.CurrentActivity.ActivityName); task.SvcOperationDefs.CopyFrom(this.CurrentActivity.CompensationServices); task.FillData(); } return(task); }
/// <summary> /// 生成同步并且执行活动的Task /// </summary> /// <returns></returns> public InvokeServiceTask ToSyncAndRollbackActivityTask() { InvokeServiceTask task = new InvokeServiceTask(); task.TaskID = UuidHelper.NewUuidString(); task.ResourceID = this.ProcessID; if (this.CurrentActivity != null) { task.TaskTitle = string.Format("回滚\"{0}\"中的活动\"{1}\"", this.ProcessName, this.CurrentActivity.ActivityName); } else { task.TaskTitle = string.Format("回滚\"{0}\"完成", this.ProcessName); } task.SvcOperationDefs.Add(new WfServiceOperationDefinition("SyncAndRollbackActivity", string.Empty). SetAddress(WfServiceRequestMethod.Post, UriSettings.GetConfig().CheckAndGet("wfPlatformService", "txProcessService").ToString(), WfServiceContentType.Json). AddParameter("srcConnectionName", this.ConnectionName).AddParameter("processID", this.ProcessID)); task.FillData(); return(task); }