Java Code Examples for org.activiti.engine.impl.pvm.delegate.ActivityExecution#end()
The following examples show how to use
org.activiti.engine.impl.pvm.delegate.ActivityExecution#end() .
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: 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 2
Source File: TerminateEndEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
protected void terminateExecution(ActivityExecution execution, ActivityImpl terminateEndEventActivity, ActivityExecution scopeExecution) { // send cancelled event sendCancelledEvent(execution, terminateEndEventActivity, scopeExecution); // destroy the scope scopeExecution.destroyScope("terminate end event fired"); // set the scope execution to the terminate end event and make it end here. // (the history should reflect that the execution ended here and we want an 'end time' for the // historic activity instance.) ((InterpretableExecution) scopeExecution).setActivity(terminateEndEventActivity); // end the scope execution scopeExecution.end(); // Scope execution can already have been ended (for example when multiple seq flow arrive in the same terminate end event) // in that case, we need to make sure the activity instance is ended if (scopeExecution.isEnded()) { Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) execution); } }
Example 3
Source File: EmbeddedSubProcess.java From flowable-engine with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public void lastExecutionEnded(ActivityExecution execution) { List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions(); if (outgoingTransitions.isEmpty()) { execution.end(); } else { execution.takeAll(outgoingTransitions, Collections.EMPTY_LIST); } }
Example 4
Source File: Automatic.java From flowable-engine with Apache License 2.0 | 5 votes |
public void execute(DelegateExecution execution) { ActivityExecution activityExecution = (ActivityExecution) execution; List<PvmTransition> outgoingTransitions = activityExecution.getActivity().getOutgoingTransitions(); if (outgoingTransitions.isEmpty()) { activityExecution.end(); } else { activityExecution.take(outgoingTransitions.get(0)); } }
Example 5
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 6
Source File: End.java From flowable-engine with Apache License 2.0 | 4 votes |
public void execute(DelegateExecution execution) { ActivityExecution activityExecution = (ActivityExecution) execution; activityExecution.end(); }
Example 7
Source File: NoneEndEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public void execute(DelegateExecution execution) { ActivityExecution activityExecution = (ActivityExecution) execution; activityExecution.end(); }
Example 8
Source File: BpmnActivityBehavior.java From flowable-engine with Apache License 2.0 | 4 votes |
/** * Actual implementation of leaving an activity. * * @param execution The current execution context * @param checkConditions Whether or not to check conditions before determining whether or not to take a transition. * @param throwExceptionIfExecutionStuck If true, an {@link ActivitiException} will be thrown in case no transition could be found to leave the activity. */ protected void performOutgoingBehavior(ActivityExecution execution, boolean checkConditions, boolean throwExceptionIfExecutionStuck, List<ActivityExecution> reusableExecutions) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Leaving activity '{}'", execution.getActivity().getId()); } String defaultSequenceFlow = (String) execution.getActivity().getProperty("default"); List<PvmTransition> transitionsToTake = new ArrayList<>(); List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions(); for (PvmTransition outgoingTransition : outgoingTransitions) { Expression skipExpression = outgoingTransition.getSkipExpression(); if (!SkipExpressionUtil.isSkipExpressionEnabled(execution, skipExpression)) { if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) { Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION); if (condition == null || !checkConditions || condition.evaluate(outgoingTransition.getId(), execution)) { transitionsToTake.add(outgoingTransition); } } } else if (SkipExpressionUtil.shouldSkipFlowElement(execution, skipExpression)) { transitionsToTake.add(outgoingTransition); } } if (transitionsToTake.size() == 1) { execution.take(transitionsToTake.get(0)); } else if (transitionsToTake.size() >= 1) { execution.inactivate(); if (reusableExecutions == null || reusableExecutions.isEmpty()) { execution.takeAll(transitionsToTake, Collections.singletonList(execution)); } else { execution.takeAll(transitionsToTake, reusableExecutions); } } else { if (defaultSequenceFlow != null) { PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow); if (defaultTransition != null) { execution.take(defaultTransition); } else { throw new ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' could not be not found"); } } else { Object isForCompensation = execution.getActivity().getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION); if (isForCompensation != null && (Boolean) isForCompensation) { if (execution instanceof ExecutionEntity) { Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) execution); } InterpretableExecution parentExecution = (InterpretableExecution) execution.getParent(); ((InterpretableExecution) execution).remove(); parentExecution.signal("compensationDone", null); } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("No outgoing sequence flow found for {}. Ending execution.", execution.getActivity().getId()); } execution.end(); if (throwExceptionIfExecutionStuck) { throw new ActivitiException("No outgoing sequence flow of the inclusive gateway '" + execution.getActivity().getId() + "' could be selected for continuing the process"); } } } } }
Example 9
Source File: End.java From activiti-in-action-codes with Apache License 2.0 | 4 votes |
public void execute(ActivityExecution execution) throws Exception { execution.end(); System.out.println("流程已结束,结束节点:" + execution.getActivity().getId()); }