コード例 #1
0
        public static bool DefinesPersistentEventTrigger(IPvmScope activity)
        {
            var eventScope = (ScopeImpl)activity.EventScope;

            if (eventScope != null)
            {
                return(TimerDeclarationImpl.GetDeclarationsForScope(eventScope).ContainsKey(activity.Id) ||
                       EventSubscriptionDeclaration.GetDeclarationsForScope(eventScope).ContainsKey(activity.Id));
            }
            return(false);
        }
コード例 #2
0
        public virtual void Validate(IValidatingMigrationInstruction instruction,
                                     ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            IPvmScope sourceActivity = instruction.SourceActivity;
            var       instructionsForSourceActivity = instructions.GetInstructionsBySourceScope(sourceActivity);

            if (instructionsForSourceActivity.Count > 1)
            {
//addFailure(sourceActivity.Id, instructionsForSourceActivity, report);
            }
        }
コード例 #3
0
        protected internal virtual void InitActivityInstanceEvent(HistoricActivityInstanceEventEntity evt, MigratingActivityInstance migratingActivityInstance, IHistoryEventType eventType)
        {
            IPvmScope eventSource        = migratingActivityInstance.TargetScope;
            string    activityInstanceId = migratingActivityInstance.ActivityInstanceId;

            MigratingActivityInstance parentInstance = (MigratingActivityInstance)migratingActivityInstance.Parent;
            string parentActivityInstanceId          = null;

            if (parentInstance != null)
            {
                parentActivityInstanceId = parentInstance.ActivityInstanceId;
            }

            ExecutionEntity execution = migratingActivityInstance.ResolveRepresentativeExecution();

            InitActivityInstanceEvent(evt, execution, eventSource, activityInstanceId, parentActivityInstanceId, eventType);
        }
コード例 #4
0
ファイル: LegacyBehavior.cs プロジェクト: zf321/ESS.FW.Bpm
        /// <summary>
        ///     This method
        /// </summary>
        /// <param name="scopeExecution"> </param>
        /// <param name="isLegacyBehaviorTurnedOff">
        ///     @return
        /// </param>
        protected internal static bool IsLegacyBehaviorRequired(IActivityExecution scopeExecution)
        {
            // legacy behavior is turned off: the current activity was parsed as scope.
            // now we need to check whether a scope execution was correctly created for the
            // event subprocess.

            // first create the mapping:
            var activityExecutionMapping = scopeExecution.CreateActivityExecutionMapping();
            // if the scope execution for the current activity is the same as for the parent scope
            // -> we need to perform legacy behavior
            IPvmScope activity = scopeExecution.Activity;

            if (!activity.IsScope)
            {
                activity = activity.FlowScope;
            }
            return(activityExecutionMapping[(ScopeImpl)activity] == activityExecutionMapping[activity.FlowScope]);
        }
コード例 #5
0
        protected internal override ActivityExecutionTuple NextElement()
        {
            var       currentScope = CurrentElement.Scope;
            IPvmScope flowScope    = currentScope.FlowScope;

            if (flowScope != null)
            {
                // walk to parent scope
                var execution = _activityExecutionMapping[(ScopeImpl)flowScope];
                return(new ActivityExecutionTuple(flowScope, execution));
            }
            // this is the process instance, look for parent
            var currentExecution = _activityExecutionMapping[(ScopeImpl)currentScope];
            var superExecution   = (PvmExecutionImpl)currentExecution.SuperExecution;

            if (superExecution != null)
            {
                // walk to parent process instance
                _activityExecutionMapping = superExecution.CreateActivityExecutionMapping();
                return(CreateTupel(superExecution));
            }
            // this is the top level process instance
            return(null);
        }
コード例 #6
0
        protected internal virtual void InitActivityInstanceEvent(HistoricActivityInstanceEventEntity evt, ExecutionEntity execution, IHistoryEventType eventType)
        {
            IPvmScope eventSource = execution.Activity;

            if (eventSource == null)
            {
                eventSource = (IPvmScope)execution.EventSource;
            }
            string activityInstanceId = execution.ActivityInstanceId;

            string          parentActivityInstanceId = null;
            ExecutionEntity parentExecution          = (ExecutionEntity)execution.Parent;

            if (parentExecution != null && CompensationBehavior.IsCompensationThrowing(parentExecution) && execution.Activity != null)
            {
                parentActivityInstanceId = CompensationBehavior.GetParentActivityInstanceId(execution);
            }
            else
            {
                parentActivityInstanceId = execution.ParentActivityInstanceId;
            }

            InitActivityInstanceEvent(evt, execution, eventSource, activityInstanceId, parentActivityInstanceId, eventType);
        }
コード例 #7
0
        public virtual IList <IValidatingMigrationInstruction> GetInstructionsByTargetScope(IPvmScope scope)
        {
            var instructions = InstructionsByTargetScope[scope];

            if (instructions == null)
            {
                return(null);
            }
            return(instructions);
        }
コード例 #8
0
        public static IDictionary <string, EventSubscriptionDeclaration> GetDeclarationsForScope(IPvmScope scope)
        {
            if (scope == null)
            {
                return(null);
            }

            return(scope.Properties.Get(BpmnProperties.EventSubscriptionDeclarations));
        }
