コード例 #1
0
        public void AddApproverReturnTest()
        {
            IWfProcessDescriptor processDesp = ReturnExecutorTestHelper.PrepareAddApproverReturnProcessDesp();

            IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);

            Assert.AreEqual("B", process.CurrentActivity.Descriptor.Key);

            WfAddApproverExecutor executor = new WfAddApproverExecutor(process.CurrentActivity, process.CurrentActivity);
            executor.Assignees.Add((IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object);

            executor.ExecuteNotPersist();

            Assert.AreEqual(6, process.Activities.Count, "加签后变成6个活动");

            WfProcessTestCommon.MoveToNextDefaultActivity(process);	//B的衍生点
            Assert.AreEqual("B", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);	//C的衍生点
            Assert.AreEqual("C", process.CurrentActivity.Descriptor.Key);

            ReturnExecutorTestHelper.ExecuteReturnOperation(process.CurrentActivity, "B");

            Assert.AreEqual(8, process.Activities.Count, "退回后8个活动");
            Assert.AreEqual("B", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);	//C的衍生点
            Assert.AreEqual("C", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);	//D
            Assert.AreEqual("D", process.CurrentActivity.Descriptor.Key);
        }
コード例 #2
0
        public WfExecutorBase CreateExecutor()
        {
            WfExecutorBase executor = null;

            switch (this.OperationType)
            {
                case WfControlOperationType.MoveTo:
                    executor = new WfMoveToExecutor(
                        WfClientContext.Current.OriginalActivity,
                        WfClientContext.Current.OriginalActivity, ToTransferParams(),
                        WfClientContext.Current.Locks);
                    break;
                case WfControlOperationType.Consign:
                    {
                        WfAssigneeCollection assignees = new WfAssigneeCollection();

                        WfAssignee assignee = new WfAssignee(WfClientContext.Current.User);

                        assignees.Add(assignee);

                        executor = new WfConsignExecutor(
                            WfClientContext.Current.OriginalActivity,
                            WfClientContext.Current.OriginalActivity,
                            assignees,
                            this.Assignees.ToUsers(),
                            this.Circulators.ToUsers(),
                            BlockingType,
                            SequenceType);
                    }
                    break;
                case WfControlOperationType.Return:
                    if (this._RejectMode == WfRejectMode.LikeAddApprover)
                        executor = new WfAddApproverExecutor(WfClientContext.Current.CurrentActivity, WfClientContext.Current.CurrentActivity.Process.Activities.FindActivityByDescriptorKey(TargetActivityDescriptor.Key));
                    else
                        executor = new WfReturnExecutor(WfClientContext.Current.CurrentActivity, WfClientContext.Current.CurrentActivity.Process.Activities.FindActivityByDescriptorKey(TargetActivityDescriptor.Key));
                    break;
                default:
                    throw new WfRuntimeException(Translator.Translate(Define.DefaultCulture, "不能处理操作类型为{0}", this.OperationType));
            }

            return executor;
        }