* @see org.fireflow.kernel.event.IEdgeInstanceEventListener#onEdgeInstanceEventFired(org.fireflow.kernel.event.EdgeInstanceEvent)
*/
public void onEdgeInstanceEventFired(EdgeInstanceEvent e) throws KernelException {
if (e.getEventType() == EdgeInstanceEvent.ON_TAKING_THE_TOKEN) {
IToken token = e.getToken();
ITransitionInstance transInst = (ITransitionInstance) e.getSource();
String condition = transInst.getTransition().getCondition();
calculateTheAliveValue(token, condition);
if (rtCtx.isEnableTrace() && token.isAlive()) {
Transition transition = transInst.getTransition();
IWFElement fromNode = transition.getFromNode();
int minorNumber = 1;
if (fromNode instanceof Activity){
minorNumber=2;
}else{
minorNumber =1;
}
ProcessInstanceTrace trace = new ProcessInstanceTrace();
trace.setProcessInstanceId(e.getToken().getProcessInstanceId());
trace.setStepNumber(e.getToken().getStepNumber());
trace.setType(ProcessInstanceTrace.TRANSITION_TYPE);
trace.setFromNodeId(transInst.getTransition().getFromNode().getId());
trace.setToNodeId(transInst.getTransition().getToNode().getId());
trace.setEdgeId(transInst.getTransition().getId());
trace.setMinorNumber(minorNumber);
//TODO wmj2003 这里应该是insert。一旦token从当前边上经过,那么就保存流程运行轨迹.
rtCtx.getPersistenceService().saveOrUpdateProcessInstanceTrace(trace);
}
}