ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();
ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();
ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processInstance.getProcessDefinitionId());
ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);
TokenEntity tokenEntity = processInstanceImpl.getTokenMap().get(tokenId);
processInstanceImpl.getContextInstance().setTransientVariableMap(transientVariables);
if(nodeId==null){
Event event=(Event)tokenEntity.getFlowNode();
if(event instanceof BoundaryEvent){
BoundaryEvent boundaryEvent=(BoundaryEvent)event;
Activity activity =boundaryEvent.getAttachedToRef();
boolean isCancelActivity=boundaryEvent.isCancelActivity();
if(isCancelActivity){
//如果是终止事件 则结束进入节点的时候的散发的所有子令牌 然后将父令牌 移动到超时节点往下进行
tokenEntity.signalKillChildMoveParentToken(boundaryEvent,activity);
}
else{
//如果不是终止事件 则默认方法驱动令牌
tokenEntity.signal();
}
}
if(event instanceof CatchEvent){
tokenEntity.signal();
}
}
else{
BaseElement baseElement=processDefinition.getDefinitions().getElement(nodeId);
if(baseElement instanceof BoundaryEvent){
BoundaryEvent boundaryEvent=(BoundaryEvent)baseElement;
Activity activity =boundaryEvent.getAttachedToRef();
//String nodeTokenId = this.getId();