JDPM 简单实例

<?xml version="1.0" encoding="UTF-8"?> <process name="helloworld" xmlns="http://jbpm.org/4.4/jpdl"> <start name="start1" g="228,53,48,48"> <transition name="to state1" to="state1" g="-59,-17"/> </start> <state name="state1" g="208,138,92,52"> <transition name="to state2" to="state2" g="-59,-17"/> </state> <state name="state2" g="208,223,92,52"> <transition name="to end1" to="end1" g="-47,-17"/> </state> <end name="end1" g="233,308,48,48"/> </process>

ProcessEngine processEngine = Configuration.getProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); // 部署流程定义 repositoryService.createDeployment().addResourceFromClasspath("cn/jbpm/test/helloworld.jpdl.xml").deploy(); ExecutionService executionService = processEngine.getExecutionService(); // 开始流程实例 ProcessInstance processInstance = executionService.startProcessInstanceByKey("helloworld"); System.out.println(processInstance.isActive("start"));// false System.out.println(processInstance.isActive("state1"));//true System.out.println("xxxxxxxx 进入到state1 xxxxxxxxxxx"); ProcessInstance instanceState1 = executionService.signalExecutionById(processInstance.getId(),"to state2"); System.out.println(instanceState1.isActive("state1"));//false System.out.println(instanceState1.isActive("state2"));//true System.out.println("xxxxxxxx 进入到state2 xxxxxxxxxxx"); ProcessInstance instanceState2 = executionService.signalExecutionById(instanceState1.getId(),"to end1"); System.out.println(instanceState2.isActive("state2"));//false System.out.println(instanceState2.isEnded());//true

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值