Examples of PvmTransition


Examples of org.activiti.engine.impl.pvm.PvmTransition

            throw new IllegalStateException(
                    "start activity outgoing transitions cannot more than 1, now is : "
                            + startActivity.getOutgoingTransitions().size());
        }

        PvmTransition pvmTransition = startActivity.getOutgoingTransitions()
                .get(0);
        PvmActivity targetActivity = pvmTransition.getDestination();

        if (!"userTask".equals(targetActivity.getProperty("type"))) {
            logger.debug("first activity is not userTask, just skip");

            return;
View Full Code Here

Examples of org.activiti.engine.impl.pvm.PvmTransition

                throw new IllegalStateException(
                        "start activity outgoing transitions cannot more than 1, now is : "
                                + startActivity.getOutgoingTransitions().size());
            }

            PvmTransition pvmTransition = startActivity
                    .getOutgoingTransitions().get(0);
            PvmActivity targetActivity = pvmTransition.getDestination();

            if (!"userTask".equals(targetActivity.getProperty("type"))) {
                logger.info("first activity is not userTask, just skip");
            } else {
                String taskDefinitionKey = targetActivity.getId();
View Full Code Here

Examples of org.activiti.engine.impl.pvm.PvmTransition

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

Examples of org.activiti.engine.impl.pvm.PvmTransition

 
      log.fine("recyclable executions for reuse: " + recyclableExecutions);
     
      // first create the concurrent executions
      while (!transitions.isEmpty()) {
        PvmTransition outgoingTransition = transitions.remove(0);

        ExecutionEntity outgoingExecution = null;
        if (recyclableExecutions.isEmpty()) {
          outgoingExecution = concurrentRoot.createExecution();
          log.fine("new "+outgoingExecution+" with parent "
View Full Code Here

Examples of org.activiti.engine.impl.pvm.PvmTransition

  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

Examples of org.activiti.engine.impl.pvm.PvmTransition

public class ThrowsExceptionBehavior implements ActivityBehavior {

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

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

Examples of org.activiti.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

Examples of org.activiti.engine.impl.pvm.PvmTransition

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

  public void execute(ActivityExecution execution) throws Exception {
    PvmTransition transition;
    String creditRating = (String) execution.getVariable("creditRating");
    if (creditRating.equals("AAA+")) {
      transition = execution.getActivity().findOutgoingTransition("wow");
    } else if (creditRating.equals("Aaa-")) {
      transition = execution.getActivity().findOutgoingTransition("nice");
View Full Code Here

Examples of org.activiti.engine.impl.pvm.PvmTransition

    //Code logic:
    //Check the first activity if it is a startEvent, if not check out the startEvent's highlight outgoing flow.
    HistoricActivityInstance firstHistActInst = hisActInstList.getFirst();
    String firstActType = (String) firstHistActInst.getActivityType();
    if (firstActType != null && firstActType.toLowerCase().indexOf("startevent") < 0){
      PvmTransition startTrans = getStartTransaction(startEventActList, firstHistActInst);
      if (startTrans != null){
        highLightedFlows.add(startTrans.getId());
      }
    }
     
    while (!hisActInstList.isEmpty()) {
      HistoricActivityInstance histActInst = hisActInstList.removeFirst();
View Full Code Here

Examples of org.activiti.engine.impl.pvm.PvmTransition

   */
  private List<String> getHighlightedFlows(List<PvmTransition> pvmTransitionList, LinkedList<HistoricActivityInstance> hisActInstList, boolean isParallel){
     
    List<String> highLightedFlowIds = new ArrayList<String>();
     
    PvmTransition earliestTrans = null;
    HistoricActivityInstance earliestHisActInst = null;
   
    for (PvmTransition pvmTransition : pvmTransitionList) {
                       
      String destActId = pvmTransition.getDestination().getId();
      HistoricActivityInstance destHisActInst = findHisActInst(hisActInstList, destActId);
      if (destHisActInst != null) {
        if (isParallel) {
          highLightedFlowIds.add(pvmTransition.getId());
        } else if (earliestHisActInst == null || (earliestHisActInst.getId().compareTo(destHisActInst.getId()) > 0)) {
          earliestTrans = pvmTransition;
          earliestHisActInst = destHisActInst;
        }
      }
    }
   
    if ((!isParallel) && earliestTrans!=null){
      highLightedFlowIds.add(earliestTrans.getId());
    }
   
    return highLightedFlowIds;
  }
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.