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


Java ActivityImpl.getOutgoingTransitions方法代码示例

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


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

示例1: getHighlightedFlows

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
private void getHighlightedFlows(List<ActivityImpl> activityList) {
    for (ActivityImpl activity : activityList) {
        if (activity.getProperty("type").equals("subProcess")) {
            // get flows for the subProcess
            getHighlightedFlows(activity.getActivities());
        }

        if (historicActivityInstanceList.contains(activity.getId())) {
            List<PvmTransition> pvmTransitionList = activity
                    .getOutgoingTransitions();

            for (PvmTransition pvmTransition : pvmTransitionList) {
                String destinationFlowId = pvmTransition.getDestination()
                        .getId();

                if (historicActivityInstanceList
                        .contains(destinationFlowId)) {
                    highLightedFlows.add(pvmTransition.getId());
                }
            }
        }
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:24,代码来源:BpmResource.java

示例2: getNextActivities

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
@Override
    public List<TaskDefinition> getNextActivities(String procDefId, String activityId) {
        ActivityImpl activity;
        if (activityId != null) {
            activity = getActivityById(procDefId, activityId);
        } else {
            activity = getStartEvent(procDefId);
        }

        List<PvmTransition> pvmTransitions = activity.getOutgoingTransitions();

        return pvmTransitions.stream()
                .map(PvmTransition::getDestination)
                .map(ActivityImpl.class::cast)          //强转为ActivityImpl
                .filter(Objects::nonNull)
                .map(act -> getTaskDefinition(act, "")) //获取TaskDefinition集合
                .flatMap(Collection::stream)            //合并集合
                .collect(Collectors.toList());

//        List<TaskDefinition> taskDefinitions = new ArrayList<>();
//        for (PvmTransition pvmTransition : pvmTransitions) {
//            PvmActivity pvmActivity = pvmTransition.getDestination();
//            taskDefinitions.addAll(getTaskDefinition((ActivityImpl) pvmActivity, ""));
//        }
//        return taskDefinitions;
    }
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:27,代码来源:BpmActivityServiceImp.java

示例3: testParseNamespaceInConditionExpressionType

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
@Deployment
public void testParseNamespaceInConditionExpressionType() {
    ProcessDefinition processDefinition = processEngineConfiguration.getFlowable5CompatibilityHandler().getProcessDefinitionByKey("resolvableNamespacesProcess");
    ProcessDefinitionEntity rawEntity = (ProcessDefinitionEntity) processDefinition;

    // Test that the process definition has been deployed
    assertNotNull(rawEntity);
    ActivityImpl activity = rawEntity.findActivity("ExclusiveGateway_1");
    assertNotNull(activity);

    // Test that the conditions has been resolved
    for (PvmTransition transition : activity.getOutgoingTransitions()) {
        if (transition.getDestination().getId().equals("Task_2")) {
            assertEquals("#{approved}", transition.getProperty("conditionText"));
        } else if (transition.getDestination().getId().equals("Task_3")) {
            assertEquals("#{!approved}", transition.getProperty("conditionText"));
        } else {
            fail("Something went wrong");
        }

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

示例4: getTaskDefinition

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

示例5: getHighLightedFlows

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
/**
 * 获取需要高亮的线,如果其他方法需要调用 重构到RuntimePageService
 *
 * @param processDefinitionEntity
 * @param historicActivityInstances
 * @return
 */
private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinitionEntity,
                                         List<HistoricActivityInstance> historicActivityInstances) {
    List<String> highFlows = new ArrayList<>();// 用以保存高亮的线flowId
    for (int i = 0; i < historicActivityInstances.size() - 1; i++) {// 对历史流程节点进行遍历
        ActivityImpl activityImpl = processDefinitionEntity.findActivity(historicActivityInstances.get(i)
                .getActivityId());// 得到节点定义的详细信息
        List<ActivityImpl> sameStartTimeNodes = new ArrayList<>();// 用以保存后需开始时间相同的节点
        ActivityImpl sameActivityImpl1 = processDefinitionEntity.findActivity(historicActivityInstances.get(i + 1)
                .getActivityId());
        // 将后面第一个节点放在时间相同节点的集合里
        sameStartTimeNodes.add(sameActivityImpl1);
        for (int j = i + 1; j < historicActivityInstances.size() - 1; j++) {
            HistoricActivityInstance activityImpl1 = historicActivityInstances.get(j);// 后续第一个节点
            HistoricActivityInstance activityImpl2 = historicActivityInstances.get(j + 1);// 后续第二个节点
           //if (activityImpl1.getStartTime().equals(activityImpl2.getStartTime())) {
                // 如果第一个节点和第二个节点开始时间相同保存
                ActivityImpl sameActivityImpl2 = processDefinitionEntity.findActivity(activityImpl2.getActivityId
                        ());
                sameStartTimeNodes.add(sameActivityImpl2);
            /*} else {
                // 有不相同跳出循环
                break;
            }*/
        }
        List<PvmTransition> pvmTransitions = activityImpl.getOutgoingTransitions();// 取出节点的所有出去的线
        for (PvmTransition pvmTransition : pvmTransitions) {
            // 对所有的线进行遍历
            ActivityImpl pvmActivityImpl = (ActivityImpl) pvmTransition.getDestination();
            // 如果取出的线的目标节点存在时间相同的节点里,保存该线的id,进行高亮显示
            if (sameStartTimeNodes.contains(pvmActivityImpl)) {
                highFlows.add(pvmTransition.getId());
            }
        }
    }
    return highFlows;
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:44,代码来源:ProcessInstanceController.java

示例6: getHighLightedFlows

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
private List<String> getHighLightedFlows() {
    List<String> highLightedFlows = new ArrayList<String>();
    List<HistoricActivityInstance> historicActivityInstances = historyService
            .createHistoricActivityInstanceQuery()
            .processInstanceId(processInstanceId)
            .orderByHistoricActivityInstanceStartTime().asc().list();

    List<String> historicActivityInstanceList = new ArrayList<String>();

    for (HistoricActivityInstance hai : historicActivityInstances) {
        historicActivityInstanceList.add(hai.getActivityId());
    }

    // add current activities to list
    highLightedActivities = runtimeService
            .getActiveActivityIds(processInstanceId);
    historicActivityInstanceList.addAll(highLightedActivities);

    // activities and their sequence-flows
    for (ActivityImpl activity : processDefinition.getActivities()) {
        int index = historicActivityInstanceList.indexOf(activity.getId());

        if ((index >= 0)
                && ((index + 1) < historicActivityInstanceList.size())) {
            List<PvmTransition> pvmTransitionList = activity
                    .getOutgoingTransitions();

            for (PvmTransition pvmTransition : pvmTransitionList) {
                String destinationFlowId = pvmTransition.getDestination()
                        .getId();

                if (destinationFlowId.equals(historicActivityInstanceList
                        .get(index + 1))) {
                    highLightedFlows.add(pvmTransition.getId());
                }
            }
        }
    }

    return highLightedFlows;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:42,代码来源:BpmResource.java

示例7: 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

示例8: testParseDiagramInterchangeElements

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
@Deployment
public void testParseDiagramInterchangeElements() {

    ProcessDefinition processDefinition = processEngineConfiguration.getFlowable5CompatibilityHandler().getProcessDefinitionByKey("myProcess");
    ProcessDefinitionEntity rawEntity = (ProcessDefinitionEntity) processDefinition;

    assertNotNull(rawEntity);
    assertEquals(7, rawEntity.getActivities().size());

    // Check if diagram has been created based on Diagram Interchange when it's not a headless instance
    List<String> resourceNames = repositoryService.getDeploymentResourceNames(rawEntity.getDeploymentId());
    assertEquals(2, resourceNames.size());

    for (ActivityImpl activity : rawEntity.getActivities()) {

        if (activity.getId().equals("theStart")) {
            assertActivityBounds(activity, 70, 255, 30, 30);
        } else if (activity.getId().equals("task1")) {
            assertActivityBounds(activity, 176, 230, 100, 80);
        } else if (activity.getId().equals("gateway1")) {
            assertActivityBounds(activity, 340, 250, 40, 40);
        } else if (activity.getId().equals("task2")) {
            assertActivityBounds(activity, 445, 138, 100, 80);
        } else if (activity.getId().equals("gateway2")) {
            assertActivityBounds(activity, 620, 250, 40, 40);
        } else if (activity.getId().equals("task3")) {
            assertActivityBounds(activity, 453, 304, 100, 80);
        } else if (activity.getId().equals("theEnd")) {
            assertActivityBounds(activity, 713, 256, 28, 28);
        }

        for (PvmTransition sequenceFlow : activity.getOutgoingTransitions()) {
            assertTrue(((TransitionImpl) sequenceFlow).getWaypoints().size() >= 4);

            TransitionImpl transitionImpl = (TransitionImpl) sequenceFlow;
            if (transitionImpl.getId().equals("flowStartToTask1")) {
                assertSequenceFlowWayPoints(transitionImpl, 100, 270, 176, 270);
            } else if (transitionImpl.getId().equals("flowTask1ToGateway1")) {
                assertSequenceFlowWayPoints(transitionImpl, 276, 270, 340, 270);
            } else if (transitionImpl.getId().equals("flowGateway1ToTask2")) {
                assertSequenceFlowWayPoints(transitionImpl, 360, 250, 360, 178, 445, 178);
            } else if (transitionImpl.getId().equals("flowGateway1ToTask3")) {
                assertSequenceFlowWayPoints(transitionImpl, 360, 290, 360, 344, 453, 344);
            } else if (transitionImpl.getId().equals("flowTask2ToGateway2")) {
                assertSequenceFlowWayPoints(transitionImpl, 545, 178, 640, 178, 640, 250);
            } else if (transitionImpl.getId().equals("flowTask3ToGateway2")) {
                assertSequenceFlowWayPoints(transitionImpl, 553, 344, 640, 344, 640, 290);
            } else if (transitionImpl.getId().equals("flowGateway2ToEnd")) {
                assertSequenceFlowWayPoints(transitionImpl, 660, 270, 713, 270);
            }

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

示例9: execute

import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void execute(DelegateExecution execution) {
    ExecutionEntity executionEntity = (ExecutionEntity) execution;
    ActivityImpl boundaryActivity = executionEntity.getProcessDefinition().findActivity(activityId);
    ActivityImpl interruptedActivity = executionEntity.getActivity();

    List<PvmTransition> outgoingTransitions = boundaryActivity.getOutgoingTransitions();
    List<ExecutionEntity> interruptedExecutions = null;

    if (interrupting) {

        // Call activity
        if (executionEntity.getSubProcessInstance() != null) {
            executionEntity.getSubProcessInstance().deleteCascade(executionEntity.getDeleteReason());
        } else {
            Context.getCommandContext().getHistoryManager().recordActivityEnd(executionEntity);
        }

        executionEntity.setActivity(boundaryActivity);

        interruptedExecutions = new ArrayList<>(executionEntity.getExecutions());
        for (ExecutionEntity interruptedExecution : interruptedExecutions) {
            interruptedExecution.deleteCascade("interrupting boundary event '" + executionEntity.getActivity().getId() + "' fired");
        }

        executionEntity.takeAll(outgoingTransitions, (List) interruptedExecutions);
    } else {
        // non interrupting event, introduced with BPMN 2.0, we need to create a new execution in this case

        // create a new execution and move it out from the timer activity
        ExecutionEntity concurrentRoot = executionEntity.getParent().isConcurrent() ? executionEntity.getParent() : executionEntity;
        ExecutionEntity outgoingExecution = concurrentRoot.createExecution();

        outgoingExecution.setActive(true);
        outgoingExecution.setScope(false);
        outgoingExecution.setConcurrent(true);

        outgoingExecution.takeAll(outgoingTransitions, Collections.EMPTY_LIST);
        outgoingExecution.remove();
        // now we have to move the execution back to the real activity
        // since the execution stays there (non interrupting) and it was
        // set to the boundary event before
        executionEntity.setActivity(interruptedActivity);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:47,代码来源:BoundaryEventActivityBehavior.java


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