Package org.camunda.bpm.engine.impl.pvm

Examples of org.camunda.bpm.engine.impl.pvm.PvmTransition


    PvmActivity end = processDefinition.findActivity("end");
    assertNotNull(end);
    assertEquals("end", end.getId());
   
    PvmTransition transition = outgoingTransitions.get(0);
    assertEquals("flow1", transition.getId());
    assertEquals("Flow One", transition.getProperty("name"));
    assertEquals("The only transitions in the process", transition.getProperty("documentation"));
    assertSame(start, transition.getSource());
    assertSame(end, transition.getDestination());
   
    repositoryService.deleteDeployment(deploymentId);
  }
View Full Code Here


* @author Tom Baeyens
*/
public class Noop implements ActivityBehavior {

  public void execute(ActivityExecution execution) throws Exception {
    PvmTransition transition = execution.getActivity().getOutgoingTransitions().get(0);
    execution.take(transition);
  }
View Full Code Here

   
    if (log.isLoggable(Level.FINE)) {
      log.fine("Leaving activity '" + execution.getActivity().getId() + "'");
    }
   
    PvmTransition outgoingSeqFlow = null;
    String defaultSequenceFlow = (String) execution.getActivity().getProperty("default");
    Iterator<PvmTransition> transitionIterator = execution.getActivity().getOutgoingTransitions().iterator();
    while (outgoingSeqFlow == null && transitionIterator.hasNext()) {
      PvmTransition seqFlow = transitionIterator.next();
     
      Condition condition = (Condition) seqFlow.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
      if ( (condition == null && (defaultSequenceFlow == null || !defaultSequenceFlow.equals(seqFlow.getId())) )
              || (condition != null && condition.evaluate(execution)) ) {
        if (log.isLoggable(Level.FINE)) {
          log.fine("Sequence flow '" + seqFlow.getId() + " '"
                  + "selected as outgoing sequence flow.");
        }
        outgoingSeqFlow = seqFlow;
      }
    }
   
    if (outgoingSeqFlow != null) {
      execution.take(outgoingSeqFlow);
    } else {
     
      if (defaultSequenceFlow != null) {
        PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
        if (defaultTransition != null) {
          execution.take(defaultTransition);
        } else {
          throw new ProcessEngineException("Default sequence flow '" + defaultSequenceFlow + "' not found");
        }
View Full Code Here

    this.from = from;
    this.to = to;
  }

  public void execute(ActivityExecution execution) throws Exception {
    PvmTransition more = execution.getActivity().findOutgoingTransition("more");
    PvmTransition done = execution.getActivity().findOutgoingTransition("done");
   
    Integer value = (Integer) execution.getVariable(variableName);

    if (value==null) {
      execution.setVariable(variableName, from);
View Full Code Here

  public void execute(ActivityExecution execution) throws Exception {
  }

  public void signal(ActivityExecution execution, String signalName, Object signalData) throws Exception {
    PvmTransition transition = execution.getActivity().getOutgoingTransitions().get(0);
    execution.take(transition);
  }
View Full Code Here

      }

      // if none found, add default flow
      if (transitionsToTake.isEmpty()) {
        if (defaultSequenceFlow != null) {
          PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
          if (defaultTransition == null) {
            throw new ProcessEngineException("Default sequence flow '" + defaultSequenceFlow + "' could not be not found");
          }

          transitionsToTake.add(defaultTransition);
View Full Code Here

      for (ActivityExecution concurrentExecution : getLeaveExecutions(execution.getParent())) {
        if (concurrentExecution.isActive()) {

          // TODO: when is transitionBeingTaken cleared? Should we clear it?
          boolean reachable = false;
          PvmTransition pvmTransition = ((ExecutionEntity) concurrentExecution).getTransitionBeingTaken();
          if (pvmTransition != null) {
            reachable = isReachable(pvmTransition.getDestination(), activity, new HashSet<PvmActivity>());
          } else {
            reachable = isReachable(concurrentExecution.getActivity(), activity, new HashSet<PvmActivity>());
          }

          if (reachable) {
View Full Code Here

public class ThrowsExceptionBehavior implements ActivityBehavior {

  public void execute(ActivityExecution execution) throws Exception {
    String var = (String) execution.getVariable("var");

    PvmTransition transition = null;
    try {
      executeLogic(var);
      transition = execution.getActivity().findOutgoingTransition("no-exception");
    } catch (Exception e) {
      transition = execution.getActivity().findOutgoingTransition("exception");
View Full Code Here

      }

    } else {

      if (defaultSequenceFlow != null) {
        PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
        if (defaultTransition != null) {
          execution.take(defaultTransition);
        } else {
          throw new ProcessEngineException("Default sequence flow '" + defaultSequenceFlow + "' could not be not found");
        }
View Full Code Here

  public void validateExclusiveGateway(ActivityImpl activity) {
    if (activity.getOutgoingTransitions().size()==0) {
      // TODO: double check if this is valid (I think in Activiti yes, since we need start events we will need an end event as well)
      addError("Exclusive Gateway '" + activity.getId() + "' has no outgoing sequence flows.", null);
    } else if (activity.getOutgoingTransitions().size()==1) {
      PvmTransition flow = activity.getOutgoingTransitions().get(0);
      Condition condition = (Condition) flow.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
      if (condition!=null) {
        addError("Exclusive Gateway '" + activity.getId() + "' has only one outgoing sequence flow ('" + flow.getId() + "'). This is not allowed to have a condition.", null);
      }
    } else {
      String defaultSequenceFlow = (String) activity.getProperty("default");
      boolean hasDefaultFlow = defaultSequenceFlow!=null && defaultSequenceFlow.length()>0;

      ArrayList<PvmTransition> flowsWithoutCondition = new ArrayList<PvmTransition>();
      for (PvmTransition flow : activity.getOutgoingTransitions()) {
          Condition condition = (Condition) flow.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
          boolean isDefaultFlow = flow.getId()!=null && flow.getId().equals(defaultSequenceFlow);
          boolean hasConditon = condition!=null;

          if (!hasConditon && !isDefaultFlow) {
            flowsWithoutCondition.add(flow);
          }
          if (hasConditon && isDefaultFlow) {
            addError("Exclusive Gateway '" + activity.getId() + "' has outgoing sequence flow '" + flow.getId() + "' which is the default flow but has a condition too.", null);
          }
      }
      if (hasDefaultFlow || flowsWithoutCondition.size()>1) {
        // if we either have a default flow (then no flows without conditions are valid at all) or if we have more than one flow without condition this is an error
        for (PvmTransition flow : flowsWithoutCondition) {
          addError("Exclusive Gateway '" + activity.getId() + "' has outgoing sequence flow '" + flow.getId() + "' without condition which is not the default flow.", null);
        }
      } else if (flowsWithoutCondition.size()==1) {
        // Havinf no default and exactly one flow without condition this is considered the default one now (to not break backward compatibility)
        PvmTransition flow = flowsWithoutCondition.get(0);
        addWarning("Exclusive Gateway '" + activity.getId() + "' has outgoing sequence flow '" + flow.getId() + "' without condition which is not the default flow. We assume it to be the default flow, but it is bad modeling practice, better set the default flow in your gateway.", null);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.impl.pvm.PvmTransition

Copyright © 2018 www.massapicom. 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.