Java Code Examples for org.activiti.engine.impl.pvm.process.ActivityImpl#getOutgoingTransitions()
The following examples show how to use
org.activiti.engine.impl.pvm.process.ActivityImpl#getOutgoingTransitions() .
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: ProcessExtensionServiceImpl.java From activiti-demo with Apache License 2.0 | 6 votes |
/** * 清空指定活动节点流向 * @param activityImpl 活动节点 * @return 节点流向集合 */ private List<PvmTransition> clearTransition(ActivityImpl activityImpl){ //存储当前节点所有流向临时变量 List<PvmTransition> oriPvmTransitionList = new ArrayList<PvmTransition>(); //获取当前节点所有流向,存储到临时变量,然后清空 List<PvmTransition> pvmTransitionList = activityImpl.getOutgoingTransitions(); for(PvmTransition pvmTransition : pvmTransitionList){ oriPvmTransitionList.add(pvmTransition); } pvmTransitionList.clear(); return oriPvmTransitionList; }
Example 2
Source File: BpmActivityServiceImpl.java From hsweb-framework with Apache License 2.0 | 6 votes |
@Override public List<TaskDefinition> getNextActivities(String procDefId, String activityId, DelegateExecution execution) { 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, execution)) //获取TaskDefinition集合 .flatMap(Collection::stream) //合并集合 .collect(Collectors.toList()); }
Example 3
Source File: BpmResource.java From lemon with Apache License 2.0 | 6 votes |
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()); } } } } }
Example 4
Source File: ProcessCustomService.java From maven-framework-project with MIT License | 6 votes |
/** * 根据当前节点,查询输出流向是否为并行终点,如果为并行终点,则拼装对应的并行起点ID * * @param activityImpl * 当前节点 * @return */ private static String findParallelGatewayId(ActivityImpl activityImpl) { List<PvmTransition> incomingTransitions = activityImpl .getOutgoingTransitions(); for (PvmTransition pvmTransition : incomingTransitions) { TransitionImpl transitionImpl = (TransitionImpl) pvmTransition; activityImpl = transitionImpl.getDestination(); String type = (String) activityImpl.getProperty("type"); if ("parallelGateway".equals(type)) {// 并行路线 String gatewayId = activityImpl.getId(); String gatewayType = gatewayId.substring(gatewayId .lastIndexOf("_") + 1); if ("END".equals(gatewayType.toUpperCase())) { return gatewayId.substring(0, gatewayId.lastIndexOf("_")) + "_start"; } } } return null; }
Example 5
Source File: BpmnParseTest.java From flowable-engine with Apache License 2.0 | 6 votes |
@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"); } } }
Example 6
Source File: ActivitiWorkFlowServiceImpl.java From maven-framework-project with MIT License | 6 votes |
public String findParallelGatewayId(ActivityImpl activityImpl) { List<PvmTransition> incomingTransitions = activityImpl .getOutgoingTransitions(); for (PvmTransition pvmTransition : incomingTransitions) { TransitionImpl transitionImpl = (TransitionImpl) pvmTransition; activityImpl = transitionImpl.getDestination(); String type = (String) activityImpl.getProperty("type"); if ("parallelGateway".equals(type)) {// 并行路线 String gatewayId = activityImpl.getId(); String gatewayType = gatewayId.substring(gatewayId .lastIndexOf("_") + 1); if ("END".equals(gatewayType.toUpperCase())) { return gatewayId.substring(0, gatewayId.lastIndexOf("_")) + "_start"; } } } return null; }
Example 7
Source File: ProcessExtensionServiceImpl.java From activiti-demo with Apache License 2.0 | 6 votes |
/** * 根据当前节点,查询输出流向是否为并行终点,如果为并行终点,则拼装对应的并行起点ID * @param activityImpl 当前节点 * @return */ private String findParallelGatewayId(ActivityImpl activityImpl){ List<PvmTransition> incomingTransitions = activityImpl.getOutgoingTransitions(); for(PvmTransition pvmTransition : incomingTransitions){ TransitionImpl transitionImpl = (TransitionImpl)pvmTransition; activityImpl = transitionImpl.getDestination(); String type = (String)activityImpl.getProperty("type"); if("parallelGateway".equals(type)){ //并行路线 String gatewayId = activityImpl.getId(); String gettewayType = gatewayId.substring(gatewayId.lastIndexOf("_")+1); if("END".equals(gettewayType.toUpperCase())){ return gatewayId.substring(0, gatewayId.lastIndexOf("_"))+"_start"; } } } return null; }
Example 8
Source File: ProcessExtensionServiceImpl.java From activiti-demo with Apache License 2.0 | 5 votes |
/** * 还原指定活动节点流向 * @param activityImpl 活动节点 * @param oriPvmTransitionList 原有节点流向集合 */ private static void restoreTransition(ActivityImpl activityImpl,List<PvmTransition> oriPvmTransitionList){ //清空现有流向 List<PvmTransition> pvmTransitionList = activityImpl.getOutgoingTransitions(); pvmTransitionList.clear(); for(PvmTransition pvmTransition:oriPvmTransitionList){ pvmTransitionList.add(pvmTransition); } }
Example 9
Source File: ProcessCustomService.java From maven-framework-project with MIT License | 5 votes |
/** * 还原指定活动节点流向 * * @param activityImpl * 活动节点 * @param oriPvmTransitionList * 原有节点流向集合 */ private static void restoreTransition(ActivityImpl activityImpl, List<PvmTransition> oriPvmTransitionList) { // 清空现有流向 List<PvmTransition> pvmTransitionList = activityImpl .getOutgoingTransitions(); pvmTransitionList.clear(); // 还原以前流向 for (PvmTransition pvmTransition : oriPvmTransitionList) { pvmTransitionList.add(pvmTransition); } }
Example 10
Source File: ProcessCustomService.java From maven-framework-project with MIT License | 5 votes |
/** * 清空指定活动节点流向 * * @param activityImpl * 活动节点 * @return 节点流向集合 */ private static List<PvmTransition> clearTransition(ActivityImpl activityImpl) { // 存储当前节点所有流向临时变量 List<PvmTransition> oriPvmTransitionList = new ArrayList<PvmTransition>(); // 获取当前节点所有流向,存储到临时变量,然后清空 List<PvmTransition> pvmTransitionList = activityImpl .getOutgoingTransitions(); for (PvmTransition pvmTransition : pvmTransitionList) { oriPvmTransitionList.add(pvmTransition); } pvmTransitionList.clear(); return oriPvmTransitionList; }
Example 11
Source File: ActivitiWorkFlowServiceImpl.java From maven-framework-project with MIT License | 5 votes |
public void restoreTransition(ActivityImpl activityImpl, List<PvmTransition> oriPvmTransitionList) { // 清空现有流向 List<PvmTransition> pvmTransitionList = activityImpl .getOutgoingTransitions(); pvmTransitionList.clear(); // 还原以前流向 for (PvmTransition pvmTransition : oriPvmTransitionList) { pvmTransitionList.add(pvmTransition); } }
Example 12
Source File: ActivitiWorkFlowServiceImpl.java From maven-framework-project with MIT License | 5 votes |
/** * 清空指定活动节点流向 * * @param activityImpl * 活动节点 * @return 节点流向集合 */ private List<PvmTransition> clearTransition(ActivityImpl activityImpl) { // 存储当前节点所有流向临时变量 List<PvmTransition> oriPvmTransitionList = new ArrayList<PvmTransition>(); // 获取当前节点所有流向,存储到临时变量,然后清空 List<PvmTransition> pvmTransitionList = activityImpl .getOutgoingTransitions(); for (PvmTransition pvmTransition : pvmTransitionList) { oriPvmTransitionList.add(pvmTransition); } pvmTransitionList.clear(); return oriPvmTransitionList; }
Example 13
Source File: TraceProcessController.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) { 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 List<String> 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; }
Example 14
Source File: TraceProcessController.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) { 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 List<String> 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; }
Example 15
Source File: TraceProcessController.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) { 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 List<String> 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; }
Example 16
Source File: MultiInstanceActivityCreator.java From openwebflow with BSD 2-Clause "Simplified" License | 5 votes |
private ActivityImpl createMultiInstanceActivity(ProcessEngine processEngine, ProcessDefinitionEntity processDefinition, String processInstanceId, String prototypeActivityId, String cloneActivityId, boolean isSequential, List<String> assignees) { ActivityImpl prototypeActivity = ProcessDefinitionUtils.getActivity(processEngine, processDefinition.getId(), prototypeActivityId); //拷贝listener,executionListeners会激活历史记录的保存 ActivityImpl clone = cloneActivity(processDefinition, prototypeActivity, cloneActivityId, "executionListeners", "properties"); //拷贝所有后向链接 for (PvmTransition trans : prototypeActivity.getOutgoingTransitions()) { clone.createOutgoingTransition(trans.getId()).setDestination((ActivityImpl) trans.getDestination()); } MultiInstanceActivityBehavior multiInstanceBehavior = isSequential ? new SequentialMultiInstanceBehavior(clone, (TaskActivityBehavior) prototypeActivity.getActivityBehavior()) : new ParallelMultiInstanceBehavior( clone, (TaskActivityBehavior) prototypeActivity.getActivityBehavior()); clone.setActivityBehavior(multiInstanceBehavior); clone.setScope(true); clone.setProperty("multiInstance", isSequential ? "sequential" : "parallel"); //设置多实例节点属性 multiInstanceBehavior.setLoopCardinalityExpression(new FixedValue(assignees.size())); multiInstanceBehavior.setCollectionExpression(new FixedValue(assignees)); return clone; }
Example 17
Source File: ProcessInstanceHighlightsResource.java From hsweb-framework with Apache License 2.0 | 5 votes |
/** * Check out the outgoing transition connected to firstActInst from startEventActList * * @param startEventActList * @param firstActInst * @return */ private PvmTransition getStartTransaction(List<ActivityImpl> startEventActList, HistoricActivityInstance firstActInst) { for (ActivityImpl startEventAct : startEventActList) { for (PvmTransition trans : startEventAct.getOutgoingTransitions()) { if (trans.getDestination().getId().equals(firstActInst.getActivityId())) { return trans; } } } return null; }
Example 18
Source File: BpmResource.java From lemon with Apache License 2.0 | 4 votes |
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; }
Example 19
Source File: BoundaryEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 4 votes |
@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); } }
Example 20
Source File: BpmnParseTest.java From flowable-engine with Apache License 2.0 | 4 votes |
@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); } } } }