/** event-scope executions are not considered in this mapping and must be ignored */
 protected boolean isLeaf(ExecutionEntity execution) {
   if (CompensationBehavior.isCompensationThrowing(execution)) {
     return true;
   } else {
     return !execution.isEventScope() && execution.getNonEventScopeExecutions().isEmpty();
   }
 }
  protected ExecutionEntity createMissingTargetFlowScopeExecution(
      ExecutionEntity parentScopeExecution, PvmActivity targetFlowScope) {
    ExecutionEntity newParentExecution = parentScopeExecution;
    if (!parentScopeExecution.getNonEventScopeExecutions().isEmpty()
        || parentScopeExecution.getActivity() != null) {
      newParentExecution = (ExecutionEntity) parentScopeExecution.createConcurrentExecution();
    }

    List<PvmActivity> scopesToInstantiate = new ArrayList<PvmActivity>();
    scopesToInstantiate.add(targetFlowScope);
    newParentExecution.createScopes(scopesToInstantiate);
    ExecutionEntity targetFlowScopeExecution =
        newParentExecution
            .getExecutions()
            .get(0); // TODO: this does not work for more than one scope

    targetFlowScopeExecution.setActivity(null);

    return targetFlowScopeExecution;
  }