org.activiti.engine.impl.pvm.PvmTransition Java Examples
The following examples show how to use
org.activiti.engine.impl.pvm.PvmTransition.
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: BpmActivityServiceImpl.java From hsweb-framework with Apache License 2.0 | 6 votes |
@Override public List<ActivityImpl> getNextEvent(ActivityImpl activity) { return activity.getOutgoingTransitions() .stream() .map(PvmTransition::getDestination) .map(ActivityImpl.class::cast) .collect(Collectors.toList()); // List<ActivityImpl> activities = new ArrayList<>(); // List<PvmTransition> pvmTransitions = activity.getOutgoingTransitions(); // for (PvmTransition pvmTransition : pvmTransitions) { // activities.add((ActivityImpl) pvmTransition.getDestination()); // } // return activities; }
Example #4
Source File: FindPreviousActivitiesCmd.java From lemon with Apache License 2.0 | 6 votes |
public List<PvmActivity> getPreviousActivities(PvmActivity pvmActivity) { List<PvmActivity> pvmActivities = new ArrayList<PvmActivity>(); for (PvmTransition pvmTransition : pvmActivity.getIncomingTransitions()) { PvmActivity targetActivity = pvmTransition.getDestination(); if ("userTask".equals(targetActivity.getProperty("type"))) { pvmActivities.add(targetActivity); } else { pvmActivities .addAll(this.getPreviousActivities(targetActivity)); } } return pvmActivities; }
Example #5
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 #6
Source File: ParallelGateway.java From flowable-engine with Apache License 2.0 | 6 votes |
public void execute(DelegateExecution execution) { ActivityExecution activityExecution = (ActivityExecution) execution; PvmActivity activity = activityExecution.getActivity(); List<PvmTransition> outgoingTransitions = activityExecution.getActivity().getOutgoingTransitions(); execution.inactivate(); List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity); int nbrOfExecutionsToJoin = activityExecution.getActivity().getIncomingTransitions().size(); int nbrOfExecutionsJoined = joinedExecutions.size(); if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) { LOGGER.debug("parallel gateway '{}' activates: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin); activityExecution.takeAll(outgoingTransitions, joinedExecutions); } else if (LOGGER.isDebugEnabled()) { LOGGER.debug("parallel gateway '{}' does not activate: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin); } }
Example #7
Source File: ActivitiWorkFlowServiceImpl.java From maven-framework-project with MIT License | 6 votes |
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 #8
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 #9
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 #10
Source File: EventScopeCreatingSubprocess.java From flowable-engine with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") public void lastExecutionEnded(ActivityExecution execution) { ActivityExecution outgoingExecution = execution.getParent().createExecution(); outgoingExecution.setConcurrent(false); ((InterpretableExecution) outgoingExecution).setActivity((ActivityImpl) execution.getActivity()); // eventscope execution execution.setConcurrent(false); execution.setActive(false); ((InterpretableExecution) execution).setEventScope(true); List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions(); if (outgoingTransitions.isEmpty()) { outgoingExecution.end(); } else { outgoingExecution.takeAll(outgoingTransitions, Collections.EMPTY_LIST); } }
Example #11
Source File: While.java From flowable-engine with Apache License 2.0 | 6 votes |
public void execute(DelegateExecution execution) { ActivityExecution activityExecution = (ActivityExecution) execution; PvmTransition more = activityExecution.getActivity().findOutgoingTransition("more"); PvmTransition done = activityExecution.getActivity().findOutgoingTransition("done"); Integer value = (Integer) execution.getVariable(variableName); if (value == null) { execution.setVariable(variableName, from); activityExecution.take(more); } else { value = value + 1; if (value < to) { execution.setVariable(variableName, value); activityExecution.take(more); } else { activityExecution.take(done); } } }
Example #12
Source File: ParallelGatewayActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void execute(DelegateExecution execution) { ActivityExecution activityExecution = (ActivityExecution) execution; // Join PvmActivity activity = activityExecution.getActivity(); List<PvmTransition> outgoingTransitions = activityExecution.getActivity().getOutgoingTransitions(); execution.inactivate(); lockConcurrentRoot(activityExecution); List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity); int nbrOfExecutionsToJoin = activityExecution.getActivity().getIncomingTransitions().size(); int nbrOfExecutionsJoined = joinedExecutions.size(); Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) execution); if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) { // Fork if (LOGGER.isDebugEnabled()) { LOGGER.debug("parallel gateway '{}' activates: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin); } activityExecution.takeAll(outgoingTransitions, joinedExecutions); } else if (LOGGER.isDebugEnabled()) { LOGGER.debug("parallel gateway '{}' does not activate: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin); } }
Example #13
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 #14
Source File: AutoCompleteFirstTaskEventListener.java From lemon with Apache License 2.0 | 6 votes |
/** * 获得第一个节点. */ public PvmActivity findFirstActivity(String processDefinitionId) { ProcessDefinitionEntity processDefinitionEntity = Context .getProcessEngineConfiguration().getProcessDefinitionCache() .get(processDefinitionId); ActivityImpl startActivity = processDefinitionEntity.getInitial(); if (startActivity.getOutgoingTransitions().size() != 1) { throw new IllegalStateException( "start activity outgoing transitions cannot more than 1, now is : " + startActivity.getOutgoingTransitions().size()); } PvmTransition pvmTransition = startActivity.getOutgoingTransitions() .get(0); PvmActivity targetActivity = pvmTransition.getDestination(); if (!"userTask".equals(targetActivity.getProperty("type"))) { logger.debug("first activity is not userTask, just skip"); return null; } return targetActivity; }
Example #15
Source File: ExecutionEntity.java From flowable-engine with Apache License 2.0 | 6 votes |
/** * @param fireActivityCompletionEvent This method can be called from other places (like {@link #takeAll(List, List)}), where the event is already fired. In that case, false is passed an no second event is fired. */ @Override public void take(PvmTransition transition, boolean fireActivityCompletionEvent) { if (fireActivityCompletionEvent) { fireActivityCompletedEvent(); } if (this.transition != null) { throw new PvmException("already taking a transition"); } if (transition == null) { throw new PvmException("transition is null"); } setActivity((ActivityImpl) transition.getSource()); setTransition((TransitionImpl) transition); performOperation(AtomicOperation.TRANSITION_NOTIFY_LISTENER_END); }
Example #16
Source File: ProcessCustomService.java From maven-framework-project with MIT License | 6 votes |
/** * 流程转向操作 * * @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 #17
Source File: ProcessExtensionServiceImpl.java From activiti-demo with Apache License 2.0 | 6 votes |
/** * 流程转向操作 * @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 #18
Source File: AutoCompleteFirstTaskListener.java From lemon with Apache License 2.0 | 6 votes |
/** * 获得第一个节点. */ public PvmActivity findFirstActivity(String processDefinitionId) { ProcessDefinitionEntity processDefinitionEntity = Context .getProcessEngineConfiguration().getProcessDefinitionCache() .get(processDefinitionId); ActivityImpl startActivity = processDefinitionEntity.getInitial(); if (startActivity.getOutgoingTransitions().size() != 1) { throw new IllegalStateException( "start activity outgoing transitions cannot more than 1, now is : " + startActivity.getOutgoingTransitions().size()); } PvmTransition pvmTransition = startActivity.getOutgoingTransitions() .get(0); PvmActivity targetActivity = pvmTransition.getDestination(); if (!"userTask".equals(targetActivity.getProperty("type"))) { logger.debug("first activity is not userTask, just skip"); return null; } return targetActivity; }
Example #19
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 #20
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 #21
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 #22
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 #23
Source File: ActivitiKit.java From my_curd with Apache License 2.0 | 5 votes |
private static List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinitionEntity, List<HistoricActivityInstance> historicActivityInstances) { List<String> highFlows = new ArrayList<String>(); 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(); if (sameStartTimeNodes.contains(pvmActivityImpl)) { highFlows.add(pvmTransition.getId()); } } } return highFlows; }
Example #24
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 #25
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 #26
Source File: Automatic.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
public void execute(ActivityExecution execution) throws Exception { List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions(); if (outgoingTransitions.isEmpty()) { execution.end(); System.out.println("流程已结束,结束节点:" + execution.getActivity().getId()); } else { System.out.println("自动节点:" + execution.getActivity().getId()); execution.take(outgoingTransitions.get(0)); } }
Example #27
Source File: WaitState.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
public void signal(ActivityExecution execution, String signalName, Object signalData) throws Exception { PvmActivity activity = execution.getActivity(); System.out.println("触发活动" + activity.getId()); PvmTransition transition = activity.getOutgoingTransitions().get(0); execution.take(transition); }
Example #28
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 #29
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 #30
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; }