public virtual void Handle(MigratingInstanceParseContext parseContext, EventSubscriptionEntity element)
        {
            MigratingProcessElementInstance migratingInstance;

            if (!ReferenceEquals(element.Configuration, null))
            {
                migratingInstance = CreateMigratingEventScopeInstance(parseContext, element);
            }
            else
            {
                migratingInstance = CreateMigratingEventSubscriptionInstance(parseContext, element);
            }


            ExecutionEntity        owningExecution = element.Execution;
            MigratingScopeInstance parentInstance  = null;

            if (owningExecution.IsEventScope)
            {
                parentInstance = parseContext.GetMigratingCompensationInstanceByExecutionId(owningExecution.Id);
            }
            else
            {
                parentInstance = parseContext.GetMigratingActivityInstanceById(owningExecution.ParentActivityInstanceId);
            }
            migratingInstance.Parent = parentInstance;
        }
Пример #2
0
        public virtual void Handle(MigratingInstanceParseContext parseContext, IActivityInstance element)
        {
            MigratingActivityInstance migratingInstance = null;

            var       applyingInstruction     = parseContext.GetInstructionFor(element.ActivityId);
            ScopeImpl sourceScope             = null;
            ScopeImpl targetScope             = null;
            var       representativeExecution = parseContext.Mapping.GetExecution(element);

            if (element.Id.Equals(element.ProcessInstanceId))
            {
                sourceScope = parseContext.SourceProcessDefinition;
                targetScope = parseContext.TargetProcessDefinition;
            }
            else
            {
                sourceScope = (ScopeImpl)parseContext.SourceProcessDefinition.FindActivity(element.ActivityId);

                if (applyingInstruction != null)
                {
                    var activityId = applyingInstruction.TargetActivityId;
                    targetScope = (ScopeImpl)parseContext.TargetProcessDefinition.FindActivity(activityId);
                }
            }

            migratingInstance = parseContext.MigratingProcessInstance.AddActivityInstance(applyingInstruction, element,
                                                                                          sourceScope, targetScope, representativeExecution);

            var parentInstance = parseContext.GetMigratingActivityInstanceById(element.ParentActivityInstanceId);

            if (parentInstance != null)
            {
                //migratingInstance.setParent(parentInstance);
            }

            //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
            //ORIGINAL LINE: org.camunda.bpm.engine.impl.core.delegate.CoreActivityBehavior<object> sourceActivityBehavior = sourceScope.getActivityBehavior();
            var sourceActivityBehavior = sourceScope.ActivityBehavior;

            if (sourceActivityBehavior is IMigrationObserverBehavior)
            {
                ((IMigrationObserverBehavior)sourceActivityBehavior).OnParseMigratingInstance(parseContext,
                                                                                              migratingInstance);
            }

            parseContext.Submit(migratingInstance);

            ParseTransitionInstances(parseContext, migratingInstance);

            ParseDependentInstances(parseContext, migratingInstance);
        }