Java Code Examples for org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution#end()
The following examples show how to use
org.camunda.bpm.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 camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void complete(ActivityExecution execution) { ActivityExecution outgoingExecution = execution.getParent().createExecution(); outgoingExecution.setConcurrent(false); outgoingExecution.setActivity(execution.getActivity()); // eventscope execution execution.setConcurrent(false); execution.setActive(false); ((PvmExecutionImpl)execution).setEventScope(true); List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions(); if(outgoingTransitions.isEmpty()) { outgoingExecution.end(true); }else { outgoingExecution.leaveActivityViaTransitions(outgoingTransitions, Collections.EMPTY_LIST); } }
Example 2
Source File: LegacyBehavior.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static boolean eventSubprocessComplete(ActivityExecution scopeExecution) { boolean performLegacyBehavior = isLegacyBehaviorRequired(scopeExecution); if(performLegacyBehavior) { LOG.completeNonScopeEventSubprocess(); scopeExecution.end(false); } return performLegacyBehavior; }
Example 3
Source File: EmbeddedSubProcess.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void complete(ActivityExecution execution) { List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions(); if(outgoingTransitions.isEmpty()) { execution.end(true); }else { execution.leaveActivityViaTransitions(outgoingTransitions, Collections.EMPTY_LIST); } }
Example 4
Source File: Automatic.java From camunda-bpm-platform 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(true); } else { execution.leaveActivityViaTransition(outgoingTransitions.get(0)); } }
Example 5
Source File: BpmnExceptionHandler.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public static void propagateError(String errorCode, String errorMessage, Exception origException, ActivityExecution execution) throws Exception { ActivityExecutionHierarchyWalker walker = new ActivityExecutionHierarchyWalker(execution); final ErrorDeclarationForProcessInstanceFinder errorDeclarationFinder = new ErrorDeclarationForProcessInstanceFinder(origException, errorCode, execution.getActivity()); ActivityExecutionMappingCollector activityExecutionMappingCollector = new ActivityExecutionMappingCollector(execution); walker.addScopePreVisitor(errorDeclarationFinder); walker.addExecutionPreVisitor(activityExecutionMappingCollector); // map variables to super executions in the hierarchy of called process instances walker.addExecutionPreVisitor(new OutputVariablesPropagator()); try { walker.walkUntil(new ReferenceWalker.WalkCondition<ActivityExecutionTuple>() { @Override public boolean isFulfilled(ActivityExecutionTuple element) { return errorDeclarationFinder.getErrorEventDefinition() != null || element == null; } }); } catch(Exception e) { LOG.errorPropagationException(execution.getActivityInstanceId(), e); // separate the exception handling to support a fail-safe error propagation throw new ErrorPropagationException(e.getCause()); } PvmActivity errorHandlingActivity = errorDeclarationFinder.getErrorHandlerActivity(); // process the error if (errorHandlingActivity == null) { if (origException == null) { if (Context.getCommandContext().getProcessEngineConfiguration().isEnableExceptionsAfterUnhandledBpmnError()) { throw LOG.missingBoundaryCatchEventError(execution.getActivity().getId(), errorCode); } else { LOG.missingBoundaryCatchEvent(execution.getActivity().getId(), errorCode); execution.end(true); } } else { // throw original exception throw origException; } } else { ErrorEventDefinition errorDefinition = errorDeclarationFinder.getErrorEventDefinition(); PvmExecutionImpl errorHandlingExecution = activityExecutionMappingCollector.getExecutionForScope(errorHandlingActivity.getEventScope()); if(errorDefinition.getErrorCodeVariable() != null) { errorHandlingExecution.setVariable(errorDefinition.getErrorCodeVariable(), errorCode); } if(errorDefinition.getErrorMessageVariable() != null) { errorHandlingExecution.setVariable(errorDefinition.getErrorMessageVariable(), errorMessage); } errorHandlingExecution.executeActivity(errorHandlingActivity); } }
Example 6
Source File: NoneEndEventActivityBehavior.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void execute(ActivityExecution execution) throws Exception { execution.end(true); }
Example 7
Source File: TerminateEndEventActivityBehavior.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void execute(ActivityExecution execution) throws Exception { // we are the last execution inside this scope: calling end() ends this scope. execution.end(true); }
Example 8
Source File: BpmnActivityBehavior.java From camunda-bpm-platform 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. */ protected void performOutgoingBehavior(ActivityExecution execution, boolean checkConditions, List<ActivityExecution> reusableExecutions) { LOG.leavingActivity(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) { if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) { Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION); if (condition == null || !checkConditions || condition.evaluate(execution)) { transitionsToTake.add(outgoingTransition); } } } if (transitionsToTake.size() == 1) { execution.leaveActivityViaTransition(transitionsToTake.get(0)); } else if (transitionsToTake.size() >= 1) { if (reusableExecutions == null || reusableExecutions.isEmpty()) { execution.leaveActivityViaTransitions(transitionsToTake, Arrays.asList(execution)); } else { execution.leaveActivityViaTransitions(transitionsToTake, reusableExecutions); } } else { if (defaultSequenceFlow != null) { PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow); if (defaultTransition != null) { execution.leaveActivityViaTransition(defaultTransition); } else { throw LOG.missingDefaultFlowException(execution.getActivity().getId(), defaultSequenceFlow); } } else if (!outgoingTransitions.isEmpty()) { throw LOG.missingConditionalFlowException(execution.getActivity().getId()); } else { if (((ActivityImpl) execution.getActivity()).isCompensationHandler() && isAncestorCompensationThrowing(execution)) { execution.endCompensation(); } else { LOG.missingOutgoingSequenceFlow(execution.getActivity().getId()); execution.end(true); } } } }
Example 9
Source File: End.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void execute(ActivityExecution execution) throws Exception { execution.end(true); }