CreateRunningContext() static private method

创建任务执行上下文对象
static private CreateRunningContext ( TaskViewEntity task, ProcessModel processModel, ActivityResource activityResource ) : ActivityForwardContext
task Slickflow.Engine.Business.Entity.TaskViewEntity
processModel Slickflow.Engine.Xpdl.ProcessModel
activityResource ActivityResource
return ActivityForwardContext
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            try
            {
                var runningExecutionContext = ActivityForwardContext.CreateRunningContext(base.TaskView,
                                                                                          base.ProcessModel,
                                                                                          base.ActivityResource);

                //执行节点
                NodeMediator mediator = NodeMediatorFactory.CreateNodeMediator(runningExecutionContext, session);
                mediator.Linker.FromActivityInstance = RunningActivityInstance;
                mediator.ExecuteWorkItem();

                //构造回调函数需要的数据
                var result = base.WfExecutedResult;
                result.Status  = WfExecutedStatus.Success;
                result.Message = mediator.GetNodeMediatedMessage();
            }
            catch (WfRuntimeException rx)
            {
                var result = base.WfExecutedResult;
                result.Status        = WfExecutedStatus.Failed;
                result.ExceptionType = WfExceptionType.RunApp_RuntimeError;
                result.Message       = rx.Message;
                throw rx;
            }
            catch (System.Exception ex)
            {
                var result = base.WfExecutedResult;
                result.Status        = WfExecutedStatus.Failed;
                result.ExceptionType = WfExceptionType.RunApp_RuntimeError;
                result.Message       = ex.Message;
                throw ex;
            }
        }
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            //根据加签类型选项,生成新的ActivityInstance记录
            //加签类型有前加签,后加签和并加签
            try
            {
                var signforwardExecutionContext = ActivityForwardContext.CreateRunningContext(base.TaskView,
                                                                                              base.ProcessModel,
                                                                                              base.ActivityResource);

                NodeMediator mediator = NodeMediatorFactory.CreateNodeMediator(signforwardExecutionContext, session);
                mediator.ExecuteWorkItem();

                var result = base.WfExecutedResult;
                result.Status  = WfExecutedStatus.Success;
                result.Message = mediator.GetNodeMediatedMessage();
            }
            catch (WfRuntimeException rx)
            {
                var result = base.WfExecutedResult;
                result.Status        = WfExecutedStatus.Failed;
                result.ExceptionType = WfExceptionType.SignForward_RuntimeError;
                result.Message       = rx.Message;
                throw rx;
            }
            catch (System.Exception ex)
            {
                var result = base.WfExecutedResult;
                result.Status        = WfExecutedStatus.Failed;
                result.ExceptionType = WfExceptionType.SignForward_RuntimeError;
                result.Message       = ex.Message;
                throw ex;
            }
        }