예제 #1
0
        public void ProcessDefinition_Test()
        {
            BpmConfiguration bpmConfiguration = BpmConfiguration.CreateInstance();

            //获取BPM上下文
            BpmContext bpmContext = bpmConfiguration.CreateBpmContext().SetCurrentActor("lhs");

            //发布流程定义
            var path = "D:\\main.xml";
            var processDefinition1 = bpmContext.deployProcessDefinition(path);

            //加载流程定义
            var processDefinitionId = 1;
            var processDefinition2  = bpmContext.loadProcessDefinition(processDefinitionId);



            //获取流程定义

            //ProcessDefinition processDefinition1 = ProcessDefinition.LoadProcessDefinition(path);

            //var processDefinitionId = "PD001";
            // ProcessDefinition processDefinition2 = ProcessDefinition.LoadProcessDefinitionById(processDefinitionId); 注释2013-01-28

            //获取Id
            //var Id = processDefinition1.getProcessDefinitionModel().Id;

            //创建流程实例
            //ProcessInstance processInstance = processDefinition1.CreateProcessInstance();
        }
예제 #2
0
        public void BpmContext_Test()
        {
            //获取BPM配置
            BpmConfiguration bpmConfiguration = BpmConfiguration.CreateInstance();

            //获取BPM上下文
            BpmContext bpmContext = bpmConfiguration.CreateBpmContext();

            bpmContext.SetCurrentActor("lhs");


            //发布工作流
            var path             = @"G:\01.开发框架\BS\Zcloud.MVC_2.0\ZCloud.Web\Zephyr.Framework\Zephyr.WorkFlow\Test\TestFlow.xml";
            ProcessDefinition pd = bpmContext.deployProcessDefinition(path);

            //获取流程实例
            //var processDefinitionName = "主流程";
            //ProcessInstance processInstance1 = bpmContext.newProcessInstance(processDefinitionName);

            var             processInstanceId = 1;
            ProcessInstance processInstance2  = bpmContext.loadProcessInstance(processInstanceId);

            processInstance2.start();

            ////获取工作项定义
            //var actorId = "lhs";
            //IList<Task> taskList1 = bpmContext.getTaskList(actorId);
            ////IList<Task> taskList2 = bpmContext.getTaskList();

            //IList actors = new ArrayList();
            //actors.Add("lhs");
            //actors.Add("yrh");
            //IList taskList3 = bpmContext.getGroupTaskList(actors);

            ////获取工作项实例
            //var taskInstanceId = "1";
            //TaskInstance taskInstance1 = bpmContext.loadTaskInstance(taskInstanceId);
            ////TaskInstance taskInstance2 = bpmContext.loadTaskInstanceForUpdate(taskInstanceId); //没实现

            ////获取令牌
            //var tokenId = "1";
            //Token token1 = bpmContext.loadToken(tokenId);
            ////Token token2 = bpmContext.loadTokenForUpdate(tokenId);



            ////保存工作项实例
            //TaskInstance updateTaskInstance = taskInstance1;
            //bpmContext.save(updateTaskInstance);

            ////保存令牌
            //Token updateToken = token1;
            //bpmContext.save(token1);

            ////保存流程实例
            //ProcessInstance updateProcessInstance = processInstance1;
            //bpmContext.save(updateProcessInstance);
        }