Examples of ActivityImpl


Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

  }

  public static ActivityBehavior getActivityBehavior(PvmExecutionImpl execution) {
    String id = execution.getId();

    ActivityImpl activity = execution.getActivity();
    ensureNotNull(PvmException.class, "Execution '"+id+"' has no current activity.", "activity", activity);

    ActivityBehavior behavior = activity.getActivityBehavior();
    ensureNotNull(PvmException.class, "There is no behavior specified in "+activity+" for execution '"+id+"'.", "behavior", behavior);

    return behavior;
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

    ensureNotNull("Compensating execution not set for compensate event subscription with id " + eventSubscription.getId(), "configuration", configuration);

    ExecutionEntity compensatingExecution = commandContext.getExecutionManager()
      .findExecutionById(configuration);

    ActivityImpl compensationHandler = eventSubscription.getActivity();

    if ((compensationHandler.getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION) == null
      || !(Boolean) compensationHandler.getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION))
      && compensationHandler.isScope()) {

      // activate execution
      compensatingExecution.setActive(true);
      // descend into scope:
      List<CompensateEventSubscriptionEntity> eventsForThisScope = compensatingExecution.getCompensateEventSubscriptions();
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

  private static Logger log = Logger.getLogger(AbstractEventHandler.class.getName());

  public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {

    ExecutionEntity execution = eventSubscription.getExecution();
    ActivityImpl activity = eventSubscription.getActivity();

    ensureNotNull("Error while sending signal for event subscription '" + eventSubscription.getId() + "': "
      + "no activity associated with event subscription", "activity", activity);

    if (payload instanceof Map) {
      @SuppressWarnings("unchecked")
      Map<String, Object> processVariables = (Map<String, Object>) payload;
      execution.setVariables(processVariables);
    }

    ActivityBehavior activityBehavior = activity.getActivityBehavior();
    if (activityBehavior instanceof BoundaryEventActivityBehavior) {

      try {
        execution.executeActivity(activity);

      } catch (RuntimeException e) {
        throw e;
      } catch (Exception e) {
        throw new ProcessEngineException("exception while sending signal for event subscription '" + eventSubscription + "':" + e.getMessage(), e);
      }

    } else if (activityBehavior instanceof EventSubProcessStartEventActivityBehavior) {

      try {
        execution.executeActivity(activity.getParentActivity());

      } catch (RuntimeException e) {
        throw e;
      } catch (Exception e) {
        throw new ProcessEngineException("exception while sending signal for event subscription '" + eventSubscription + "':" + e.getMessage(), e);
      }

    } else { // not boundary
      if (activityBehavior instanceof IntermediateCatchEventActivityBehavior) {
        IntermediateCatchEventActivityBehavior catchBehavior = (IntermediateCatchEventActivityBehavior) activityBehavior;

        if (catchBehavior.isAfterEventBasedGateway()) {
          execution.executeActivity(activity);
          return;
        }
      }

      if (!activity.equals(execution.getActivity())) {
        execution.setActivity(activity);
      }
      execution.signal("signal", null);
    }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

*/
public class SubProcessActivityBehavior extends AbstractBpmnActivityBehavior implements CompositeActivityBehavior {
 
  public void execute(ActivityExecution execution) throws Exception {
    PvmActivity activity = execution.getActivity();
    ActivityImpl initialActivity = (ActivityImpl) activity.getProperty(BpmnParse.PROPERTYNAME_INITIAL);

    ensureNotNull("No initial activity found for subprocess " + execution.getActivity().getId(), "initialActivity", initialActivity);

    execution.executeActivity(initialActivity);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

    processDefinition = new ProcessDefinitionImpl(processDefinitionId);
    scopeStack.push(processDefinition);
  }

  public ProcessDefinitionBuilder createActivity(String id) {
    ActivityImpl activity = scopeStack.peek().createActivity(id);
    scopeStack.push(activity);
    processElement = activity;

    transition = null;
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

  public ProcessDefinitionBuilder startTransition(String destinationActivityId, String transitionId) {
    if (destinationActivityId==null) {
      throw new PvmException("destinationActivityId is null");
    }
    ActivityImpl activity = getActivity();
    transition = activity.createOutgoingTransition(transitionId);
    unresolvedTransitions.add(new Object[]{transition, destinationActivityId});
    processElement = transition;
    return this;
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

  public PvmProcessDefinition buildProcessDefinition() {
    for (Object[] unresolvedTransition: unresolvedTransitions) {
      TransitionImpl transition = (TransitionImpl) unresolvedTransition[0];
      String destinationActivityName = (String) unresolvedTransition[1];
      ActivityImpl destination = processDefinition.findActivity(destinationActivityName);
      if (destination == null) {
        throw new RuntimeException("destination '"+destinationActivityName+"' not found.  (referenced from transition in '"+transition.getSource().getId()+"')");
      }
      transition.setDestination(destination);
    }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

    return superExecution;
  }

  private static void executeCatch(String errorHandlerId, ActivityExecution execution) {
    ProcessDefinitionImpl processDefinition = ((ExecutionEntity) execution).getProcessDefinition();
    ActivityImpl errorHandler = processDefinition.findActivity(errorHandlerId);
    ensureNotNull(errorHandlerId + " not found in process definition", "errorHandler", errorHandler);

    boolean matchingParentFound = false;
    ActivityExecution leavingExecution = execution;
    ActivityImpl currentActivity = (ActivityImpl) execution.getActivity();

    ScopeImpl catchingScope = errorHandler.getParent();
    if (catchingScope instanceof ActivityImpl) {
      ActivityImpl catchingScopeActivity = (ActivityImpl) catchingScope;
      if (!catchingScopeActivity.isScope()) { // event subprocesses
        catchingScope = catchingScopeActivity.getParent();
      }
    }

    if (catchingScope instanceof PvmProcessDefinition) {
      executeEventHandler(errorHandler, ((ExecutionEntity) execution).getProcessInstance());
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

  protected void createCompensateEventSubscription(ActivityExecution execution) {
    String compensationHandlerId = (String) execution.getActivity().getProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID);

    ExecutionEntity executionEntity = (ExecutionEntity) execution;
    ActivityImpl compensationHandlder = executionEntity.getProcessDefinition().findActivity(compensationHandlerId);
    PvmScope scopeActivitiy = compensationHandlder.getParent();
    ExecutionEntity scopeExecution = ScopeUtil.findScopeExecutionForScope(executionEntity, scopeActivitiy);

    CompensateEventSubscriptionEntity compensateEventSubscriptionEntity = CompensateEventSubscriptionEntity.createAndInsert(scopeExecution);
    compensateEventSubscriptionEntity.setActivity(compensationHandlder);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl

    if (scopeActivity instanceof PvmProcessDefinition) {
      return execution.getProcessInstance();

    } else {

      ActivityImpl currentActivity = execution.getActivity();
      ExecutionEntity candiadateExecution = null;
      ExecutionEntity originalExecution = execution;

      while (execution != null) {
        currentActivity = execution.getActivity();
        if (scopeActivity.getActivities().contains(currentActivity) /* does not search rec*/
                || scopeActivity.equals(currentActivity)) {
          // found a candidate execution; lets still check whether we find an
          // execution which is also sitting in an activity part of this scope
          // higher up the hierarchy
          candiadateExecution = execution;
        } else if (currentActivity!= null
                && currentActivity.contains((ActivityImpl)scopeActivity) /*searches rec*/) {
          // now we're too "high", the candidate execution is the one.
          break;
        }

        execution = execution.getParent();
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.