public virtual void Validate(MigratingActivityInstance migratingInstance, MigratingProcessInstance migratingProcessInstance, MigratingActivityInstanceValidationReportImpl instanceReport) { var sourceScope = migratingInstance.SourceScope; var targetScope = migratingInstance.TargetScope; if (migratingInstance.Migrates()) { var becomesNonScope = sourceScope.IsScope && !targetScope.IsScope; if (becomesNonScope) { var dependentVariablesByName = GetMigratingVariableInstancesByName(migratingInstance); foreach (var variableName in dependentVariablesByName.Keys) { if (dependentVariablesByName[variableName].Count > 1) { instanceReport.AddFailure("The variable '" + variableName + "' exists in both, this scope and " + "concurrent local in the parent scope. " + "Migrating to a non-scope activity would overwrite one of them."); } } } } }
public virtual void Handle(MigratingInstanceParseContext parseContext, MigratingActivityInstance activityInstance, IList <JobEntity> elements) { var timerDeclarationsInEventScope = GetTimerDeclarationsByTriggeringActivity(activityInstance.TargetScope); foreach (var job in elements) { if (!IsTimerJob(job)) { continue; } //var migrationInstruction = parseContext.findSingleMigrationInstruction(job.ActivityId); //var 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 = timerDeclarationsInEventScope.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(activityInstance, timerDeclarationsInEventScope.Values); } }
public virtual void Handle(MigratingInstanceParseContext parseContext, MigratingActivityInstance owningInstance, IList <EventSubscriptionEntity> elements) { var targetDeclarations = GetDeclarationsByTriggeringActivity(owningInstance.TargetScope); foreach (var eventSubscription in elements) { if (!SupportedEventTypes.Contains(eventSubscription.EventType)) { continue; } var migrationInstruction = parseContext.FindSingleMigrationInstruction(eventSubscription.ActivityId); var targetActivity = parseContext.GetTargetActivity(migrationInstruction); if ((targetActivity != null) && owningInstance.MigratesTo((ScopeImpl)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.Values); } }