示例#1
0
        /// <summary>
        /// <para>Required for migrating active sequential MI receive tasks. These activities were formerly not scope,
        /// but are now. This has the following implications:
        ///
        /// </para>
        /// <para>Before migration:
        /// <ul><li> the event subscription is attached to the miBody scope execution</ul>
        ///
        /// </para>
        /// <para>After migration:
        /// <ul><li> a new subscription is created for every instance
        /// <li> the new subscription is attached to a dedicated scope execution as a child of the miBody scope
        ///   execution</ul>
        ///
        /// </para>
        /// <para>Thus, this method removes the subscription on the miBody scope
        /// </para>
        /// </summary>
        public static void removeLegacySubscriptionOnParent(ExecutionEntity execution, EventSubscriptionEntity eventSubscription)
        {
            ActivityImpl activity = execution.getActivity();

            if (activity == null)
            {
                return;
            }

            ActivityBehavior behavior       = activity.ActivityBehavior;
            ActivityBehavior parentBehavior = (ActivityBehavior)(activity.FlowScope != null ? activity.FlowScope.ActivityBehavior : null);

            if (behavior is ReceiveTaskActivityBehavior && parentBehavior is MultiInstanceActivityBehavior)
            {
                IList <EventSubscriptionEntity> parentSubscriptions = execution.Parent.EventSubscriptions;

                foreach (EventSubscriptionEntity subscription in parentSubscriptions)
                {
                    // distinguish a boundary event on the mi body with the same message name from the receive task subscription
                    if (areEqualEventSubscriptions(subscription, eventSubscription))
                    {
                        subscription.delete();
                    }
                }
            }
        }
示例#2
0
        protected internal static bool wasNoScope72(ActivityImpl activity)
        {
            ActivityBehavior activityBehavior       = activity.ActivityBehavior;
            ActivityBehavior parentActivityBehavior = (ActivityBehavior)(activity.FlowScope != null ? activity.FlowScope.ActivityBehavior : null);

            return((activityBehavior is EventSubProcessActivityBehavior) || (activityBehavior is SubProcessActivityBehavior && parentActivityBehavior is SequentialMultiInstanceActivityBehavior) || (activityBehavior is ReceiveTaskActivityBehavior && parentActivityBehavior is MultiInstanceActivityBehavior));
        }
示例#3
0
        public virtual void execute(PvmExecutionImpl execution)
        {
            execution.activityInstanceDone();

            ActivityBehavior activityBehavior = getActivityBehavior(execution);

            if (activityBehavior is FlowNodeActivityBehavior)
            {
                FlowNodeActivityBehavior behavior = (FlowNodeActivityBehavior)activityBehavior;

                ActivityImpl activity           = execution.getActivity();
                string       activityInstanceId = execution.ActivityInstanceId;
                if (!string.ReferenceEquals(activityInstanceId, null))
                {
                    LOG.debugLeavesActivityInstance(execution, activityInstanceId);
                }

                try
                {
                    behavior.doLeave(execution);
                }
                catch (Exception e)
                {
                    throw e;
                }
                catch (Exception e)
                {
                    throw new PvmException("couldn't leave activity <" + activity.getProperty("type") + " id=\"" + activity.Id + "\" ...>: " + e.Message, e);
                }
            }
            else
            {
                throw new PvmException("Behavior of current activity is not an instance of " + typeof(FlowNodeActivityBehavior).Name + ". Execution " + execution);
            }
        }
示例#4
0
 public CallableAnonymousInnerClass2(ServiceTaskDelegateExpressionActivityBehavior outerInstance, ActivityExecution execution, string signalName, object signalData, ActivityBehavior activityBehaviorInstance)
 {
     this.outerInstance            = outerInstance;
     this.execution                = execution;
     this.signalName               = signalName;
     this.signalData               = signalData;
     this.activityBehaviorInstance = activityBehaviorInstance;
 }
