当前位置: 首页>>代码示例>>Java>>正文


Java PvmTransition.getProperty方法代码示例

本文整理汇总了Java中org.activiti.engine.impl.pvm.PvmTransition.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java PvmTransition.getProperty方法的具体用法?Java PvmTransition.getProperty怎么用?Java PvmTransition.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.impl.pvm.PvmTransition的用法示例。


在下文中一共展示了PvmTransition.getProperty方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: nextActivityImpl

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
 * 该服务的私有方法 根据当前节点的底层定义对象,获取所有 当前节点的出线和出线终点,并返回封装后的集合 开发时间:2013-11-29
 * 
 * @param currentTaskDef
 *            当前节点的底层定义
 * @return 节点的出线和出线终点的集合,出线作为key,终点定义对象作为value
 */
public Map<PvmTransition, ActivityImpl> nextActivityImpl(
		ActivityImpl currentTaskDef) {
	Map<PvmTransition, ActivityImpl> result = new HashMap<PvmTransition, ActivityImpl>();
	List<PvmTransition> outTransitions = currentTaskDef
			.getOutgoingTransitions();
	for (PvmTransition tr : outTransitions) {
		PvmActivity ac = tr.getDestination(); // 获取线路的终点节点
		String type = ac.getProperty("type").toString();
		// 过滤掉回退的线,只保留向前流转的线
		Object pvmTransitionType = tr.getProperty("conditionText");
		Object pvmTransitionName = tr.getProperty("name");
		if (type.equals("userTask")) {
			ActivityImpl nextTaskImpl = (ActivityImpl) ac;
			result.put(tr, nextTaskImpl);
		}
	}
	return result;
}
 
开发者ID:lz84,项目名称:bachelor,代码行数:26,代码来源:BpmEngineServiceImpl.java

示例2: getTaskDefinition

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
@Override
public List<TaskDefinition> getTaskDefinition(ActivityImpl activityImpl, String elString) {
    List<TaskDefinition> taskDefinitionList = new ArrayList<>();
    List<TaskDefinition> nextTaskDefinition;
    if ("userTask".equals(activityImpl.getProperty("type"))) {
        TaskDefinition taskDefinition = ((UserTaskActivityBehavior) activityImpl.getActivityBehavior()).getTaskDefinition();
        taskDefinitionList.add(taskDefinition);
    } else {
        List<PvmTransition> pvmTransitions = activityImpl.getOutgoingTransitions();
        List<PvmTransition> outTransitionsTemp;
        for (PvmTransition tr : pvmTransitions) {
            PvmActivity pvmActivity = tr.getDestination(); //获取线路的终点节点
            if ("exclusiveGateway".equals(pvmActivity.getProperty("type")) || "parallelGateway".equals(pvmActivity.getProperty("type"))) {
                outTransitionsTemp = pvmActivity.getOutgoingTransitions();
                if (outTransitionsTemp.size() == 1) {
                    nextTaskDefinition = getTaskDefinition((ActivityImpl) outTransitionsTemp.get(0).getDestination(), elString);
                    taskDefinitionList.addAll(nextTaskDefinition);
                } else if (outTransitionsTemp.size() > 1) {
                    for (PvmTransition tr1 : outTransitionsTemp) {
                        Object s = tr1.getProperty("conditionText");
                        if (elString.equals(s.toString().trim())) {
                            nextTaskDefinition = getTaskDefinition((ActivityImpl) tr1.getDestination(), elString);
                            taskDefinitionList.addAll(nextTaskDefinition);
                        }
                    }
                }
            } else if ("userTask".equals(pvmActivity.getProperty("type"))) {
                taskDefinitionList.add(((UserTaskActivityBehavior) ((ActivityImpl) pvmActivity).getActivityBehavior()).getTaskDefinition());
            }
        }
    }
    return taskDefinitionList;
}
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:34,代码来源:BpmActivityServiceImp.java

