示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution) throws Exception
        public virtual void execute(ActivityExecution execution)
        {
            EnsureUtil.ensureNotNull("Could not find cancel boundary event for cancel end event " + execution.Activity, "cancelBoundaryEvent", cancelBoundaryEvent);

            IList <EventSubscriptionEntity> compensateEventSubscriptions = CompensationUtil.collectCompensateEventSubscriptionsForScope(execution);

            if (compensateEventSubscriptions.Count == 0)
            {
                leave(execution);
            }
            else
            {
                CompensationUtil.throwCompensationEvent(compensateEventSubscriptions, execution, false);
            }
        }
示例#2
0
        public virtual void handleEvent(EventSubscriptionEntity eventSubscription, object payload, object localPayload, string businessKey, CommandContext commandContext)
        {
            eventSubscription.delete();

            string configuration = eventSubscription.Configuration;

            ensureNotNull("Compensating execution not set for compensate event subscription with id " + eventSubscription.Id, "configuration", configuration);

            ExecutionEntity compensatingExecution = commandContext.ExecutionManager.findExecutionById(configuration);

            ActivityImpl compensationHandler = eventSubscription.Activity;

            // activate execution
            compensatingExecution.Active = true;

            if (compensatingExecution.getActivity().ActivityBehavior is CompositeActivityBehavior)
            {
                compensatingExecution.Parent.ActivityInstanceId = compensatingExecution.ActivityInstanceId;
            }

            if (compensationHandler.Scope && !compensationHandler.CompensationHandler)
            {
                // descend into scope:
                IList <EventSubscriptionEntity> eventsForThisScope = compensatingExecution.CompensateEventSubscriptions;
                CompensationUtil.throwCompensationEvent(eventsForThisScope, compensatingExecution, false);
            }
            else
            {
                try
                {
                    if (compensationHandler.SubProcessScope && compensationHandler.TriggeredByEvent)
                    {
                        compensatingExecution.executeActivity(compensationHandler);
                    }
                    else
                    {
                        // since we already have a scope execution, we don't need to create another one
                        // for a simple scoped compensation handler
                        compensatingExecution.setActivity(compensationHandler);
                        compensatingExecution.performOperation(org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_START);
                    }
                }
                catch (Exception e)
                {
                    throw new ProcessEngineException("Error while handling compensation event " + eventSubscription, e);
                }
            }
        }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution) throws Exception
        public virtual void execute(ActivityExecution execution)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity> eventSubscriptions = collectEventSubscriptions(execution);
            IList <EventSubscriptionEntity> eventSubscriptions = collectEventSubscriptions(execution);

            if (eventSubscriptions.Count == 0)
            {
                leave(execution);
            }
            else
            {
                // async (waitForCompletion=false in bpmn) is not supported
                CompensationUtil.throwCompensationEvent(eventSubscriptions, execution, false);
            }
        }