if (enterTransInstanceCount == 0) {//检查流程定义是否合法,同步器节点必须有输入边
throw new EngineException(this.getId(), this.getWorkflowProcess(),
synchInst.getSynchronizer().getId(), "The process definition [" + this.getName() + "] is invalid,the synchronizer[" + synchInst.getSynchronizer() + "] has no entering transition");
}
IPersistenceService persistenceService = rtCtx.getPersistenceService();
//保存到数据库
persistenceService.saveOrUpdateToken(token);
IJoinPoint resultJoinPoint = null;
resultJoinPoint = new JoinPoint();
resultJoinPoint.setProcessInstance(this);
resultJoinPoint.setSynchronizerId(synchInst.getSynchronizer().getId());
if (enterTransInstanceCount == 1) {
// 生成一个不存储到数据库中的JoinPoint
resultJoinPoint.addValue(token.getValue());
if (token.isAlive()) {
resultJoinPoint.setAlive(true);
resultJoinPoint.setFromActivityId(token.getFromActivityId());
}
resultJoinPoint.setStepNumber(token.getStepNumber() + 1);
return resultJoinPoint;
} else {
int stepNumber = 0;
List<IToken> tokensList_0 = persistenceService.findTokensForProcessInstance(this.getId(), synchInst.getSynchronizer().getId());
Map<String,IToken> tokensMap = new HashMap<String,IToken>();
for (int i = 0; i < tokensList_0.size(); i++) {
IToken tmpToken = tokensList_0.get(i);
String tmpFromActivityId = tmpToken.getFromActivityId();
if (!tokensMap.containsKey(tmpFromActivityId)) {