问题描述
请看代码哪有错误,创建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(); }
解决方案
最好把流程定义贴出来看看
解决方案二:
问题都没解决就采纳了?