Esempio n. 1
0
        public int DispatchStartBranchProcessTasks(string ownerActivityID, IWfBranchProcessTemplateDescriptor template, bool autoAddExitMaintainingStatusTask)
        {
            ownerActivityID.CheckStringIsNullOrEmpty("ownerActivityID");
            template.NullCheck("template");

            StartBranchProcessSysTaskProcessBuilder builder = new StartBranchProcessSysTaskProcessBuilder(ownerActivityID, template, autoAddExitMaintainingStatusTask);

            SysTaskProcess sysTaskProcess = builder.Build();

            SysTaskProcessRuntime.StartProcess(sysTaskProcess);

            return(sysTaskProcess.Activities.Count);
        }
Esempio n. 2
0
        public void BuildStartBranchProcessTaskProcessTest()
        {
            IWfProcessDescriptor processDesp = CreateProcessWithAutoMaintainProperty();

            IWfProcess process = WfProcessTestCommon.StartupProcess(processDesp);

            MoveToExecutor(process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            IWfActivity ownerActivity = process.CurrentActivity;

            Console.WriteLine("OwnerActivityID: {0}", ownerActivity.ID);

            //在Template设置资源为一个组织,用于后续分发分支流程的测试
            IWfBranchProcessTemplateDescriptor template = ownerActivity.Descriptor.BranchProcessTemplates[0];

            IUser userInTemplate = template.Resources.ToUsers().FirstOrDefault();

            WfDepartmentResourceDescriptor deptResourceDesp = new WfDepartmentResourceDescriptor(userInTemplate.Parent);

            template.Resources.Clear();
            template.Resources.Add(deptResourceDesp);

            SysTaskAdapter.Instance.ClearAll();

            StartBranchProcessSysTaskProcessBuilder builder = new StartBranchProcessSysTaskProcessBuilder(ownerActivity.ID, template, true);

            SysTaskProcess sysTaskProcess = builder.Build();

            SysTaskProcessRuntime.ClearCache();

            sysTaskProcess = SysTaskProcessRuntime.GetProcessByID(sysTaskProcess.ID);

            Console.WriteLine("SysTaskProcess ID: {0}", sysTaskProcess.ID);
            Console.WriteLine("SysTaskProcess Activities: {0}", sysTaskProcess.Activities.Count);

            Assert.AreEqual(template.Resources.ToUsers().Count + 1, sysTaskProcess.Activities.Count);
        }