示例3: getOutGoingActivityImpl

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
@Override
public ActivityImpl getOutGoingActivityImpl(String bizKey,
		String outGoingTransValue) {
	ProcessInstance pi = getProcessInstancsByBizKey(bizKey);
	if (outGoingTransValue == null || outGoingTransValue.isEmpty())
		return null;
	Map<PvmTransition, ActivityImpl> pvmTrans = this
			.getNextActivityImpl(bizKey);
	ActivityImpl outGoingActivityImpl = null;
	for (PvmTransition trans : pvmTrans.keySet()) {
		// 当节点出线唯一时,直接返回该终点对象
		if (pvmTrans.keySet().size() == 1)
			return pvmTrans.get(trans);
		// 节点出线不唯一时,解析出线表达式,判断节点流转的终点实例
		String pvmTransitionExp = (String) trans
				.getProperty("conditionText");
		if (pvmTransitionExp != null && !pvmTransitionExp.isEmpty()) {
			pvmTransitionExp = pvmTransitionExp.toString().trim();
			String variableValue = StringUtils.substringBeforeLast(
					StringUtils.substringAfterLast(pvmTransitionExp, "=="),
					"}");
			if (variableValue.contains(outGoingTransValue)) {
				outGoingActivityImpl = pvmTrans.get(trans);
			}
		}
	}
	if (outGoingActivityImpl == null) {
		return null;
	} else {
		return outGoingActivityImpl;
	}
}
 
开发者ID:lz84,项目名称:bachelor,代码行数:33,代码来源:BpmEngineServiceImpl.java