コード例 #9
0
        protected internal virtual bool IsCompensationBoundaryEvent(IPvmScope sourceActivity)
        {
            var activityType = sourceActivity.Properties.Get(BpmnProperties.Type);

            return(ActivityTypes.BoundaryCompensation.Equals(activityType));
        }
コード例 #10
0
 /// <returns> the mapped execution for scope or <code>null</code>, if no mapping exists </returns>
 public virtual PvmExecutionImpl GetExecutionForScope(IPvmScope scope)
 {
     return(_activityExecutionMapping[(ScopeImpl)scope]);
 }
コード例 #11
0
        protected internal virtual void InitActivityInstanceEvent(HistoricActivityInstanceEventEntity evt, ExecutionEntity execution, IPvmScope eventSource, string activityInstanceId, string parentActivityInstanceId, IHistoryEventType eventType)
        {
            evt.Id                       = activityInstanceId;
            evt.EventType                = eventType.EventName;
            evt.ActivityInstanceId       = activityInstanceId;
            evt.ParentActivityInstanceId = parentActivityInstanceId;
            evt.ProcessDefinitionId      = execution.ProcessDefinitionId;
            evt.ProcessInstanceId        = execution.ProcessInstanceId;
            evt.ExecutionId              = execution.Id;
            evt.TenantId                 = execution.TenantId;

            ProcessDefinitionEntity definition = execution.GetProcessDefinition();

            if (definition != null)
            {
                evt.ProcessDefinitionKey = definition.Key;
            }

            evt.ActivityId   = eventSource.Id;
            evt.ActivityName = (string)eventSource.GetProperty("name");
            evt.ActivityType = (string)eventSource.GetProperty("type");

            // update sub process reference
            ExecutionEntity subProcessInstance = execution.GetSubProcessInstance();

            if (subProcessInstance != null)
            {
                evt.CalledProcessInstanceId = subProcessInstance.Id;
            }

            // update sub case reference
            //CaseExecutionEntity subCaseInstance = execution.GetSubCaseInstance();
            //if (subCaseInstance != null)
            //{
            //    evt.CalledCaseInstanceId = subCaseInstance.Id;
            //}
        }
コード例 #12
0
        public virtual void Execute(PvmExecutionImpl execution)
        {
            // restore activity instance id
            if (execution.ActivityInstanceId == null)
            {
                execution.ActivityInstanceId = execution.ParentActivityInstanceId;
            }

            IPvmActivity activity = execution.Activity;
            var          activityExecutionMapping = execution.CreateActivityExecutionMapping();

            var propagatingExecution = execution;

            if (execution.IsScope && activity.IsScope)
            {
                if (!LegacyBehavior.DestroySecondNonScope(execution))
                {
                    execution.Destroy();
                    if (!execution.IsConcurrent)
                    {
                        execution.Remove();
                        propagatingExecution          = (PvmExecutionImpl)execution.Parent;
                        propagatingExecution.Activity = (execution.Activity);
                    }
                }
            }

            propagatingExecution = (PvmExecutionImpl)LegacyBehavior.DeterminePropagatingExecutionOnEnd(propagatingExecution,
                                                                                                       activityExecutionMapping);
            IPvmScope flowScope = activity.FlowScope;

            // 1. flow scope = Process Definition
            if (flowScope == activity.ProcessDefinition)
            {
                // 1.1 concurrent execution => end + tryPrune()
                if (propagatingExecution.IsConcurrent)
                {
                    propagatingExecution.Remove();
                    propagatingExecution.Parent.TryPruneLastConcurrentChild();
                    propagatingExecution.Parent.ForceUpdate();
                }
                else
                {
                    // 1.2 Process End
                    if (!propagatingExecution.PreserveScope)
                    {
                        propagatingExecution.PerformOperation(PvmAtomicOperationFields.ProcessEnd);
                    }
                }
            }
            else
            {
                // 2. flowScope != process definition
                var flowScopeActivity = (IPvmActivity)flowScope;

                var activityBehavior = flowScopeActivity.ActivityBehavior;
                if (activityBehavior is ICompositeActivityBehavior)
                {
                    var compositeActivityBehavior = (ICompositeActivityBehavior)activityBehavior;
                    // 2.1 Concurrent execution => composite behavior.concurrentExecutionEnded()
                    if (propagatingExecution.IsConcurrent && !LegacyBehavior.IsConcurrentScope(propagatingExecution))
                    {
                        compositeActivityBehavior.ConcurrentChildExecutionEnded(propagatingExecution.Parent,
                                                                                propagatingExecution);
                    }
                    else
                    {
                        // 2.2 Scope Execution => composite behavior.complete()
                        propagatingExecution.Activity = (ActivityImpl)(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);
                }
            }
        }
コード例 #13
0
 public ActivityExecutionTuple(IPvmScope scope, IActivityExecution execution)
 {
     Execution = execution;
     Scope     = scope;
 }
コード例 #14
0
        public static IDictionary <string, TimerDeclarationImpl> GetDeclarationsForScope(IPvmScope scope)
        {
            if (scope == null)
            {
                return(null);
            }

            var result = scope.Properties.Get(BpmnProperties.TimerDeclarations);

            if (result != null)
            {
                return(result);
            }
            return(null);
        }