예제 #1
0
        protected internal virtual void DeletePropagate(ExecutionEntity processInstance, string deleteReason, bool skipCustomListeners, bool skipIoMappings)
        {
            ExecutionEntity topmostDeletableExecution = processInstance;
            ExecutionEntity parentScopeExecution      = (ExecutionEntity)topmostDeletableExecution.GetParentScopeExecution(true);

            while (parentScopeExecution != null && (parentScopeExecution.NonEventScopeExecutions.Count <= 1))
            {
                topmostDeletableExecution = parentScopeExecution;
                parentScopeExecution      = (ExecutionEntity)topmostDeletableExecution.GetParentScopeExecution(true);
            }

            topmostDeletableExecution.DeleteCascade(deleteReason, skipCustomListeners, skipIoMappings, false);
        }
        protected internal virtual void HandleChildRemovalInScope(ExecutionEntity removedExecution)
        {
            // TODO: the following should be closer to PvmAtomicOperationDeleteCascadeFireActivityEnd
            // (note though that e.g. boundary events expect concurrent executions to be preserved)
            //
            // Idea: attempting to prune and synchronize on the parent is the default behavior when
            // a concurrent child is removed, but scope activities implementing ModificationObserverBehavior
            // override this default (and thereforemust* take care of reorganization themselves)

            // notify the behavior that a concurrent execution has been removed

            // must be set due to deleteCascade behavior
            ActivityImpl activity  = removedExecution.Activity as ActivityImpl;
            ScopeImpl    flowScope = activity.FlowScope;

            IActivityExecution scopeExecution         = removedExecution.GetParentScopeExecution(false);
            IActivityExecution executionInParentScope = removedExecution.IsConcurrent ? removedExecution : removedExecution.Parent;

            if (flowScope.ActivityBehavior != null && flowScope.ActivityBehavior is IModificationObserverBehavior)
            {
                // let child removal be handled by the scope itself
                IModificationObserverBehavior behavior = (IModificationObserverBehavior)flowScope.ActivityBehavior;
                behavior.DestroyInnerInstance(executionInParentScope);
            }
            else
            {
                if (executionInParentScope.IsConcurrent)
                {
                    executionInParentScope.Remove();
                    scopeExecution.TryPruneLastConcurrentChild();
                    scopeExecution.ForceUpdate();
                }
            }
        }