示例4: execute

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    activityExecution.inactivate();
    lockConcurrentRoot(activityExecution);

    PvmActivity activity = activityExecution.getActivity();
    if (!activeConcurrentExecutionsExist(activityExecution)) {

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("inclusive gateway '{}' activates", activity.getId());
        }

        List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity);
        String defaultSequenceFlow = (String) activityExecution.getActivity().getProperty("default");
        List<PvmTransition> transitionsToTake = new ArrayList<>();

        for (PvmTransition outgoingTransition : activityExecution.getActivity().getOutgoingTransitions()) {

            Expression skipExpression = outgoingTransition.getSkipExpression();
            if (!SkipExpressionUtil.isSkipExpressionEnabled(activityExecution, skipExpression)) {
                if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) {
                    Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
                    if (condition == null || condition.evaluate(outgoingTransition.getId(), execution)) {
                        transitionsToTake.add(outgoingTransition);
                    }
                }
            } else if (SkipExpressionUtil.shouldSkipFlowElement(activityExecution, skipExpression)) {
                transitionsToTake.add(outgoingTransition);
            }
        }

        if (!transitionsToTake.isEmpty()) {
            activityExecution.takeAll(transitionsToTake, joinedExecutions);

        } else {

            if (defaultSequenceFlow != null) {
                PvmTransition defaultTransition = activityExecution.getActivity().findOutgoingTransition(defaultSequenceFlow);
                if (defaultTransition != null) {
                    activityExecution.take(defaultTransition);
                } else {
                    throw new ActivitiException("Default sequence flow '"
                            + defaultSequenceFlow + "' could not be not found");
                }
            } else {
                // No sequence flow could be found, not even a default one
                throw new ActivitiException(
                        "No outgoing sequence flow of the inclusive gateway '"
                                + activityExecution.getActivity().getId()
                                + "' could be selected for continuing the process");
            }
        }

    } else {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Inclusive gateway '{}' does not activate", activity.getId());
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:61,代码来源:InclusiveGatewayActivityBehavior.java

示例5: leave

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
 * The default behaviour of BPMN, taking every outgoing sequence flow (where the condition evaluates to true), is not valid for an exclusive gateway.
 * 
 * Hence, this behaviour is overridden and replaced by the correct behavior: selecting the first sequence flow which condition evaluates to true (or which hasn't got a condition) and leaving the
 * activity through that sequence flow.
 * 
 * If no sequence flow is selected (ie all conditions evaluate to false), then the default sequence flow is taken (if defined).
 */
@Override
protected void leave(ActivityExecution execution) {

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("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();
        Expression skipExpression = seqFlow.getSkipExpression();

        if (!SkipExpressionUtil.isSkipExpressionEnabled(execution, skipExpression)) {
            Condition condition = (Condition) seqFlow.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
            if ((condition == null && (defaultSequenceFlow == null || !defaultSequenceFlow.equals(seqFlow.getId())))
                    || (condition != null && condition.evaluate(seqFlow.getId(), execution))) {
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Sequence flow '{}' selected as outgoing sequence flow.", seqFlow.getId());
                }
                outgoingSeqFlow = seqFlow;
            }
        } else if (SkipExpressionUtil.shouldSkipFlowElement(execution, skipExpression)) {
            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 ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' not found");
            }
        } else {
            // No sequence flow could be found, not even a default one
            throw new ActivitiException("No outgoing sequence flow of the exclusive gateway '"
                    + execution.getActivity().getId() + "' could be selected for continuing the process");
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:55,代码来源:ExclusiveGatewayActivityBehavior.java

示例6: execute

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
public void execute(ActivityExecution execution) throws Exception { 

    execution.inactivate();
    lockConcurrentRoot(execution);
    
    PvmActivity activity = execution.getActivity();
    if (!activeConcurrentExecutionsExist(execution)) {
      
      if (log.isLoggable(Level.FINE)) {
        log.fine("inclusive gateway '" + activity.getId() + "' activates");
      }
      
      List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
        String defaultSequenceFlow = (String) execution.getActivity().getProperty("default");
        List<PvmTransition> transitionsToTake = new ArrayList<PvmTransition>();

        for (PvmTransition outgoingTransition : execution.getActivity().getOutgoingTransitions()) {
          if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) {
            Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
            if (condition == null || condition.evaluate(execution)) {
              transitionsToTake.add(outgoingTransition);
            }
          }
        }
        
        if (transitionsToTake.size() > 0) {
          execution.takeAll(transitionsToTake, joinedExecutions);

        } else {

          if (defaultSequenceFlow != null) {
            PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
            if (defaultTransition != null) {
              execution.take(defaultTransition);
            } else {
              throw new ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' could not be not found");
            }
          } else {
            // No sequence flow could be found, not even a default one
            throw new ActivitiException("No outgoing sequence flow of the inclusive gateway '" + execution.getActivity().getId()
                    + "' could be selected for continuing the process");
          }
        }
      
    } else {
      if (log.isLoggable(Level.FINE)) {
        log.fine("Inclusive gateway '"+activity.getId()+"' does not activate");
      }
    }
  }
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:51,代码来源:InclusiveGatewayActivityBehavior.java

示例7: leave

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
 * The default behaviour of BPMN, taking every outgoing sequence flow
 * (where the condition evaluates to true), is not valid for an exclusive
 * gateway. 
 * 
 * Hence, this behaviour is overriden and replaced by the correct behavior:
 * selecting the first sequence flow which condition evaluates to true
 * (or which hasn't got a condition) and leaving the activity through that
 * sequence flow. 
 * 
 * If no sequence flow is selected (ie all conditions evaluate to false),
 * then the default sequence flow is taken (if defined).
 */
@Override
protected void leave(ActivityExecution execution) {
  
  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 ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' not found");
      }
    } else {
      //No sequence flow could be found, not even a default one
      throw new ActivitiException("No outgoing sequence flow of the exclusive gateway '"
            + execution.getActivity().getId() + "' could be selected for continuing the process");
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:56,代码来源:ExclusiveGatewayActivityBehavior.java

示例8: performOutgoingBehavior

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
 * Actual implementation of leaving an activity.
 * 
 * @param execution
 *          The current execution context
 * @param checkConditions
 *          Whether or not to check conditions before determining whether or
 *          not to take a transition.
 * @param throwExceptionIfExecutionStuck
 *          If true, an {@link ActivitiException} will be thrown in case no
 *          transition could be found to leave the activity.
 */
protected void performOutgoingBehavior(ActivityExecution execution, 
        boolean checkConditions, boolean throwExceptionIfExecutionStuck, List<ActivityExecution> reusableExecutions) {

  if (log.isLoggable(Level.FINE)) {
    log.fine("Leaving activity '" + execution.getActivity().getId() + "'");
  }

  String defaultSequenceFlow = (String) execution.getActivity().getProperty("default");
  List<PvmTransition> transitionsToTake = new ArrayList<PvmTransition>();

  List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
  for (PvmTransition outgoingTransition : outgoingTransitions) {
    if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) {
      Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
      if (condition == null || !checkConditions || condition.evaluate(execution)) {
        transitionsToTake.add(outgoingTransition);
      }
    }
  }

  if (transitionsToTake.size() == 1) {
    
    execution.take(transitionsToTake.get(0));

  } else if (transitionsToTake.size() >= 1) {

    execution.inactivate();
    if (reusableExecutions == null || reusableExecutions.isEmpty()) {
      execution.takeAll(transitionsToTake, Arrays.asList(execution));
    } else {
      execution.takeAll(transitionsToTake, reusableExecutions);
    }

  } else {

    if (defaultSequenceFlow != null) {
      PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
      if (defaultTransition != null) {
        execution.take(defaultTransition);
      } else {
        throw new ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' could not be not found");
      }
    } else {
      if (log.isLoggable(Level.FINE)) {
        log.fine("No outgoing sequence flow found for " + execution.getActivity().getId() + ". Ending execution.");
      }
      execution.end();
      
      if (throwExceptionIfExecutionStuck) {
        throw new ActivitiException("No outgoing sequence flow of the inclusive gateway '" + execution.getActivity().getId()
              + "' could be selected for continuing the process");
      }
      
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:69,代码来源:BpmnActivityBehavior.java

示例9: drawActivity

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
protected static void drawActivity(ProcessDiagramCanvas processDiagramCanvas, ActivityImpl activity, List<String> highLightedActivities) {
  String type = (String) activity.getProperty("type");
  ActivityDrawInstruction drawInstruction = activityDrawInstructions.get(type);
  if (drawInstruction != null) {

    drawInstruction.draw(processDiagramCanvas, activity);

    // Gather info on the multi instance marker
    boolean multiInstanceSequential = false, multiInstanceParallel = false, collapsed = false;
    String multiInstance = (String) activity.getProperty("multiInstance");
    if (multiInstance != null) {
      if ("sequential".equals(multiInstance)) {
        multiInstanceSequential = true;
      } else {
        multiInstanceParallel = true;
      }
    }

    // Gather info on the collapsed marker
    Boolean expanded = (Boolean) activity.getProperty(BpmnParse.PROPERTYNAME_ISEXPANDED);
    if (expanded != null) {
      collapsed = !expanded;
    }

    // Actually draw the markers
    processDiagramCanvas.drawActivityMarkers(activity.getX(), activity.getY(), activity.getWidth(), activity.getHeight(), multiInstanceSequential,
            multiInstanceParallel, collapsed);

    // Draw highlighted activities
    if (highLightedActivities.contains(activity.getId())) {
      drawHighLight(processDiagramCanvas, activity);
    }

  }

  // Outgoing transitions of activity
  for (PvmTransition sequenceFlow : activity.getOutgoingTransitions()) {
    List<Integer> waypoints = ((TransitionImpl) sequenceFlow).getWaypoints();
    for (int i = 2; i < waypoints.size(); i += 2) { // waypoints.size()
                                                    // minimally 4: x1, y1,
                                                    // x2, y2
      boolean drawConditionalIndicator = (i == 2) && sequenceFlow.getProperty(BpmnParse.PROPERTYNAME_CONDITION) != null
              && !((String) activity.getProperty("type")).toLowerCase().contains("gateway");
      if (i < waypoints.size() - 2) {
        processDiagramCanvas.drawSequenceflowWithoutArrow(waypoints.get(i - 2), waypoints.get(i - 1), waypoints.get(i), waypoints.get(i + 1),
                drawConditionalIndicator);
      } else {
        processDiagramCanvas.drawSequenceflow(waypoints.get(i - 2), waypoints.get(i - 1), waypoints.get(i), waypoints.get(i + 1), drawConditionalIndicator);
      }
    }
  }

  // Nested activities (boundary events)
  for (ActivityImpl nestedActivity : activity.getActivities()) {
    drawActivity(processDiagramCanvas, nestedActivity, highLightedActivities);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:58,代码来源:ProcessDiagramGenerator.java

示例10: execute

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
public void execute(ActivityExecution execution) throws Exception { 
  execution.inactivate();
  lockConcurrentRoot(execution);
  
  PvmActivity activity = execution.getActivity();
  if (!activeConcurrentExecutionsExist(execution)) {
    
    if (log.isLoggable(Level.FINE)) {
      log.fine("inclusive gateway '" + activity.getId() + "' activates");
    }
    
    List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
      String defaultSequenceFlow = (String) execution.getActivity().getProperty("default");
      List<PvmTransition> transitionsToTake = new ArrayList<PvmTransition>();

      for (PvmTransition outgoingTransition : execution.getActivity().getOutgoingTransitions()) {
        if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) {
          Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
          if (condition == null || condition.evaluate(execution)) {
            transitionsToTake.add(outgoingTransition);
          }
        }
      }
      
      if (transitionsToTake.size() > 0) {
        execution.takeAll(transitionsToTake, joinedExecutions);

      } else {

        if (defaultSequenceFlow != null) {
          PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
          if (defaultTransition != null) {
            execution.take(defaultTransition);
          } else {
            throw new ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' could not be not found");
          }
        } else {
          // No sequence flow could be found, not even a default one
          throw new ActivitiException("No outgoing sequence flow of the inclusive gateway '" + execution.getActivity().getId()
                  + "' could be selected for continuing the process");
        }
      }
    
  } else {
    if (log.isLoggable(Level.FINE)) {
      log.fine("Inclusive gateway '"+activity.getId()+"' does not activate");
    }
  }
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:50,代码来源:InclusiveGatewayActivityBehavior.java

示例11: performOutgoingBehavior

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
 * Actual implementation of leaving an activity.
 * 
 * @param execution
 *          The current execution context
 * @param checkConditions
 *          Whether or not to check conditions before determining whether or
 *          not to take a transition.
 * @param throwExceptionIfExecutionStuck
 *          If true, an {@link ActivitiException} will be thrown in case no
 *          transition could be found to leave the activity.
 */
protected void performOutgoingBehavior(ActivityExecution execution, 
        boolean checkConditions, boolean throwExceptionIfExecutionStuck, List<ActivityExecution> reusableExecutions) {

  if (log.isLoggable(Level.FINE)) {
    log.fine("Leaving activity '" + execution.getActivity().getId() + "'");
  }

  String defaultSequenceFlow = (String) execution.getActivity().getProperty("default");
  List<PvmTransition> transitionsToTake = new ArrayList<PvmTransition>();

  List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
  for (PvmTransition outgoingTransition : outgoingTransitions) {
    if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) {
      Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
      if (condition == null || !checkConditions || condition.evaluate(execution)) {
        transitionsToTake.add(outgoingTransition);
      }
    }
  }

  if (transitionsToTake.size() == 1) {
    
    execution.take(transitionsToTake.get(0));

  } else if (transitionsToTake.size() >= 1) {

    execution.inactivate();
    if (reusableExecutions == null || reusableExecutions.isEmpty()) {
      execution.takeAll(transitionsToTake, Arrays.asList(execution));
    } else {
      execution.takeAll(transitionsToTake, reusableExecutions);
    }

  } else {

    if (defaultSequenceFlow != null) {
      PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
      if (defaultTransition != null) {
        execution.take(defaultTransition);
      } else {
        throw new ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' could not be not found");
      }
    } else {
      
      Object isForCompensation = execution.getActivity().getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION);
      if(isForCompensation != null && (Boolean) isForCompensation) {
        
        InterpretableExecution parentExecution = (InterpretableExecution) execution.getParent();
        ((InterpretableExecution)execution).remove();
        parentExecution.signal("compensationDone", null);            
        
      } else {
        
        if (log.isLoggable(Level.FINE)) {
          log.fine("No outgoing sequence flow found for " + execution.getActivity().getId() + ". Ending execution.");
        }
        execution.end();
        
        if (throwExceptionIfExecutionStuck) {
          throw new ActivitiException("No outgoing sequence flow of the inclusive gateway '" + execution.getActivity().getId()
                + "' could be selected for continuing the process");
        }
      }
      
    }
  }
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:80,代码来源:BpmnActivityBehavior.java

示例12: execute

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {

    execution.inactivate();
    lockConcurrentRoot(execution);

    PvmActivity activity = execution.getActivity();
    if (!activeConcurrentExecutionsExist(execution)) {

      if (log.isDebugEnabled()) {
        log.debug("inclusive gateway '{}' activates", activity.getId());
      }

      List<ActivityExecution> joinedExecutions = execution
          .findInactiveConcurrentExecutions(activity);
      String defaultSequenceFlow = (String) execution.getActivity()
          .getProperty("default");
      List<PvmTransition> transitionsToTake = new ArrayList<PvmTransition>();

      for (PvmTransition outgoingTransition : execution.getActivity()
          .getOutgoingTransitions()) {
        if (defaultSequenceFlow == null
            || !outgoingTransition.getId().equals(defaultSequenceFlow)) {
          Condition condition = (Condition) outgoingTransition
              .getProperty(BpmnParse.PROPERTYNAME_CONDITION);
          if (condition == null || condition.evaluate(execution)) {
            transitionsToTake.add(outgoingTransition);
          }
        }
      }

      if (transitionsToTake.size() > 0) {
        execution.takeAll(transitionsToTake, joinedExecutions);

      } else {

        if (defaultSequenceFlow != null) {
          PvmTransition defaultTransition = execution.getActivity()
              .findOutgoingTransition(defaultSequenceFlow);
          if (defaultTransition != null) {
            execution.take(defaultTransition);
          } else {
            throw new ActivitiException("Default sequence flow '"
                + defaultSequenceFlow + "' could not be not found");
          }
        } else {
          // No sequence flow could be found, not even a default one
          throw new ActivitiException(
              "No outgoing sequence flow of the inclusive gateway '"
                  + execution.getActivity().getId()
                  + "' could be selected for continuing the process");
        }
      }

    } else {
      if (log.isDebugEnabled()) {
        log.debug("Inclusive gateway '{}' does not activate", activity.getId());
      }
    }
  }
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:60,代码来源:InclusiveGatewayActivityBehavior.java

示例13: leave

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
 * The default behaviour of BPMN, taking every outgoing sequence flow
 * (where the condition evaluates to true), is not valid for an exclusive
 * gateway. 
 * 
 * Hence, this behaviour is overriden and replaced by the correct behavior:
 * selecting the first sequence flow which condition evaluates to true
 * (or which hasn't got a condition) and leaving the activity through that
 * sequence flow. 
 * 
 * If no sequence flow is selected (ie all conditions evaluate to false),
 * then the default sequence flow is taken (if defined).
 */
@Override
protected void leave(ActivityExecution execution) {
  
  if (log.isDebugEnabled()) {
    log.debug("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.isDebugEnabled()) {
        log.debug("Sequence flow '{}'selected as outgoing sequence flow.", seqFlow.getId());
      }
      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 ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' not found");
      }
    } else {
      //No sequence flow could be found, not even a default one
      throw new ActivitiException("No outgoing sequence flow of the exclusive gateway '"
            + execution.getActivity().getId() + "' could be selected for continuing the process");
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:55,代码来源:ExclusiveGatewayActivityBehavior.java

示例14: performOutgoingBehavior

import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
 * Actual implementation of leaving an activity.
 * 
 * @param execution
 *          The current execution context
 * @param checkConditions
 *          Whether or not to check conditions before determining whether or
 *          not to take a transition.
 * @param throwExceptionIfExecutionStuck
 *          If true, an {@link ActivitiException} will be thrown in case no
 *          transition could be found to leave the activity.
 */
protected void performOutgoingBehavior(ActivityExecution execution, 
        boolean checkConditions, boolean throwExceptionIfExecutionStuck, List<ActivityExecution> reusableExecutions) {

  if (log.isDebugEnabled()) {
    log.debug("Leaving activity '{}'", execution.getActivity().getId());
  }

  String defaultSequenceFlow = (String) execution.getActivity().getProperty("default");
  List<PvmTransition> transitionsToTake = new ArrayList<PvmTransition>();

  List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
  for (PvmTransition outgoingTransition : outgoingTransitions) {
    if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) {
      Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
      if (condition == null || !checkConditions || condition.evaluate(execution)) {
        transitionsToTake.add(outgoingTransition);
      }
    }
  }

  if (transitionsToTake.size() == 1) {
    
    execution.take(transitionsToTake.get(0));

  } else if (transitionsToTake.size() >= 1) {

    execution.inactivate();
    if (reusableExecutions == null || reusableExecutions.isEmpty()) {
      execution.takeAll(transitionsToTake, Arrays.asList(execution));
    } else {
      execution.takeAll(transitionsToTake, reusableExecutions);
    }

  } else {

    if (defaultSequenceFlow != null) {
      PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
      if (defaultTransition != null) {
        execution.take(defaultTransition);
      } else {
        throw new ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' could not be not found");
      }
    } else {
      
      Object isForCompensation = execution.getActivity().getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION);
      if(isForCompensation != null && (Boolean) isForCompensation) {
        
        InterpretableExecution parentExecution = (InterpretableExecution) execution.getParent();
        ((InterpretableExecution)execution).remove();
        parentExecution.signal("compensationDone", null);            
        
      } else {
        
        if (log.isDebugEnabled()) {
          log.debug("No outgoing sequence flow found for {}. Ending execution.", execution.getActivity().getId());
        }
        execution.end();
        
        if (throwExceptionIfExecutionStuck) {
          throw new ActivitiException("No outgoing sequence flow of the inclusive gateway '" + execution.getActivity().getId()
                + "' could be selected for continuing the process");
        }
      }
      
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:80,代码来源:BpmnActivityBehavior.java


注:本文中的org.activiti.engine.impl.pvm.PvmTransition.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。