Java Code Examples for org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution#getParent()

The following examples show how to use org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution#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: InclusiveGatewayActivityBehavior.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected boolean activatesGateway(ActivityExecution execution, PvmActivity gatewayActivity) {
  int numExecutionsGuaranteedToActivate = gatewayActivity.getIncomingTransitions().size();
  ActivityExecution scopeExecution = execution.isScope() ? execution : execution.getParent();

  List<ActivityExecution> executionsAtGateway = execution.findInactiveConcurrentExecutions(gatewayActivity);

  if (executionsAtGateway.size() >= numExecutionsGuaranteedToActivate) {
    return true;
  }
  else {
    Collection<ActivityExecution> executionsNotAtGateway = getLeafExecutions(scopeExecution);
    executionsNotAtGateway.removeAll(executionsAtGateway);

    for (ActivityExecution executionNotAtGateway : executionsNotAtGateway) {
      if (canReachActivity(executionNotAtGateway, gatewayActivity)) {
        return false;
      }
    }

    // if no more token may arrive, then activate
    return true;
  }

}
 
Example 2
Source File: AbstractBpmnActivityBehavior.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void signalCompensationDone(ActivityExecution execution) {
  // default behavior is to join compensating executions and propagate the signal if all executions have compensated

  // only wait for non-event-scope executions cause a compensation event subprocess consume the compensation event and
  // do not have to compensate embedded subprocesses (which are still non-event-scope executions)

  if(((PvmExecutionImpl) execution).getNonEventScopeExecutions().isEmpty()) {
    if(execution.getParent() != null) {
      ActivityExecution parent = execution.getParent();
      execution.remove();
      parent.signal(SIGNAL_COMPENSATION_DONE, null);
    }
  } else {
    ((ExecutionEntity)execution).forceUpdate();
  }

}
 
Example 3
Source File: ParallelMultiInstanceActivityBehavior.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public void destroyInnerInstance(ActivityExecution concurrentExecution) {

  ActivityExecution scopeExecution = concurrentExecution.getParent();
  concurrentExecution.remove();
  scopeExecution.forceUpdate();

  int nrOfActiveInstances = getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES);
  setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfActiveInstances - 1);

}
 
Example 4
Source File: GatewayActivityBehavior.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void lockConcurrentRoot(ActivityExecution execution) {
  ActivityExecution concurrentRoot = null;
  if (execution.isConcurrent()) {
    concurrentRoot = execution.getParent();
  } else {
    concurrentRoot = execution;
  }
  ((ExecutionEntity)concurrentRoot).forceUpdate();
}
 
Example 5
Source File: BpmnActivityBehavior.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected boolean isAncestorCompensationThrowing(ActivityExecution execution) {
  ActivityExecution parent = execution.getParent();
  while (parent != null) {
    if (CompensationBehavior.isCompensationThrowing((PvmExecutionImpl) parent)) {
      return true;
    }
    parent = parent.getParent();
  }
  return false;
}