求教高手一个问题 transition 上的 condition 可以自己计算吗?
feng198526
2012-07-07
ExecutionImpl execution = (ExecutionImpl) executionService.findExecutionById(executionId); ActivityImpl clerkOpinionActivityImpl = execution.getActivity(); List listadd = new ArrayList(); List list = clerkOpinionActivityImpl.getOutgoingTransitions(); for (Iterator iterator = list.iterator(); iterator.hasNext();) { Transition ts = (Transition) iterator.next(); if (ts.getDestination().getType().equalsIgnoreCase("task")) { //TODO 对task进行解析 } else if (ts.getDestination().getType().equalsIgnoreCase("decision")) { //TODO 对decision进行解析 要走的那个transition 的下一个节点 Activity activity = ts.getDestination(); List<TransitionImpl> outgoingTransitions = (List) activity.getOutgoingTransitions(); for (TransitionImpl transition : outgoingTransitions) { Condition condition = transition.getCondition(); //TODO 怎么解析condition condition.evaluate(execution)报错误 因为还没有到这个节点 if ((condition == null) || (condition.evaluate(execution))) { return null; } } } } return null; 麻烦大家帮忙看下啊 比较急 |
|
feng198526
2012-07-07
Condition condition = transition.getCondition();
ExpressionCondition expressionCondition = (ExpressionCondition) condition; Expression ex = Expression.create(expressionCondition.getExpression(), expressionCondition.getLanguage()); UelValueExpression uel = (UelValueExpression) ex; Object o = uel.evaluateInScope(execution); sorry 自己犯2了 这样就可以了 |