JBPM 任务随你查.
javaeye_jbpm
2007-04-12
/**
* @param transition * @param processInstance * @return 返回下一可用任务节点(任务节点/结束节点); */ public org.jbpm.graph.def.Node getNextTaskNode(Transition transition, ProcessInstance processInstance,JbpmContext cxt) { System.out.println("Find Next-Node..."); long processDefinitionID = processInstance.getProcessDefinition() .getId(); String regex = getNodeInfo(processDefinitionID, getGBK(transition .getTo().getName())); //流程已结束. if(regex.equals("0")){ System.out.println("找到流程结束节点."); return (new org.jbpm.graph.node.EndState()); } // 如果是任务节点 if (regex.equals("7")) { TaskNode task = (TaskNode)cxt.getSession().load(TaskNode.class, transition.getTo()); return task; } if (regex == null) { return null; } else { ExecutionContext ec = new ExecutionContext(processInstance.getRootToken()); Transition nextTransition = null; if (regex.startsWith("decision:")) { String express = regex.substring(regex.indexOf("decision:") + 9, regex.length()); System.out.println("getNextTaskNode-Decision表达式:"+express); String lev = JbpmExpressionEvaluator.evaluate(express, ec).toString(); nextTransition = transition.getTo().getLeavingTransition(lev); System.out.println("getNextTaskNode-Decision表达式 分析结果:"+nextTransition.getName()); } else { nextTransition = transition.getTo().getDefaultLeavingTransition(); System.out.println("getNextTaskNode-Decision 默认"+nextTransition.getName()); } return getNextTaskNode(nextTransition, processInstance,cxt); } } 这个方法,返回流程的一下可用.任务节点. |