Java Code Examples for org.activiti.engine.delegate.DelegateExecution#getParent()

The following examples show how to use org.activiti.engine.delegate.DelegateExecution#getParent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParallelGatewayActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected boolean isChildOfMultiInstanceExecution(DelegateExecution executionEntity, DelegateExecution multiInstanceExecution) {
  boolean isChild = false;
  DelegateExecution parentExecution = executionEntity.getParent();
  if (parentExecution != null) {
    if (parentExecution.getId().equals(multiInstanceExecution.getId())) {
      isChild = true;
    } else {
      boolean isNestedChild = isChildOfMultiInstanceExecution(parentExecution, multiInstanceExecution);
      if (isNestedChild) {
        isChild = true;
      }
    }
  }

  return isChild;
}
 
Example 2
Source File: ParallelGatewayActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected DelegateExecution findMultiInstanceParentExecution(DelegateExecution execution) {
  DelegateExecution multiInstanceExecution = null;
  DelegateExecution parentExecution = execution.getParent();
  if (parentExecution != null && parentExecution.getCurrentFlowElement() != null) {
    FlowElement flowElement = parentExecution.getCurrentFlowElement();
    if (flowElement instanceof Activity) {
      Activity activity = (Activity) flowElement;
      if (activity.getLoopCharacteristics() != null) {
        multiInstanceExecution = parentExecution;
      }
    }

    if (multiInstanceExecution == null) {
      DelegateExecution potentialMultiInstanceExecution = findMultiInstanceParentExecution(parentExecution);
      if (potentialMultiInstanceExecution != null) {
        multiInstanceExecution = potentialMultiInstanceExecution;
      }
    }
  }

  return multiInstanceExecution;
}
 
Example 3
Source File: MultiInstanceActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected Integer getLoopVariable(DelegateExecution execution, String variableName) {
  Object value = execution.getVariableLocal(variableName);
  DelegateExecution parent = execution.getParent();
  while (value == null && parent != null) {
    value = parent.getVariableLocal(variableName);
    parent = parent.getParent();
  }
  return (Integer) (value != null ? value : 0);
}
 
Example 4
Source File: MultiInstanceActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected DelegateExecution getMultiInstanceRootExecution(DelegateExecution executionEntity) {
  DelegateExecution multiInstanceRootExecution = null;
  DelegateExecution currentExecution = executionEntity;
  while (currentExecution != null  && multiInstanceRootExecution == null && currentExecution.getParent() != null) {
    if (currentExecution.isMultiInstanceRoot()) {
      multiInstanceRootExecution = currentExecution;
    } else {
      currentExecution = currentExecution.getParent();
    }
  }
  return multiInstanceRootExecution;
}