public virtual void OnParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) { var execution = migratingInstance.ResolveRepresentativeExecution(); foreach (ExternalTaskEntity task in execution.ExternalTasks) { var migratingTask = new MigratingExternalTaskInstance(task, migratingInstance); migratingInstance.AddMigratingDependentInstance(migratingTask); parseContext.Consume(task); parseContext.Submit(migratingTask); } }
public virtual void OnParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) { ActivityImpl callActivity = (ActivityImpl)migratingInstance.SourceScope; // A call activity is typically scope and since we guarantee stability of scope executions during migration, // the superExecution link does not have to be maintained during migration. // There are some exceptions, though: A multi-instance call activity is not scope and therefore // does not have a dedicated scope execution. In this case, the link to the super execution // must be maintained throughout migration if (!callActivity.IsScope) { ExecutionEntity callActivityExecution = migratingInstance.ResolveRepresentativeExecution(); ExecutionEntity calledProcessInstance = callActivityExecution.SubProcessInstance as ExecutionEntity; migratingInstance.AddMigratingDependentInstance(new MigratingCalledProcessInstance(calledProcessInstance)); } }
protected internal virtual void InitActivityInstanceEvent(HistoricActivityInstanceEventEntity evt, MigratingActivityInstance migratingActivityInstance, IHistoryEventType eventType) { IPvmScope eventSource = migratingActivityInstance.TargetScope; string activityInstanceId = migratingActivityInstance.ActivityInstanceId; MigratingActivityInstance parentInstance = (MigratingActivityInstance)migratingActivityInstance.Parent; string parentActivityInstanceId = null; if (parentInstance != null) { parentActivityInstanceId = parentInstance.ActivityInstanceId; } ExecutionEntity execution = migratingActivityInstance.ResolveRepresentativeExecution(); InitActivityInstanceEvent(evt, execution, eventSource, activityInstanceId, parentActivityInstanceId, eventType); }
public virtual void OnParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) { ExecutionEntity scopeExecution = migratingInstance.ResolveRepresentativeExecution(); IList <IActivityExecution> concurrentInActiveExecutions = scopeExecution.FindInactiveChildExecutions(GetInnerActivity((ActivityImpl)migratingInstance.SourceScope)); //variables on ended inner instance executions need not be migrated anywhere //since they are also not represented in the tree of migrating instances, we remove // them from the parse context here to avoid a validation exception foreach (IActivityExecution execution in concurrentInActiveExecutions) { foreach (VariableInstanceEntity variable in ((ExecutionEntity)execution).VariablesInternal) { parseContext.Consume(variable); } } }
protected internal virtual IList <VariableInstanceEntity> CollectActivityInstanceVariables( MigratingActivityInstance instance) { throw new NotImplementedException(); IList <VariableInstanceEntity> variables = new List <VariableInstanceEntity>(); var representativeExecution = instance.ResolveRepresentativeExecution(); //ExecutionEntity parentExecution = representativeExecution.Parent; // decide for representative execution and parent execution whether to none/all/concurrentLocal variables // belong to this activity instance //var addAllRepresentativeExecutionVariables = instance.SourceScope.Scope || // representativeExecution.Concurrent; //if (addAllRepresentativeExecutionVariables) //{ // ((List<VariableInstanceEntity>) variables).AddRange(representativeExecution.VariablesInternal); //} //else //{ // ((List<VariableInstanceEntity>) variables).AddRange(getConcurrentLocalVariables(representativeExecution)); //} //var addAnyParentExecutionVariables = parentExecution != null && instance.SourceScope.Scope; //if (addAnyParentExecutionVariables) //{ // bool addAllParentExecutionVariables = parentExecution.Concurrent; // if (addAllParentExecutionVariables) // { // ((List<VariableInstanceEntity>) variables).AddRange(parentExecution.VariablesInternal); // } // else // { // ((List<VariableInstanceEntity>) variables).AddRange(getConcurrentLocalVariables(parentExecution)); // } //} return(variables); }
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 <ICoreVariableInstance> variables = task.VariablesInternal; if (variables != null) { foreach (VariableInstanceEntity variable in variables) { // we don't need to represent ITask variables in the migrating instance structure because // they are migrated by the MigratingTaskInstance as well parseContext.Consume(variable); } } } }
public virtual HistoryEvent CreateActivityInstanceMigrateEvt(MigratingActivityInstance actInstance) { // create event instance HistoricActivityInstanceEventEntity evt = LoadActivityInstanceEventEntity(actInstance.ResolveRepresentativeExecution()); // initialize event InitActivityInstanceEvent(evt, actInstance, HistoryEventTypes.ActivityInstanceMigrate); return(evt); }