示例#5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void doSignal(final org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution, final String signalName, final Object signalData) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        protected internal virtual void doSignal(ActivityExecution execution, string signalName, object signalData)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior activityBehaviorInstance = getActivityBehaviorInstance(execution);
            ActivityBehavior activityBehaviorInstance = getActivityBehaviorInstance(execution);

            if (activityBehaviorInstance is CustomActivityBehavior)
            {
                CustomActivityBehavior behavior  = (CustomActivityBehavior)activityBehaviorInstance;
                ActivityBehavior       @delegate = behavior.DelegateActivityBehavior;

                if (!(@delegate is SignallableActivityBehavior))
                {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                    throw LOG.incorrectlyUsedSignalException(typeof(SignallableActivityBehavior).FullName);
                }
            }
            executeWithErrorPropagation(execution, new CallableAnonymousInnerClass3(this, execution, signalName, signalData, activityBehaviorInstance));
        }
示例#6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void doSignal(final org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution, final String signalName, final Object signalData) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        public virtual void doSignal(ActivityExecution execution, string signalName, object signalData)
        {
            object @delegate = expression.getValue(execution);

            applyFieldDeclaration(fieldDeclarations, @delegate);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior activityBehaviorInstance = getActivityBehaviorInstance(execution, delegate);
            ActivityBehavior activityBehaviorInstance = getActivityBehaviorInstance(execution, @delegate);

            if (activityBehaviorInstance is CustomActivityBehavior)
            {
                CustomActivityBehavior behavior = (CustomActivityBehavior)activityBehaviorInstance;
                ActivityBehavior       delegateActivityBehavior = behavior.DelegateActivityBehavior;

                if (!(delegateActivityBehavior is SignallableActivityBehavior))
                {
                    // legacy behavior: do nothing when it is not a signallable activity behavior
                    return;
                }
            }
            executeWithErrorPropagation(execution, new CallableAnonymousInnerClass2(this, execution, signalName, signalData, activityBehaviorInstance));
        }
示例#7
0
            public Void callback(PvmExecutionImpl execution)
            {
                ActivityBehavior activityBehavior = getActivityBehavior(execution);

                ActivityImpl activity = execution.getActivity();

//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                LOG.debugExecutesActivity(execution, activity, activityBehavior.GetType().FullName);

                try
                {
                    activityBehavior.execute(execution);
                }
                catch (Exception e)
                {
                    throw e;
                }
                catch (Exception e)
                {
                    throw new PvmException("couldn't execute activity <" + activity.getProperty("type") + " id=\"" + activity.Id + "\" ...>: " + e.Message, e);
                }
                return(null);
            }
示例#8
0
        public static bool eventSubprocessConcurrentChildExecutionEnded(ActivityExecution scopeExecution, ActivityExecution endedExecution)
        {
            bool performLegacyBehavior = isLegacyBehaviorRequired(endedExecution);

            if (performLegacyBehavior)
            {
                LOG.endConcurrentExecutionInEventSubprocess();
                // notify the grandparent flow scope in a similar way PvmAtomicOperationAcitivtyEnd does
                ScopeImpl flowScope = endedExecution.Activity.FlowScope;
                if (flowScope != null)
                {
                    flowScope = flowScope.FlowScope;

                    if (flowScope != null)
                    {
                        if (flowScope == endedExecution.Activity.ProcessDefinition)
                        {
                            endedExecution.remove();
                            scopeExecution.tryPruneLastConcurrentChild();
                            scopeExecution.forceUpdate();
                        }
                        else
                        {
                            PvmActivity flowScopeActivity = (PvmActivity)flowScope;

                            ActivityBehavior activityBehavior = flowScopeActivity.ActivityBehavior;
                            if (activityBehavior is CompositeActivityBehavior)
                            {
                                ((CompositeActivityBehavior)activityBehavior).concurrentChildExecutionEnded(scopeExecution, endedExecution);
                            }
                        }
                    }
                }
            }

            return(performLegacyBehavior);
        }
