Flowable-6.7.2 源码注释地址:https://github.com/solojin/flowable-6.7.2-annotated
InclusiveGatewayActivityBehavior 包容网关活动行为类
/**
* 包容网关活动行为类
* Implementation of the Inclusive Gateway/OR gateway/inclusive data-based gateway as defined in the BPMN specification.
*
* @author Tijs Rademakers
* @author Tom Van Buskirk
* @author Joram Barrez
*/
public class InclusiveGatewayActivityBehavior extends GatewayActivityBehavior implements InactiveActivityBehavior {
private static final long serialVersionUID = 1L;
private static final Logger LOGGER = LoggerFactory.getLogger(InclusiveGatewayActivityBehavior.class.getName());
@Override
public void execute(DelegateExecution execution) {
// 加入包容网关的工作如下:
// 当执行进入时,它将被停止。
//
// 所有未激活的执行都保留在包容性网关中,直到所有可以到达包容性网关的执行都到达它。
//
// 在执行更改时重复此检查,直到未激活执行离开网关。
execution.inactivate();
executeInclusiveGatewayLogic((ExecutionEntity) execution, false);
}
@Override
public void executeInactive(ExecutionEntity executionEntity) {
executeInclusiveGatewayLogic(executionEntity, true);
}
protected void executeInclusiveGatewayLogic(ExecutionEntity execution, boolean inactiveCheck) {
CommandContext commandContext = Context.getCommandContext();
ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext);
lockFirstParentScope(execution);
Collection<ExecutionEntity> allExecutions = executionEntityManager.findChildExecutionsByProcessInstanceId(execution.getProcessInstanceId());
Iterator<ExecutionEntity> executionIterator = allExecutions.iterator();
boolean oneExecutionCanReachGatewayInstance = false;
while (!oneExecutionCanReachGatewayInstance && executionIterator.hasNext()) {
ExecutionEntity executionEntity = executionIterator.next();
if (!executionEntity.getActivityId().equals(execution.getCurrentActivityId())) {
if (ExecutionGraphUtil.isReachable(execution.getProcessDefinitionId(), executionEntity.getActivityId(), execution.getCurrentActivityId())) {
// 在相同的执行路径中检查
if (executionEntity.getParentId().equals(