Example #1
0
        protected internal override void EventNotificationsCompleted(PvmExecutionImpl execution)
        {
            IPvmActivity activity = execution.Activity;

            if (execution.IsScope && (ExecutesNonScopeActivity(execution) || IsAsyncBeforeActivity(execution)) &&
                !CompensationBehavior.executesNonScopeCompensationHandler(execution))
            {
                // case this is a scope execution and the activity is not a scope
                execution.LeaveActivityInstance();
                execution.Activity = (GetFlowScopeActivity(activity));
                execution.PerformOperation(PvmAtomicOperationFields.DeleteCascadeFireActivityEnd);
            }
            else
            {
                if (execution.IsScope)
                {
                    execution.Destroy();
                }

                // remove this execution and its concurrent parent (if exists)
                execution.Remove();

                var continueRemoval = !execution.IsDeleteRoot;

                if (continueRemoval)
                {
                    var propagatingExecution = execution.Parent;
                    if ((propagatingExecution != null) && !propagatingExecution.IsScope &&
                        !propagatingExecution.HasChildren())
                    {
                        propagatingExecution.Remove();
                        continueRemoval      = !propagatingExecution.IsDeleteRoot;
                        propagatingExecution = propagatingExecution.Parent;
                    }

                    if (continueRemoval)
                    {
                        if (propagatingExecution != null)
                        {
                            // continue deletion with the next scope execution
                            // set activity on parent in case the parent is an inactive scope execution and activity has been set to 'null'.
                            if ((propagatingExecution.Activity == null) && (activity != null) &&
                                (activity.FlowScope != null))
                            {
                                propagatingExecution.Activity = (GetFlowScopeActivity(activity));
                            }
                            ((PvmExecutionImpl)propagatingExecution).PerformOperation(PvmAtomicOperationFields.DeleteCascade);
                        }
                    }
                }
            }
        }
Example #2
0
        protected internal override void EventNotificationsCompleted(PvmExecutionImpl execution)
        {
            execution.LeaveActivityInstance();

            PvmExecutionImpl superExecution = (PvmExecutionImpl)execution.SuperExecution;

            ISubProcessActivityBehavior subProcessActivityBehavior = null;

            // copy variables before destroying the ended sub process instance
            if (superExecution != null)
            {
                IPvmActivity activity = superExecution.Activity;
                Log.LogDebug("-----------------ActivityBehavior类型异常", activity.GetType().Name);
                subProcessActivityBehavior = (ISubProcessActivityBehavior)activity.ActivityBehavior;

                try
                {
                    subProcessActivityBehavior.PassOutputVariables(superExecution, execution);
                }
                catch (System.Exception e)
                {
                    Log.ExceptionWhileCompletingSupProcess(execution, e);
                    throw new ProcessEngineException("Error while completing sub process of execution " + execution, e);
                }
            }
            //else if (superCaseExecution != null)
            //{
            //    CmmnActivity activity = superCaseExecution.Activity;
            //    transferVariablesBehavior = (TransferVariablesActivityBehavior)activity.ActivityBehavior;
            //    try
            //    {
            //        transferVariablesBehavior.transferVariables(execution, superCaseExecution);
            //    }
            //    catch (Exception e)
            //    {
            //        LOG.exceptionWhileCompletingSupProcess(execution, e);
            //        throw e;
            //    }
            //    catch (Exception e)
            //    {
            //        LOG.exceptionWhileCompletingSupProcess(execution, e);
            //        throw new ProcessEngineException("Error while completing sub process of execution " + execution, e);
            //    }
            //}

            execution.Destroy();
            execution.Remove();

            // and trigger execution afterwards
            if (superExecution != null)
            {
                superExecution.SubProcessInstance = null;
                try
                {
                    subProcessActivityBehavior.Completed(superExecution);
                }
                catch (System.Exception e)
                {
                    Log.ExceptionWhileCompletingSupProcess(execution, e);
                    throw new ProcessEngineException("Error while completing sub process of execution " + execution, e);
                }
            }
            //else if (superCaseExecution != null)
            //{
            //    superCaseExecution.complete();
            //}
        }