Example #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();
        }
Example #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);
        }
        internal ProcessDefinition(BpmContext bpmContext,string xmlString)
        {
            _bpmContext = bpmContext;
            _nodeReader = new NodeReader(this, xmlString);
            _model = new wf_processDefinition() { 
                Xml = xmlString,
                Name = _nodeReader._name,
                Description = _nodeReader._description,
                Version = bpmContext.getProcessDefinitionNextVersion(_nodeReader._name),
                EffectiveDate = DateTime.Now,
                Status = "1"
            };

            _model.Id = bpmContext.save(this);
        }
        internal ProcessDefinition(BpmContext bpmContext, string xmlString)
        {
            _bpmContext = bpmContext;
            _nodeReader = new NodeReader(this, xmlString);
            _model      = new wf_processDefinition()
            {
                Xml           = xmlString,
                Name          = _nodeReader._name,
                Description   = _nodeReader._description,
                Version       = bpmContext.getProcessDefinitionNextVersion(_nodeReader._name),
                EffectiveDate = DateTime.Now,
                Status        = "1"
            };

            _model.Id = bpmContext.save(this);
        }
 internal ProcessDefinition(BpmContext bpmContext,wf_processDefinition dataProcessDefinition)
 {
     _bpmContext = bpmContext;
     _nodeReader = new NodeReader(this, dataProcessDefinition.Xml);
     _model = dataProcessDefinition;
 }
 internal ProcessDefinition(BpmContext bpmContext, wf_processDefinition dataProcessDefinition)
 {
     _bpmContext = bpmContext;
     _nodeReader = new NodeReader(this, dataProcessDefinition.Xml);
     _model      = dataProcessDefinition;
 }