sunboy0504
sunboy0504
2013-06-17 11:15
浏览 222
已采纳

jbpm4.3动态路由,提交流程成功却没跳转。

请看代码哪有错误,创建transition 成功 ,执行成功却不跳转。
ProcessEngine processEngine=Constants.getProcessEngine();
EnvironmentFactory environmentFactory = (EnvironmentFactory)processEngine ;
RepositoryService repositoryService = processEngine.getRepositoryService();
ExecutionService executionService = processEngine.getExecutionService();
TaskService taskService = processEngine.getTaskService();
TaskImpl task = (TaskImpl) taskService.getTask(taskId);
Execution execution = executionService.findExecutionById(task.getExecutionId());
EnvironmentImpl env=null;
try {
env = environmentFactory.openEnvironment();
ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)repositoryService.createProcessDefinitionQuery().processDefinitionId(execution.getProcessDefinitionId()).uniqueResult();
//取得当前流程的活动定定义
ActivityImpl sourceActivity = processDefinition.findActivity(taskName);
//取得目标的活动定义
ActivityImpl destActivity=processDefinition.findActivity(destName);
//为两个节点创建连接
TransitionImpl transition = sourceActivity.createOutgoingTransition();
transition.setName(destName);
transition.setDestination(destActivity);
sourceActivity.addOutgoingTransition(transition);
//将流程指定要新建的transition中
processEngine.getExecutionService().signalExecutionById(processEngine.getTaskService().getTask(taskId).getExecutionId(), transition.getName());

       System.out.println("sourceActivity.getName() = "+sourceActivity.getName());
       System.out.println("destActivity.getName() = "+destActivity.getName());
       Map<String, Object> map = new HashMap<String, Object>();
       taskService.completeTask(taskId, destName,map);
   }catch(Exception ex){
       ex.getMessage();
   }finally{  
       env.close();
   }
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • QiangGe2Dai
    QiangGe2Dai 2013-06-17 17:51
    已采纳

    最好把流程定义贴出来看看

    点赞 评论
  • QiangGe2Dai
    QiangGe2Dai 2013-06-18 14:26

    :o 问题都没解决就采纳了?

    点赞 评论

相关推荐