示例#9
0
        protected internal static bool wasNoScope73(ActivityImpl activity, PvmExecutionImpl scopeExecutionCandidate)
        {
            ActivityBehavior activityBehavior = activity.ActivityBehavior;

            return((activityBehavior is CompensationEventActivityBehavior) || (activityBehavior is CancelEndEventActivityBehavior) || isMultiInstanceInCompensation(activity, scopeExecutionCandidate));
        }
示例#10
0
        protected internal virtual bool isWaitStateGateway(ActivityImpl activity)
        {
            ActivityBehavior behavior = activity.ActivityBehavior;

            return(behavior is ParallelGatewayActivityBehavior || behavior is InclusiveGatewayActivityBehavior);
        }
示例#11
0
 public virtual ProcessDefinitionBuilder behavior(ActivityBehavior activityBehaviour)
 {
     Activity.ActivityBehavior = activityBehaviour;
     return(this);
 }
示例#12
0
        public virtual void execute(PvmExecutionImpl execution)
        {
            // restore activity instance id
            if (string.ReferenceEquals(execution.ActivityInstanceId, null))
            {
                execution.ActivityInstanceId = execution.ParentActivityInstanceId;
            }

            PvmActivity activity = execution.getActivity();
            IDictionary <ScopeImpl, PvmExecutionImpl> activityExecutionMapping = execution.createActivityExecutionMapping();

            PvmExecutionImpl propagatingExecution = execution;

            if (execution.Scope && activity.Scope)
            {
                if (!LegacyBehavior.destroySecondNonScope(execution))
                {
                    execution.destroy();
                    if (!execution.Concurrent)
                    {
                        execution.remove();
                        propagatingExecution = execution.Parent;
                        propagatingExecution.setActivity(execution.getActivity());
                    }
                }
            }

            propagatingExecution = LegacyBehavior.determinePropagatingExecutionOnEnd(propagatingExecution, activityExecutionMapping);
            PvmScope flowScope = activity.FlowScope;

            // 1. flow scope = Process Definition
            if (flowScope == activity.ProcessDefinition)
            {
                // 1.1 concurrent execution => end + tryPrune()
                if (propagatingExecution.Concurrent)
                {
                    propagatingExecution.remove();
                    propagatingExecution.Parent.tryPruneLastConcurrentChild();
                    propagatingExecution.Parent.forceUpdate();
                }
                else
                {
                    // 1.2 Process End
                    propagatingExecution.Ended = true;
                    if (!propagatingExecution.PreserveScope)
                    {
                        propagatingExecution.performOperation(PvmAtomicOperation_Fields.PROCESS_END);
                    }
                }
            }
            else
            {
                // 2. flowScope != process definition
                PvmActivity flowScopeActivity = (PvmActivity)flowScope;

                ActivityBehavior activityBehavior = flowScopeActivity.ActivityBehavior;
                if (activityBehavior is CompositeActivityBehavior)
                {
                    CompositeActivityBehavior compositeActivityBehavior = (CompositeActivityBehavior)activityBehavior;
                    // 2.1 Concurrent execution => composite behavior.concurrentExecutionEnded()
                    if (propagatingExecution.Concurrent && !LegacyBehavior.isConcurrentScope(propagatingExecution))
                    {
                        compositeActivityBehavior.concurrentChildExecutionEnded(propagatingExecution.Parent, propagatingExecution);
                    }
                    else
                    {
                        // 2.2 Scope Execution => composite behavior.complete()
                        propagatingExecution.setActivity(flowScopeActivity);
                        compositeActivityBehavior.complete(propagatingExecution);
                    }
                }
                else
                {
                    // activity behavior is not composite => this is unexpected
                    throw new ProcessEngineException("Expected behavior of composite scope " + activity + " to be a CompositeActivityBehavior but got " + activityBehavior);
                }
            }
        }