コード例 #1
0
        protected internal virtual void handleIncident(MigratingInstanceParseContext parseContext, IncidentEntity incident)
        {
            MigratingActivityInstance owningInstance = parseContext.getMigratingActivityInstanceById(incident.Execution.ActivityInstanceId);

            if (owningInstance != null)
            {
                parseContext.consume(incident);
                MigratingIncident migratingIncident = new MigratingIncident(incident, owningInstance.TargetScope);
                owningInstance.addMigratingDependentInstance(migratingIncident);
            }
        }
コード例 #2
0
        public virtual void handle(MigratingInstanceParseContext parseContext, MigratingActivityInstance activityInstance, IList <JobEntity> elements)
        {
            IDictionary <string, TimerDeclarationImpl> sourceTimerDeclarationsInEventScope = getTimerDeclarationsByTriggeringActivity(activityInstance.SourceScope);
            IDictionary <string, TimerDeclarationImpl> targetTimerDeclarationsInEventScope = getTimerDeclarationsByTriggeringActivity(activityInstance.TargetScope);

            foreach (JobEntity job in elements)
            {
                if (!isTimerJob(job))
                {
                    // skip non timer jobs
                    continue;
                }

                MigrationInstruction migrationInstruction = parseContext.findSingleMigrationInstruction(job.ActivityId);
                ActivityImpl         targetActivity       = parseContext.getTargetActivity(migrationInstruction);

                if (targetActivity != null && activityInstance.migratesTo(targetActivity.EventScope))
                {
                    // the timer job is migrated
                    JobDefinitionEntity targetJobDefinitionEntity = parseContext.getTargetJobDefinition(targetActivity.ActivityId, job.JobHandlerType);

                    TimerDeclarationImpl targetTimerDeclaration = targetTimerDeclarationsInEventScope.Remove(targetActivity.Id);

                    MigratingJobInstance migratingTimerJobInstance = new MigratingTimerJobInstance(job, targetJobDefinitionEntity, targetActivity, migrationInstruction.UpdateEventTrigger, targetTimerDeclaration);
                    activityInstance.addMigratingDependentInstance(migratingTimerJobInstance);
                    parseContext.submit(migratingTimerJobInstance);
                }
                else
                {
                    // the timer job is removed
                    MigratingJobInstance removingJobInstance = new MigratingTimerJobInstance(job);
                    activityInstance.addRemovingDependentInstance(removingJobInstance);
                    parseContext.submit(removingJobInstance);
                }

                parseContext.consume(job);
            }

            if (activityInstance.migrates())
            {
                addEmergingTimerJobs(parseContext, activityInstance, sourceTimerDeclarationsInEventScope, targetTimerDeclarationsInEventScope);
            }
        }
コード例 #3
0
        public virtual void onParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance)
        {
            ExecutionEntity execution = migratingInstance.resolveRepresentativeExecution();

            foreach (TaskEntity task in execution.Tasks)
            {
                migratingInstance.addMigratingDependentInstance(new MigratingUserTaskInstance(task, migratingInstance));
                parseContext.consume(task);

                ICollection <VariableInstanceEntity> variables = task.VariablesInternal;

                if (variables != null)
                {
                    foreach (VariableInstanceEntity variable in variables)
                    {
                        // we don't need to represent task variables in the migrating instance structure because
                        // they are migrated by the MigratingTaskInstance as well
                        parseContext.consume(variable);
                    }
                }
            }
        }
コード例 #4
0
        public virtual void handle(MigratingInstanceParseContext parseContext, MigratingActivityInstance owningInstance, IList <EventSubscriptionEntity> elements)
        {
            IDictionary <string, EventSubscriptionDeclaration> targetDeclarations = getDeclarationsByTriggeringActivity(owningInstance.TargetScope);

            foreach (EventSubscriptionEntity eventSubscription in elements)
            {
                if (!SupportedEventTypes.Contains(eventSubscription.EventType))
                {
                    // ignore unsupported event subscriptions
                    continue;
                }

                MigrationInstruction migrationInstruction = parseContext.findSingleMigrationInstruction(eventSubscription.ActivityId);
                ActivityImpl         targetActivity       = parseContext.getTargetActivity(migrationInstruction);

                if (targetActivity != null && owningInstance.migratesTo(targetActivity.EventScope))
                {
                    // the event subscription is migrated
                    EventSubscriptionDeclaration targetDeclaration = targetDeclarations.Remove(targetActivity.Id);

                    owningInstance.addMigratingDependentInstance(new MigratingEventSubscriptionInstance(eventSubscription, targetActivity, migrationInstruction.UpdateEventTrigger, targetDeclaration));
                }
                else
                {
                    // the event subscription will be removed
                    owningInstance.addRemovingDependentInstance(new MigratingEventSubscriptionInstance(eventSubscription));
                }

                parseContext.consume(eventSubscription);
            }

            if (owningInstance.migrates())
            {
                addEmergingEventSubscriptions(owningInstance, targetDeclarations);
            }
        }