Esempio n. 1
0
        public virtual void handle(MigratingInstanceParseContext parseContext, TransitionInstance transitionInstance)
        {
            if (!isAsyncTransitionInstance(transitionInstance))
            {
                return;
            }

            MigrationInstruction applyingInstruction = parseContext.getInstructionFor(transitionInstance.ActivityId);

            ScopeImpl sourceScope = parseContext.SourceProcessDefinition.findActivity(transitionInstance.ActivityId);
            ScopeImpl targetScope = null;

            if (applyingInstruction != null)
            {
                string activityId = applyingInstruction.TargetActivityId;
                targetScope = parseContext.TargetProcessDefinition.findActivity(activityId);
            }

            ExecutionEntity asyncExecution = Context.CommandContext.ExecutionManager.findExecutionById(transitionInstance.ExecutionId);

            MigratingTransitionInstance migratingTransitionInstance = parseContext.MigratingProcessInstance.addTransitionInstance(applyingInstruction, transitionInstance, sourceScope, targetScope, asyncExecution);

            MigratingActivityInstance parentInstance = parseContext.getMigratingActivityInstanceById(transitionInstance.ParentActivityInstanceId);

            migratingTransitionInstance.setParent(parentInstance);

            IList <JobEntity> jobs = asyncExecution.Jobs;

            parseContext.handleDependentTransitionInstanceJobs(migratingTransitionInstance, jobs);

            parseContext.handleDependentVariables(migratingTransitionInstance, collectTransitionInstanceVariables(migratingTransitionInstance));
        }
Esempio n. 2
0
        public virtual void handle(MigratingInstanceParseContext parseContext, ActivityInstance element)
        {
            MigratingActivityInstance migratingInstance = null;

            MigrationInstruction applyingInstruction     = parseContext.getInstructionFor(element.ActivityId);
            ScopeImpl            sourceScope             = null;
            ScopeImpl            targetScope             = null;
            ExecutionEntity      representativeExecution = parseContext.Mapping.getExecution(element);

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

                if (applyingInstruction != null)
                {
                    string activityId = applyingInstruction.TargetActivityId;
                    targetScope = parseContext.TargetProcessDefinition.findActivity(activityId);
                }
            }

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

            MigratingActivityInstance 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<?> sourceActivityBehavior = sourceScope.getActivityBehavior();
            CoreActivityBehavior <object> sourceActivityBehavior = sourceScope.ActivityBehavior;

            if (sourceActivityBehavior is MigrationObserverBehavior)
            {
                ((MigrationObserverBehavior)sourceActivityBehavior).onParseMigratingInstance(parseContext, migratingInstance);
            }

            parseContext.submit(migratingInstance);

            parseTransitionInstances(parseContext, migratingInstance);

            parseDependentInstances(parseContext, migratingInstance);
        }