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


Java ActivityImpl.createOutgoingTransition方法代码示例

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


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

示例1: executeParse

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
@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);

}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:32,代码来源:SequenceFlowParseHandler.java

示例2: startTransition

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:11,代码来源:ProcessDefinitionBuilder.java

示例3: reject

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
@Override
public void reject(String taskId) {
    // 先判定是否存在历史环节
    String oldTaskId = selectVariableLocalByTaskId(taskId, "oldTaskId").toString();
    HistoricTaskInstance taskInstance = historyService.createHistoricTaskInstanceQuery().taskId(oldTaskId).singleResult();
    if (taskInstance == null) {
        throw new NotFoundException("历史任务环节不存在,taskId:" + oldTaskId);
    }

    Task task = selectTaskByTaskId(taskId);

    ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
    if (processInstance == null) {
        throw new NotFoundException("流程已经结束");
    }

    Map<String, Object> variables = processInstance.getProcessVariables();

    ProcessDefinitionEntity definition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(task.getProcessDefinitionId());
    if (definition == null) {
        throw new NotFoundException("流程定义未找到");
    }

    ActivityExecution execution = (ActivityExecution) runtimeService.createExecutionQuery()
            .executionId(task.getExecutionId()).singleResult();
    // 是否并行节点
    if (execution.isConcurrent()) {
        throw new NotFoundException("并行节点不允许驳回,taskId:" + task.getId());
    }

    // 是否存在定时任务
    long num = managementService.createJobQuery().executionId(task.getExecutionId()).count();
    if (num > 0) {
        throw new NotFoundException("当前环节不允许驳回");
    }

    // 驳回


    // 取得上一步活动
    ActivityImpl currActivity = definition.findActivity(task.getTaskDefinitionKey());
    List<PvmTransition> nextTransitionList = currActivity.getIncomingTransitions();
    // 清除当前活动的出口
    List<PvmTransition> oriPvmTransitionList = new ArrayList<>();
    List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
    oriPvmTransitionList.addAll(pvmTransitionList);
    pvmTransitionList.clear();

    // 建立新出口
    List<TransitionImpl> newTransitions = new ArrayList<>();
    for (PvmTransition nextTransition : nextTransitionList) {
        PvmActivity nextActivity = nextTransition.getSource();
        ActivityImpl nextActivityImpl = definition.findActivity(nextActivity.getId());
        TransitionImpl newTransition = currActivity.createOutgoingTransition();
        newTransition.setDestination(nextActivityImpl);
        newTransitions.add(newTransition);
    }
    // 完成任务
    List<Task> tasks = taskService.createTaskQuery()
            .processInstanceId(processInstance.getId())
            .taskDefinitionKey(task.getTaskDefinitionKey()).list();
    for (Task t : tasks) {
        taskService.complete(t.getId(), variables);
        historyService.deleteHistoricTaskInstance(t.getId());
    }
    // 恢复方向
    for (TransitionImpl transitionImpl : newTransitions) {
        currActivity.getOutgoingTransitions().remove(transitionImpl);
    }
    pvmTransitionList.addAll(oriPvmTransitionList);

}
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:73,代码来源:BpmTaskServiceImp.java


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