CreateBackwardActivityTaskTransitionInstance() private method

创建退回时的流转节点对象、任务和转移数据
private CreateBackwardActivityTaskTransitionInstance ( ProcessInstanceEntity processInstance, ActivityInstanceEntity fromActivityInstance, BackwardTypeEnum backwardType, int backMostPreviouslyActivityInstanceID, string transitionGUID, TransitionTypeEnum transitionType, TransitionFlyingTypeEnum flyingType, ActivityResource activityResource, IDbSession session ) : void
processInstance Slickflow.Engine.Business.Entity.ProcessInstanceEntity
fromActivityInstance Slickflow.Engine.Business.Entity.ActivityInstanceEntity
backwardType BackwardTypeEnum
backMostPreviouslyActivityInstanceID int
transitionGUID string
transitionType TransitionTypeEnum
flyingType TransitionFlyingTypeEnum
activityResource ActivityResource
session IDbSession
return void
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            //创建新任务节点
            var backMostPreviouslyActivityInstanceID = GetBackwardMostPreviouslyActivityInstanceID();
            var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);

            nodeMediatorBackward.CreateBackwardActivityTaskTransitionInstance(base.BackwardContext.ProcessInstance,
                base.BackwardContext.BackwardFromActivityInstance,
                BackwardTypeEnum.Withdrawed,
                backMostPreviouslyActivityInstanceID,
                base.BackwardContext.BackwardToTargetTransitionGUID,
                TransitionTypeEnum.Withdrawed,
                TransitionFlyingTypeEnum.NotFlying,
                base.ActivityResource,
                session);

            //更新撤销节点的状态(从准备状态更新为撤销状态)
            var aim = new ActivityInstanceManager();
            aim.Withdraw(base.BackwardContext.BackwardFromActivityInstance.ID,
                base.ActivityResource.AppRunner, session);

            //构造回调函数需要的数据
            WfExecutedResult result = base.WfExecutedResult;
            result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever;
            result.Status = WfExecutedStatus.Success;
        }
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            WfExecutedResult result = base.WfExecutedResult;

            //回跳类型的处理
            if (base.IsBackward == true)
            {
                //创建新任务节点
                var backMostPreviouslyActivityInstanceID = GetBackwardMostPreviouslyActivityInstanceID();
                var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);

                nodeMediatorBackward.CreateBackwardActivityTaskTransitionInstance(base.BackwardContext.ProcessInstance,
                    base.BackwardContext.BackwardFromActivityInstance,
                    BackwardTypeEnum.Sendback,
                    backMostPreviouslyActivityInstanceID,
                    base.BackwardContext.BackwardToTargetTransitionGUID,
                    TransitionTypeEnum.Sendback,
                    TransitionFlyingTypeEnum.NotFlying,
                    base.ActivityResource,
                    session);

                //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
                var aim = new ActivityInstanceManager();
                aim.SendBack(base.BackwardContext.BackwardFromActivityInstance.ID,
                    base.ActivityResource.AppRunner,
                    session);

                //构造回调函数需要的数据
                result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever;
                result.Status = WfExecutedStatus.Success;
            }
            else
            {
                var jumpActivityGUID = base.AppRunner.NextActivityPerformers.First().Key;
                var jumpforwardActivity = base.ProcessModel.GetActivity(jumpActivityGUID);
                var proecessInstance = (new ProcessInstanceManager()).GetById(base.RunningActivityInstance.ProcessInstanceID);
                var jumpforwardExecutionContext = ActivityForwardContext.CreateJumpforwardContext(jumpforwardActivity,
                    base.ProcessModel, proecessInstance, base.ActivityResource);

                NodeMediator mediator = NodeMediatorFactory.CreateNodeMediator(jumpforwardExecutionContext, session);
                mediator.Linker.FromActivityInstance = base.RunningActivityInstance;
                mediator.Linker.ToActivity = jumpforwardActivity;
                mediator.ExecuteWorkItem();

                result.Status = WfExecutedStatus.Success;
                result.Message = mediator.GetNodeMediatedMessage();
            }
        }