private GetActivity ( string activityGUID ) : |
||
activityGUID | string | |
Результат |
/// <summary> /// 任务执行的上下文对象 /// </summary> /// <param name="task"></param> /// <param name="processModel"></param> /// <param name="activityResource"></param> private ActivityForwardContext(TaskViewEntity task, ProcessModel processModel, ActivityResource activityResource) { this.TaskView = task; //check task condition has load activity instance this.FromActivityInstance = (new ActivityInstanceManager()).GetById(task.ActivityInstanceID); this.ProcessInstance = (new ProcessInstanceManager()).GetById(task.ProcessInstanceID); this.Activity = processModel.GetActivity(task.ActivityGUID); this.ProcessModel = processModel; this.ActivityResource = activityResource; }
/// <summary> /// 流程返签,先检查约束条件,然后调用wfruntimeinstance执行 /// </summary> /// <param name="appName"></param> /// <param name="appInstanceID"></param> /// <param name="processGUID"></param> /// <param name="userID"></param> /// <param name="userName"></param> /// <returns></returns> public static WfRuntimeManager CreateRuntimeInstanceReverse(WfAppRunner runner, ref WfExecutedResult result) { var rmins = new WfRuntimeManagerReverse(); rmins.WfExecutedResult = result = new WfExecutedResult(); var pim = new ProcessInstanceManager(); var processInstance = pim.GetProcessInstanceLatest(runner.AppName, runner.AppInstanceID, runner.ProcessGUID); if (processInstance == null || processInstance.ProcessState != (short)ProcessStateEnum.Completed) { result.Status = WfExecutedStatus.Exception; result.ExceptionType = WfExceptionType.Reverse_NotInCompleted; result.Message = string.Format("当前应用:{0},实例ID:{1}, 没有完成的流程实例,无法让流程重新运行!", runner.AppName, runner.AppInstanceID); return rmins; } var tim = new TransitionInstanceManager(); var endTransitionInstance = tim.GetEndTransition(runner.AppName, runner.AppInstanceID, runner.ProcessGUID); var processModel = new ProcessModel(runner.ProcessGUID); var endActivity = processModel.GetActivity(endTransitionInstance.ToActivityGUID); var aim = new ActivityInstanceManager(); var endActivityInstance = aim.GetById(endTransitionInstance.ToActivityInstanceID); bool hasGatewayNode = false; var lastTaskActivityInstance = tim.GetPreviousActivityInstance(endActivityInstance, false, out hasGatewayNode).ToList()[0]; var lastTaskActivity = processModel.GetActivity(lastTaskActivityInstance.ActivityGUID); //封装返签结束点之前办理节点的任务接收人 rmins.AppRunner.NextActivityPerformers = ActivityResource.CreateNextActivityPerformers(lastTaskActivityInstance.ActivityGUID, lastTaskActivityInstance.EndedByUserID, lastTaskActivityInstance.EndedByUserName); rmins.ActivityResource = new ActivityResource(runner, rmins.AppRunner.NextActivityPerformers); rmins.AppRunner.AppName = runner.AppName; rmins.AppRunner.AppInstanceID = runner.AppInstanceID; rmins.AppRunner.ProcessGUID = runner.ProcessGUID; rmins.AppRunner.UserID = runner.UserID; rmins.AppRunner.UserName = runner.UserName; rmins.BackwardContext.ProcessInstance = processInstance; rmins.BackwardContext.BackwardToTaskActivity = lastTaskActivity; rmins.BackwardContext.BackwardToTaskActivityInstance = lastTaskActivityInstance; rmins.BackwardContext.BackwardToTargetTransitionGUID = hasGatewayNode == false ? endTransitionInstance.TransitionGUID : String.Empty; rmins.BackwardContext.BackwardFromActivity = endActivity; rmins.BackwardContext.BackwardFromActivityInstance = endActivityInstance; rmins.BackwardContext.BackwardTaskReciever = WfBackwardTaskReciever.Instance(lastTaskActivityInstance.ActivityName, lastTaskActivityInstance.EndedByUserID, lastTaskActivityInstance.EndedByUserName); return rmins; }
/// <summary> /// 获取当前活动实体 /// </summary> /// <param name="processGUID"></param> /// <param name="activityGUID"></param> /// <returns></returns> public ActivityEntity GetActivityEntity(string processGUID, string version, string activityGUID) { var processModel = new ProcessModel(processGUID, version); return processModel.GetActivity(activityGUID); }