Beispiel #1
0
        protected internal virtual void executeEscalationHandler(EscalationEventDefinition escalationEventDefinition, ActivityExecutionMappingCollector activityExecutionMappingCollector)
        {
            PvmActivity       escalationHandler   = escalationEventDefinition.EscalationHandler;
            PvmScope          escalationScope     = getScopeForEscalation(escalationEventDefinition);
            ActivityExecution escalationExecution = activityExecutionMappingCollector.getExecutionForScope(escalationScope);

            if (!string.ReferenceEquals(escalationEventDefinition.EscalationCodeVariable, null))
            {
                escalationExecution.setVariable(escalationEventDefinition.EscalationCodeVariable, escalation.EscalationCode);
            }

            escalationExecution.executeActivity(escalationHandler);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void propagateError(String errorCode, String errorMessage, Exception origException, org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution) throws Exception
        public static void propagateError(string errorCode, string errorMessage, Exception origException, ActivityExecution execution)
        {
            ActivityExecutionHierarchyWalker walker = new ActivityExecutionHierarchyWalker(execution);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ErrorDeclarationForProcessInstanceFinder errorDeclarationFinder = new ErrorDeclarationForProcessInstanceFinder(origException, errorCode, execution.getActivity());
            ErrorDeclarationForProcessInstanceFinder errorDeclarationFinder            = new ErrorDeclarationForProcessInstanceFinder(origException, errorCode, execution.Activity);
            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 WalkConditionAnonymousInnerClass(errorDeclarationFinder));
            }
            catch (Exception e)
            {
                LOG.errorPropagationException(execution.ActivityInstanceId, e);

                // separate the exception handling to support a fail-safe error propagation
                throw new ErrorPropagationException(e.InnerException);
            }

            PvmActivity errorHandlingActivity = errorDeclarationFinder.ErrorHandlerActivity;

            // process the error
            if (errorHandlingActivity == null)
            {
                if (origException == null)
                {
                    if (Context.CommandContext.ProcessEngineConfiguration.EnableExceptionsAfterUnhandledBpmnError)
                    {
                        throw LOG.missingBoundaryCatchEventError(execution.Activity.Id, errorCode);
                    }
                    else
                    {
                        LOG.missingBoundaryCatchEvent(execution.Activity.Id, errorCode);
                        execution.end(true);
                    }
                }
                else
                {
                    // throw original exception
                    throw origException;
                }
            }
            else
            {
                ErrorEventDefinition errorDefinition        = errorDeclarationFinder.ErrorEventDefinition;
                PvmExecutionImpl     errorHandlingExecution = activityExecutionMappingCollector.getExecutionForScope(errorHandlingActivity.EventScope);

                if (!string.ReferenceEquals(errorDefinition.ErrorCodeVariable, null))
                {
                    errorHandlingExecution.setVariable(errorDefinition.ErrorCodeVariable, errorCode);
                }
                if (!string.ReferenceEquals(errorDefinition.ErrorMessageVariable, null))
                {
                    errorHandlingExecution.setVariable(errorDefinition.ErrorMessageVariable, errorMessage);
                }
                errorHandlingExecution.executeActivity(errorHandlingActivity);
            }
        }