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

The following examples show how to use org.flowable.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: MultiInstanceActivityBehavior.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected Integer getLocalLoopVariable(DelegateExecution execution, String variableName) {
    Map<String, Object> localVariables = execution.getVariablesLocal();
    if (localVariables.containsKey(variableName)) {
        return (Integer) execution.getVariableLocal(variableName);
        
    } else if (!execution.isMultiInstanceRoot()) {
        DelegateExecution parentExecution = execution.getParent();
        localVariables = parentExecution.getVariablesLocal();
        if (localVariables.containsKey(variableName)) {
            return (Integer) parentExecution.getVariableLocal(variableName);
            
        } else if (!parentExecution.isMultiInstanceRoot()) {
            DelegateExecution superExecution = parentExecution.getParent();
            return (Integer) superExecution.getVariableLocal(variableName);
            
        } else {
            return null;
        }
        
    } else {
        return null;
    }
}
 
Example 2
Source File: ParallelGatewayActivityBehavior.java    From flowable-engine 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 3
Source File: ParallelGatewayActivityBehavior.java    From flowable-engine 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 4
Source File: MultiInstanceActivityBehavior.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
public 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 5
Source File: MultiInstanceActivityBehavior.java    From flowable-engine 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;
}