Exemplo n.º 1
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);
        }