Examples of PvmExecutionImpl


Examples of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl

  }

  protected abstract void concurrentExecutionCreated(PvmExecutionImpl propagatingExecution);

  protected PvmExecutionImpl createConcurrentExecution(PvmExecutionImpl execution, ActivityImpl concurrentActivity) {
    PvmExecutionImpl newConcurrentExecution = execution.createExecution();
    newConcurrentExecution.setActivity(concurrentActivity);
    newConcurrentExecution.setScope(false);
    newConcurrentExecution.setActive(true);
    newConcurrentExecution.setConcurrent(true);
    return newConcurrentExecution;
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl

      if (parentActivityBehavior instanceof CompositeActivityBehavior) {
        CompositeActivityBehavior compositeActivityBehavior = (CompositeActivityBehavior) parentActivity.getActivityBehavior();

        if(activity.isScope() && activity.getOutgoingTransitions().isEmpty()) {
          // there is no transition destroying the scope
          PvmExecutionImpl parentScopeExecution = execution.getParent();
          execution.destroy();
          execution.remove();
          parentScopeExecution.setActivity(parentActivity);
          compositeActivityBehavior.lastExecutionEnded(parentScopeExecution);
        } else {
          execution.setActivity(parentActivity);
          compositeActivityBehavior.lastExecutionEnded(execution);
        }
      } else {
        // default destroy scope behavior
        PvmExecutionImpl parentScopeExecution = execution.getParent();
        execution.destroy();
        execution.remove();
        // if we are a scope under the process instance
        // and have no outgoing transitions: end the process instance here
        if(activity.getParent() == activity.getProcessDefinition()
                && activity.getOutgoingTransitions().isEmpty()) {
          parentScopeExecution.setActivity(activity);
          // we call end() because it sets isEnded on the execution
          parentScopeExecution.performOperation(PROCESS_END);
        } else {
          parentScopeExecution.setActivity(parentActivity);
          parentScopeExecution.performOperation(ACTIVITY_NOTIFY_LISTENER_END);
        }
      }

    } else { // execution.isConcurrent() && !execution.isScope()

      execution.remove();

      // prune if necessary
      PvmExecutionImpl concurrentRoot = execution.getParent();
      if (concurrentRoot.getExecutions().size()==1) {
        PvmExecutionImpl lastConcurrent = concurrentRoot.getExecutions().get(0);
        if (!lastConcurrent.isScope()) {
          concurrentRoot.setActivity(lastConcurrent.getActivity());
          lastConcurrent.setReplacedBy(concurrentRoot);

          // Move children of lastConcurrent one level up
          if (lastConcurrent.getExecutions().size() > 0) {
            concurrentRoot.getExecutions().clear();
            for (PvmExecutionImpl childExecution : lastConcurrent.getExecutions()) {
              ((List)concurrentRoot.getExecutions()).add(childExecution); // casting ... damn generics
              childExecution.setParent(concurrentRoot);
            }
            lastConcurrent.getExecutions().clear();
          }

          // Copy execution-local variables of lastConcurrent
          concurrentRoot.setVariablesLocal(lastConcurrent.getVariablesLocal());

          // Make sure parent execution is re-activated when the last concurrent child execution is active
          if (!concurrentRoot.isActive() && lastConcurrent.isActive()) {
            concurrentRoot.setActive(true);
          }

          lastConcurrent.remove();
        } else {
          lastConcurrent.setConcurrent(false);
        }
      }
    }
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl

    // we are continuing execution along this sequence flow:
    // reset activity instance id before creating the scope
    execution.setActivityInstanceId(execution.getParentActivityInstanceId());

    PvmExecutionImpl propagatingExecution = null;
    ActivityImpl activity = execution.getActivity();
    if (activity.isScope()) {
      propagatingExecution = execution.createExecution();
      propagatingExecution.setActivity(activity);
      propagatingExecution.setTransition(execution.getTransition());
      execution.setTransition(null);
      execution.setActive(false);
      execution.setActivity(null);
      log.fine("create scope: parent "+execution+" continues as execution "+propagatingExecution);
      propagatingExecution.initialize();

    } else {
      propagatingExecution = execution;
    }

    propagatingExecution.performOperation(TRANSITION_NOTIFY_LISTENER_START);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl

  public boolean isAsync(PvmExecutionImpl execution) {
    return false;
  }

  public void execute(PvmExecutionImpl execution) {
    PvmExecutionImpl firstLeaf = findFirstLeaf(execution);

    // propagate skipCustomListeners property
    PvmExecutionImpl deleteRoot = getDeleteRoot(execution);
    if(deleteRoot != null) {
      firstLeaf.setSkipCustomListeners(deleteRoot.isSkipCustomListeners());
    }

    if (firstLeaf.getSubProcessInstance()!=null) {
      firstLeaf.getSubProcessInstance().deleteCascade(execution.getDeleteReason(), firstLeaf.isSkipCustomListeners());
    }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl

  protected void eventNotificationsCompleted(PvmExecutionImpl execution) {

    // hack around execution tree structure not being in sync with activity instance concept:
    // if we start a scope activity, remember current activity instance in parent
    PvmExecutionImpl parent = execution.getParent();
    ActivityImpl activity = execution.getActivity();
    if(parent != null && execution.isScope() && activity.isScope() && (activity.getActivityBehavior() instanceof CompositeActivityBehavior)) {
      parent.setActivityInstanceId(execution.getActivityInstanceId());
    }

  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl

  @SuppressWarnings("unchecked")
  public void execute(PvmExecutionImpl execution) {

    // calculate the propagating execution
    PvmExecutionImpl propagatingExecution = null;

    ActivityImpl activity = execution.getActivity();
    // if this transition is crossing a scope boundary
    if (activity.isScope()) {

      PvmExecutionImpl parentScopeInstance = null;
      // if this is a concurrent execution crossing a scope boundary
      if (execution.isConcurrent() && !execution.isScope()) {
        // first remove the execution from the current root
        PvmExecutionImpl concurrentRoot = execution.getParent();
        parentScopeInstance = execution.getParent().getParent();

        log.fine("moving concurrent "+execution+" one scope up under "+parentScopeInstance);
        List<PvmExecutionImpl> parentScopeInstanceExecutions = (List<PvmExecutionImpl>) parentScopeInstance.getExecutions();
        List<PvmExecutionImpl> concurrentRootExecutions = (List<PvmExecutionImpl>) concurrentRoot.getExecutions();
        // if the parent scope had only one single scope child
        if (parentScopeInstanceExecutions.size()==1) {
          // it now becomes a concurrent execution
          parentScopeInstanceExecutions.get(0).setConcurrent(true);
        }

        concurrentRootExecutions.remove(execution);
        parentScopeInstanceExecutions.add(execution);
        execution.setParent(parentScopeInstance);
        execution.setActivity(activity);
        propagatingExecution = execution;

        // if there is only a single concurrent execution left
        // in the concurrent root, auto-prune it.  meaning, the
        // last concurrent child execution data should be cloned into
        // the concurrent root.
        if (concurrentRootExecutions.size()==1) {
          PvmExecutionImpl lastConcurrent = concurrentRootExecutions.get(0);
          if (lastConcurrent.isScope()) {
            lastConcurrent.setConcurrent(false);

          } else {
            log.fine("merging last concurrent "+lastConcurrent+" into concurrent root "+concurrentRoot);

            // We can't just merge the data of the lastConcurrent into the concurrentRoot.
            // This is because the concurrent root might be in a takeAll-loop.  So the
            // concurrent execution is the one that will be receiving the take
            concurrentRoot.setActivity(lastConcurrent.getActivity());
            concurrentRoot.setActive(lastConcurrent.isActive());
            lastConcurrent.setReplacedBy(concurrentRoot);
            lastConcurrent.remove();
          }
        }

      } else if (execution.isConcurrent() && execution.isScope()) {
        log.fine("scoped concurrent "+execution+" becomes concurrent and remains under "+execution.getParent());
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl

  protected PvmExecutionImpl eventNotificationsStarted(PvmExecutionImpl execution) {

    // hack around execution tree structure not being in sync with activity instance concept:
    // if we end a scope activity, take remembered activity instance from parent and set on
    // execution before calling END listeners.
    PvmExecutionImpl parent = execution.getParent();
    ActivityImpl activity = execution.getActivity();
    if (parent != null && execution.isScope() &&
        activity != null && activity.isScope() &&
        (activity.getActivityBehavior() instanceof CompositeActivityBehavior)) {

      if(log.isLoggable(Level.FINE)) {
        log.fine("[LEAVE] "+ execution + ": "+execution.getActivityInstanceId() );
      }

      // use remembered activity instance id from parent
      execution.setActivityInstanceId(parent.getActivityInstanceId());
      // make parent go one scope up.
      parent.leaveActivityInstance();

    }

    return execution;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.