Java Code Examples for org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity#isConcurrent()

The following examples show how to use org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity#isConcurrent() . 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: VariableInstanceHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public void handle(MigratingInstanceParseContext parseContext, MigratingProcessElementInstance owningInstance, List<VariableInstanceEntity> variables) {

  ExecutionEntity representativeExecution = owningInstance.resolveRepresentativeExecution();

  for (VariableInstanceEntity variable : variables) {
    parseContext.consume(variable);
    boolean isConcurrentLocalInParentScope =
         (variable.getExecution() == representativeExecution.getParent() && variable.isConcurrentLocal())
      || representativeExecution.isConcurrent();
    owningInstance.addMigratingDependentInstance(new MigratingVariableInstance(variable, isConcurrentLocalInParentScope));
  }
}
 
Example 2
Source File: TransitionInstanceHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected List<VariableInstanceEntity> collectTransitionInstanceVariables(MigratingTransitionInstance instance) {
  List<VariableInstanceEntity> variables = new ArrayList<VariableInstanceEntity>();
  ExecutionEntity representativeExecution = instance.resolveRepresentativeExecution();

  if (representativeExecution.isConcurrent()) {
    variables.addAll(representativeExecution.getVariablesInternal());
  }
  else {
    variables.addAll(ActivityInstanceHandler.getConcurrentLocalVariables(representativeExecution));
  }

  return variables;
}
 
Example 3
Source File: ActivityInstanceHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected List<VariableInstanceEntity> collectActivityInstanceVariables(MigratingActivityInstance instance) {
  List<VariableInstanceEntity> variables = new ArrayList<VariableInstanceEntity>();
  ExecutionEntity representativeExecution = instance.resolveRepresentativeExecution();
  ExecutionEntity parentExecution = representativeExecution.getParent();

  // decide for representative execution and parent execution whether to none/all/concurrentLocal variables
  // belong to this activity instance
  boolean addAllRepresentativeExecutionVariables = instance.getSourceScope().isScope()
      || representativeExecution.isConcurrent();

  if (addAllRepresentativeExecutionVariables) {
    variables.addAll(representativeExecution.getVariablesInternal());
  }
  else {
    variables.addAll(getConcurrentLocalVariables(representativeExecution));
  }

  boolean addAnyParentExecutionVariables = parentExecution != null && instance.getSourceScope().isScope();
  if (addAnyParentExecutionVariables) {
    boolean addAllParentExecutionVariables = parentExecution.isConcurrent();

    if (addAllParentExecutionVariables) {
      variables.addAll(parentExecution.getVariablesInternal());
    }
    else {
      variables.addAll(getConcurrentLocalVariables(parentExecution));
    }
  }

  return variables;
}
 
Example 4
Source File: MigratingActivityInstance.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public void migrateState() {
  ExecutionEntity currentScopeExecution = resolveRepresentativeExecution();
  currentScopeExecution.setProcessDefinition(targetScope.getProcessDefinition());

  ExecutionEntity parentExecution = currentScopeExecution.getParent();

  if (parentExecution != null && parentExecution.isConcurrent()) {
    parentExecution.setProcessDefinition(targetScope.getProcessDefinition());
  }

  currentScope = targetScope;

  if (!targetScope.isScope()) {
    becomeNonScope();
    currentScopeExecution = resolveRepresentativeExecution();
  }

  if (isLeafActivity(targetScope)) {
    currentScopeExecution.setActivity((PvmActivity) targetScope);
  }

  if (sourceScope.getActivityBehavior() instanceof MigrationObserverBehavior) {
    ((MigrationObserverBehavior) sourceScope.getActivityBehavior()).migrateScope(currentScopeExecution);
  }

  migrateHistory(currentScopeExecution);
}
 
Example 5
Source File: MigratingActivityInstance.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public void destroyAttachableExecution(ExecutionEntity execution) {

  if (currentScope.getActivityBehavior() instanceof ModificationObserverBehavior) {
    ModificationObserverBehavior behavior = (ModificationObserverBehavior) currentScope.getActivityBehavior();
    behavior.destroyInnerInstance(execution);
  }
  else {
    if (execution.isConcurrent()) {
      execution.remove();
      execution.getParent().tryPruneLastConcurrentChild();
      execution.getParent().forceUpdate();
    }
  }
}
 
Example 6
Source File: ModificationUtil.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public static void handleChildRemovalInScope(ExecutionEntity removedExecution) {
  ActivityImpl activity = removedExecution.getActivity();
  if (activity == null) {
    if (removedExecution.getSuperExecution() != null) {
      removedExecution = removedExecution.getSuperExecution();
      activity = removedExecution.getActivity();
      if (activity == null) {
        return;
      }
    } else {
      return;
    }
  }
  ScopeImpl flowScope = activity.getFlowScope();

  PvmExecutionImpl scopeExecution = removedExecution.getParentScopeExecution(false);
  PvmExecutionImpl executionInParentScope = removedExecution.isConcurrent() ? removedExecution : removedExecution.getParent();

  if (flowScope.getActivityBehavior() != null && flowScope.getActivityBehavior() instanceof ModificationObserverBehavior) {
    // let child removal be handled by the scope itself
    ModificationObserverBehavior behavior = (ModificationObserverBehavior) flowScope.getActivityBehavior();
    behavior.destroyInnerInstance(executionInParentScope);
  }
  else {
    if (executionInParentScope.isConcurrent()) {
      executionInParentScope.remove();
      scopeExecution.tryPruneLastConcurrentChild();
      scopeExecution.forceUpdate();
    }
  }
}