Java Code Examples for org.activiti.engine.impl.pvm.process.ActivityImpl#createOutgoingTransition()

The following examples show how to use org.activiti.engine.impl.pvm.process.ActivityImpl#createOutgoingTransition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActivitiWorkFlowServiceImpl.java    From maven-framework-project with MIT License 6 votes vote down vote up
public void turnTransition(String taskId, String activityId,  
        Map<String, Object> variables) throws Exception {  
    // 当前节点  
    ActivityImpl currActivity = findActivitiImpl(taskId, null);  
    // 清空当前流向  
    List<PvmTransition> oriPvmTransitionList = clearTransition(currActivity);  
  
    // 创建新流向  
    TransitionImpl newTransition = currActivity.createOutgoingTransition();  
    // 目标节点  
    ActivityImpl pointActivity = findActivitiImpl(taskId, activityId);  
    // 设置新流向的目标节点  
    newTransition.setDestination(pointActivity);  
  
    // 执行转向任务  
    taskService.complete(taskId, variables);  
    // 删除目标节点新流入  
    pointActivity.getIncomingTransitions().remove(newTransition);  
  
    // 还原以前流向  
    restoreTransition(currActivity, oriPvmTransitionList);  
}
 
Example 2
Source File: ProcessCustomService.java    From maven-framework-project with MIT License 6 votes vote down vote up
/** 
 * 流程转向操作 
 *  
 * @param taskId 
 *            当前任务ID 
 * @param activityId 
 *            目标节点任务ID 
 * @param variables 
 *            流程变量 
 * @throws Exception 
 */  
private static void turnTransition(String taskId, String activityId,  
        Map<String, Object> variables) throws Exception {  
    // 当前节点  
    ActivityImpl currActivity = findActivitiImpl(taskId, null);  
    // 清空当前流向  
    List<PvmTransition> oriPvmTransitionList = clearTransition(currActivity);  
  
    // 创建新流向  
    TransitionImpl newTransition = currActivity.createOutgoingTransition();  
    // 目标节点  
    ActivityImpl pointActivity = findActivitiImpl(taskId, activityId);  
    // 设置新流向的目标节点  
    newTransition.setDestination(pointActivity);  
  
    // 执行转向任务  
    taskService.complete(taskId, variables);  
    // 删除目标节点新流入  
    pointActivity.getIncomingTransitions().remove(newTransition);  
  
    // 还原以前流向  
    restoreTransition(currActivity, oriPvmTransitionList);  
}
 
Example 3
Source File: ProcessExtensionServiceImpl.java    From activiti-demo with Apache License 2.0 6 votes vote down vote up
/**
 * 流程转向操作
 * @param taskId 当前任务ID
 * @param activityId 目标节点任务ID
 * @param variables  流程变量
 * @throws Exception
 */
private void turnTransition(String taskId,String activityId,Map<String,Object> variables)throws Exception{
    //当前节点
    ActivityImpl currActivity = findActivitiImpl(taskId,null);
    //清空当前流向
    List<PvmTransition> oriPvmTransitionList =  clearTransition(currActivity);

    //创建新流向
    TransitionImpl newTransition = currActivity.createOutgoingTransition();

    //目标节点
    ActivityImpl pointActivity = findActivitiImpl(taskId,activityId);

    //设置新流向的目标节点
    newTransition.setDestination(pointActivity);

    //执行转向任务
    taskService.complete(taskId,variables);

    //删除目标节点新流入
    pointActivity.getIncomingTransitions().remove(newTransition);

}
 
Example 4
Source File: ProcessDefinitionBuilder.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: SequenceFlowParseHandler.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
protected void executeParse(BpmnParse bpmnParse, SequenceFlow sequenceFlow) {

    ScopeImpl scope = bpmnParse.getCurrentScope();

    ActivityImpl sourceActivity = scope.findActivity(sequenceFlow.getSourceRef());
    ActivityImpl destinationActivity = scope.findActivity(sequenceFlow.getTargetRef());

    Expression skipExpression;
    if (StringUtils.isNotEmpty(sequenceFlow.getSkipExpression())) {
        ExpressionManager expressionManager = bpmnParse.getExpressionManager();
        skipExpression = expressionManager.createExpression(sequenceFlow.getSkipExpression());
    } else {
        skipExpression = null;
    }

    TransitionImpl transition = sourceActivity.createOutgoingTransition(sequenceFlow.getId(), skipExpression);
    bpmnParse.getSequenceFlows().put(sequenceFlow.getId(), transition);
    transition.setProperty("name", sequenceFlow.getName());
    transition.setProperty("documentation", sequenceFlow.getDocumentation());
    transition.setDestination(destinationActivity);

    if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) {
        Condition expressionCondition = new UelExpressionCondition(sequenceFlow.getConditionExpression());
        transition.setProperty(PROPERTYNAME_CONDITION_TEXT, sequenceFlow.getConditionExpression());
        transition.setProperty(PROPERTYNAME_CONDITION, expressionCondition);
    }

    createExecutionListenersOnTransition(bpmnParse, sequenceFlow.getExecutionListeners(), transition);

}