protected override void OnModifyWorkflow(WfExecutorDataContext dataContext) { IWfProcess process = WfRuntime.StartWorkflow(StartupParams); if (this.OperatorActivity == null) { this.OperatorActivity = process.CurrentActivity; } if (this.AutoMoveTo) { if (this.TransferParams == null) { this.TransferParams = WfTransferParams.FromNextDefaultActivity(process); } //如果流转参数中没有下一步的人员,则从下一步活动的候选人中复制 if (this.TransferParams.Assignees.Count == 0) { IWfActivity nextActivity = process.Activities.FindActivityByDescriptorKey(this.TransferParams.NextActivityDescriptor.Key); if (nextActivity != null) { this.TransferParams.Assignees.CopyFrom(nextActivity.Candidates); } } this.TransferParams.FillActivityAndTransitionInfoFromContext(process); WfMoveToExecutor.DoMoveToOperation(process, this.TransferParams); } WfRuntime.ProcessContext.ResetContextByProcess(process); }
protected override void OnPrepareUserOperationLogDescription(WfExecutorDataContext dataContext, UserOperationLog log) { bool dealed = false; if (this.AutoMoveTo) { dealed = WfMoveToExecutor.PrepareUserOperationLogDescriptionByTransferParams(dataContext, this.TransferParams, log); } if (dealed == false) { base.OnPrepareUserOperationLogDescription(dataContext, log); } }
private static void InnerMoveToSimulation(IWfProcess process, WfSimulationContext simulationContext) { if (process.Status == WfProcessStatus.Running) { if (process.CurrentActivity.Status == WfActivityStatus.Running || process.CurrentActivity.Status == WfActivityStatus.Pending) { WfTransferParams transferParams = PrepareTransferParams(process, process.CurrentActivity.Assignees.FirstOrDefault(), simulationContext); if (transferParams != null) { WfMoveToExecutor executor = new WfMoveToExecutor(process.CurrentActivity, process.CurrentActivity, transferParams); executor.Execute(); } } } }
protected override void OnPrepareMoveToTasks(WfExecutorDataContext dataContext) { base.OnPrepareMoveToTasks(dataContext); WfMoveToExecutor.SyncUrlsInAssigneesFromTasks(dataContext.MoveToTasks); }